fromAst static method

ListLiteral? fromAst(
  1. Map? ast
)

Implementation

static ListLiteral? fromAst(Map? ast) {
  if (ast != null &&
      ast['type'] == astNodeNameValue(AstNodeName.ListLiteral)) {
    var astElements = ast['elements'];
    var items = <Expression>[];

    if (astElements is List) {
      for (var e in astElements) {
        var expression = Expression.fromAst(e);
        if (expression != null) {
          items.add(expression);
        }
      }
    }
    return ListLiteral(items, ast: ast);
  }
  return null;
}