fromAst static method
Implementation
static SwitchCase? fromAst(Map? ast) {
if (ast != null) {
var statements = <Expression?>[];
var list = ast['statements'] as List?;
list?.forEach((s) {
statements.add(Expression.fromAst(s));
});
if (ast['type'] == astNodeNameValue(AstNodeName.SwitchCase)) {
return SwitchCase(
Expression.fromAst(ast['condition']), statements, false,
ast: ast);
} else if (ast['type'] == astNodeNameValue(AstNodeName.SwitchDefault)) {
return SwitchCase(null, statements, true, ast: ast);
} else {
return null;
}
}
return null;
}