public override object VisitVarDecl(PParser.VarDeclContext context) { // annotationSet? if (context.annotationSet() != null) { throw new NotImplementedException("variable annotations"); } // COLON type var variableType = ResolveType(context.type()); // VAR idenList var variables = new Variable[context.idenList()._names.Count]; var varNameCtxs = context.idenList()._names; for (var i = 0; i < varNameCtxs.Count; i++) { var variable = (Variable)nodesToDeclarations.Get(varNameCtxs[i]); variable.Type = variableType; variables[i] = variable; } // SEMI return(variables); }
public override object VisitVarDecl(PParser.VarDeclContext context) { foreach (PParser.IdenContext varName in context.idenList()._names) { Variable decl = CurrentScope.Put(varName.GetText(), varName, VariableRole.Field); nodesToDeclarations.Put(varName, decl); } return(null); }
public override object VisitVarDecl(PParser.VarDeclContext context) { foreach (PParser.IdenContext varName in context.idenList()._names) { Variable variable = method.Scope.Put(varName.GetText(), varName, VariableRole.Local); variable.Type = TypeResolver.ResolveType(context.type(), method.Scope, handler); method.AddLocalVariable(variable); } return(null); }
public override object VisitVarDecl(PParser.VarDeclContext context) { // COLON type var variableType = ResolveType(context.type()); // VAR idenList var variables = new Variable[context.idenList()._names.Count]; var varNameCtxs = context.idenList()._names; for (var i = 0; i < varNameCtxs.Count; i++) { var variable = (Variable)nodesToDeclarations.Get(varNameCtxs[i]); variable.Type = variableType; variables[i] = variable; } // SEMI return(variables); }