fromAst static method

FunctionExpression? fromAst(
  1. Map? ast
)

Implementation

static FunctionExpression? fromAst(Map? ast) {
  if (ast != null &&
      ast['type'] == astNodeNameValue(AstNodeName.FunctionExpression)) {
    var astParameters = ast['parameters']['parameterList'] as List?;
    var parameters = <SimpleFormalParameter?>[];
    astParameters?.forEach((p) {
      parameters.add(SimpleFormalParameter.fromAst(p));
    });

    return FunctionExpression(parameters, BlockStatement.fromAst(ast['body']),
        isAsync: ast['isAsync'] as bool, ast: ast);
  }
  return null;
}