private ParseTree parseClassMemberDeclaration() { return parseClassMemberDeclaration(getClassElementDefaults()); }
private ParseTree parseClassElement(PartialClassElement partialElement) { if (peekGetAccessor()) { return parseGetAccessor(partialElement); } else if (peekSetAccessor()) { return parseSetAccessor(partialElement); } else if (peekAsyncMethod()) { return parseAsyncMethod(partialElement); } else { return parseClassMemberDeclaration(partialElement); } }
private ParseTree parseClassElement(boolean isAmbient) { TokenType access = maybeParseAccessibilityModifier(); if (peek(TokenType.SEMI_COLON)) { return parseEmptyStatement(); } if (peekGetAccessor(true)) { return parseGetAccessor(access); } if (peekSetAccessor(true)) { return parseSetAccessor(access); } return parseClassMemberDeclaration(true, isAmbient, access); }
private ParseTree parsePropertyAssignmentGenerator() { TokenType type = peekType(1); if (type == TokenType.STRING || type == TokenType.NUMBER || type == TokenType.IDENTIFIER || Keywords.isKeyword(type)) { // parseMethodDeclaration will consume the '*'. return parseClassMemberDeclaration(false, false, null); } else { SourcePosition start = getTreeStartLocation(); eat(TokenType.STAR); ParseTree name = parseComputedPropertyName(); ParseTree value = parseFunctionTail( start, null, false, true, null, FunctionDeclarationTree.Kind.EXPRESSION); return new ComputedPropertyMethodTree(getTreeLocation(start), null, name, value); } }
private ParseTree parsePropertyAssignmentGenerator() { TokenType type = peekType(1); if (type == TokenType.STRING || type == TokenType.NUMBER || type == TokenType.IDENTIFIER || Keywords.isKeyword(type)) { // parseMethodDeclaration will consume the '*'. return parseClassMemberDeclaration(); } else { SourcePosition start = getTreeStartLocation(); eat(TokenType.STAR); ParseTree name = parseComputedPropertyName(); FunctionDeclarationTree.Builder builder = FunctionDeclarationTree.builder(FunctionDeclarationTree.Kind.EXPRESSION); parseFunctionTail(builder, FunctionFlavor.GENERATOR); ParseTree value = builder.build(getTreeLocation(start)); return new ComputedPropertyMethodTree(getTreeLocation(start), null, name, value); } }
return parseSetAccessor(null); } else if (peekType(1) == TokenType.OPEN_PAREN) { return parseClassMemberDeclaration(false, false, null); } else { return parsePropertyNameAssignment();
return parseAsyncMethod(); } else if (peekType(1) == TokenType.OPEN_PAREN) { return parseClassMemberDeclaration(); } else { return parsePropertyNameAssignment();