visitVariableDeclarator method

  1. @override
dynamic visitVariableDeclarator(
  1. VariableDeclarator node
)

Implementation

@override
visitVariableDeclarator(VariableDeclarator node) {
  Name name = node.name;
  dynamic value;
  if (node.init != null) {
    value = getValueFromExpression(node.init!);
    addToThisContext(name, value);
  } else {
    //hoisting
    Context ctx = getContextForScope(name.scope!);
    if (!ctx.hasContext(name.value)) {
      addToThisContext(name, value);
    }
  }
  return name;
}