private LocalDeclarationStatementNode parseLocalDeclarationStatement(TypeReferenceNode type, bool eatSemiColon) { var declaration = new LocalDeclarationStatementNode(); setSavedScannerState(declaration); declaration.Type = type; var declarator = new VariableDeclaratorNode(); setScannerState(declarator); declarator.NameOffset = scanner.StartPosition; declarator.NameLength = getLexicalUnitLength(); declaration.Declarators.add(declarator); nextLexicalUnit(true); if (lexicalUnit == LexicalUnit.Assign) { nextLexicalUnit(true); declarator.Value = parseLocalVariableInitializer(); declarator.EndPosition = declarator.Value.EndPosition; } else { declarator.EndPosition = declarator.NameOffset + declarator.NameLength; } int endPosition = declarator.EndPosition; while (lexicalUnit == LexicalUnit.Comma) { if (!isIdentifier(nextLexicalUnit(true))) { throw error(ParseErrorId.IdentifierExpected); } declarator = new VariableDeclaratorNode(); setScannerState(declarator); declarator.NameOffset = scanner.StartPosition; declarator.NameLength = getLexicalUnitLength(); declaration.Declarators.add(declarator); nextLexicalUnit(true); if (lexicalUnit == LexicalUnit.Assign) { nextLexicalUnit(true); declarator.Value = parseLocalVariableInitializer(); declarator.EndPosition = declarator.Value.EndPosition; } else { declarator.EndPosition = declarator.NameOffset + declarator.NameLength; } endPosition = declarator.EndPosition; } if (eatSemiColon) { declaration.EndPosition = parseSemiColon(false, false); } else { declaration.EndPosition = endPosition; } return declaration; }
public void declareLocals(LocalDeclarationStatementNode statement) { foreach (var decl in statement.Declarators) { localInfos.add(decl.getUserData(typeof(MemberInfo))); } }
protected virtual TResult handleLocalDeclaration(LocalDeclarationStatementNode localDeclaration, TSource source) { return(defaultHandler()); }