fromAst static method

VariableDeclarator? fromAst(
  1. Map? ast
)

Implementation

static VariableDeclarator? fromAst(Map? ast) {
  if (ast != null &&
      ast['type'] == astNodeNameValue(AstNodeName.VariableDeclarator)) {
    var name = Identifier.fromAst(ast['id'])?.name;
    FairLogicUnit().addVariable(name);
    return VariableDeclarator(
        name, Expression.fromAst(ast['init']),
        ast: ast);
  }
  return null;
}