Changeset 185989 in webkit for trunk/Source/JavaScriptCore/parser/Parser.h
- Timestamp:
- Jun 25, 2015, 11:49:20 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/parser/Parser.h
r185699 r185989 81 81 82 82 enum SourceElementsMode { CheckForStrictMode, DontCheckForStrictMode }; 83 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX) 84 enum FunctionParseType { StandardFunctionParseType, ArrowFunctionParseType }; 85 #else 86 enum FunctionParseType { StandardFunctionParseType}; 87 #endif 83 88 enum FunctionRequirements { FunctionNoRequirements, FunctionNeedsName }; 84 89 enum FunctionParseMode { … … 87 92 SetterMode, 88 93 MethodMode, 94 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX) 95 ArrowFunctionMode 96 #endif 89 97 }; 90 98 enum DeconstructionKind { … … 431 439 432 440 JSTextPosition positionBeforeLastNewline() const { return m_lexer->positionBeforeLastNewline(); } 441 JSTokenLocation locationBeforeLastToken() const { return m_lexer->lastTokenLocation(); } 433 442 Vector<RefPtr<UniquedStringImpl>>&& closedVariables() { return WTF::move(m_closedVariables); } 434 443 … … 612 621 return m_token.m_type == IDENT && *m_token.m_data.ident == m_vm->propertyNames->of; 613 622 } 623 624 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX) 625 ALWAYS_INLINE bool isEndOfArrowFunction() 626 { 627 return match(SEMICOLON) || match(COMMA) || match(CLOSEPAREN) || match(CLOSEBRACE) || match(CLOSEBRACKET) || match(EOFTOK) || m_lexer->prevTerminator(); 628 } 629 630 ALWAYS_INLINE bool isArrowFunctionParamters() 631 { 632 bool isArrowFunction = false; 633 634 if (match(EOFTOK)) 635 return isArrowFunction; 636 637 SavePoint saveArrowFunctionPoint = createSavePoint(); 638 639 if (consume(OPENPAREN)) { 640 bool isArrowFunctionParamters = true; 641 642 while (consume(IDENT)) { 643 if (consume(COMMA)) { 644 if (!match(IDENT)) { 645 isArrowFunctionParamters = false; 646 break; 647 } 648 } else 649 break; 650 } 651 652 if (isArrowFunctionParamters) { 653 if (consume(CLOSEPAREN) && match(ARROWFUNCTION)) 654 isArrowFunction = true; 655 } 656 } else if (consume(IDENT) && match(ARROWFUNCTION)) 657 isArrowFunction = true; 658 659 restoreSavePoint(saveArrowFunctionPoint); 660 661 return isArrowFunction; 662 } 663 #endif 614 664 615 665 ALWAYS_INLINE unsigned tokenStart() … … 716 766 return result; 717 767 } 718 719 template <class TreeBuilder> TreeSourceElements parseSourceElements(TreeBuilder&, SourceElementsMode );768 769 template <class TreeBuilder> TreeSourceElements parseSourceElements(TreeBuilder&, SourceElementsMode, FunctionParseType); 720 770 template <class TreeBuilder> TreeStatement parseStatement(TreeBuilder&, const Identifier*& directive, unsigned* directiveLiteralLength = 0); 721 771 #if ENABLE(ES6_CLASS_SYNTAX) … … 757 807 template <class TreeBuilder> TreeExpression parsePropertyMethod(TreeBuilder& context, const Identifier* methodName); 758 808 template <class TreeBuilder> TreeProperty parseGetterSetter(TreeBuilder&, bool strict, PropertyNode::Type, unsigned getterOrSetterStartOffset, ConstructorKind = ConstructorKind::None, SuperBinding = SuperBinding::NotNeeded); 759 template <class TreeBuilder> ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&, int functionKeywordStart, int functionNameStart, int parametersStart, ConstructorKind );809 template <class TreeBuilder> ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&, int functionKeywordStart, int functionNameStart, int parametersStart, ConstructorKind, FunctionParseType); 760 810 template <class TreeBuilder> ALWAYS_INLINE TreeFormalParameterList parseFormalParameters(TreeBuilder&); 761 811 enum VarDeclarationListContext { ForLoopContext, VarDeclarationContext }; … … 763 813 template <class TreeBuilder> NEVER_INLINE TreeConstDeclList parseConstDeclarationList(TreeBuilder&); 764 814 815 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX) 816 template <class TreeBuilder> TreeStatement parseArrowFunctionSingleExpressionBody(TreeBuilder&, FunctionParseType); 817 template <class TreeBuilder> TreeExpression parseArrowFunctionExpression(TreeBuilder&); 818 #endif 819 765 820 template <class TreeBuilder> NEVER_INLINE TreeDeconstructionPattern createBindingPattern(TreeBuilder&, DeconstructionKind, const Identifier&, int depth, JSToken); 766 821 template <class TreeBuilder> NEVER_INLINE TreeDeconstructionPattern parseDeconstructionPattern(TreeBuilder&, DeconstructionKind, int depth = 0); … … 768 823 template <class TreeBuilder> NEVER_INLINE TreeExpression parseDefaultValueForDeconstructionPattern(TreeBuilder&); 769 824 770 template <class TreeBuilder> NEVER_INLINE bool parseFunctionInfo(TreeBuilder&, FunctionRequirements, FunctionParseMode, bool nameIsInContainingScope, ConstructorKind, SuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>& );771 772 template <class TreeBuilder> NEVER_INLINE int parseFunctionParameters(TreeBuilder&, Function Requirements, FunctionParseMode, bool, AutoPopScopeRef&, ParserFunctionInfo<TreeBuilder>&);825 template <class TreeBuilder> NEVER_INLINE bool parseFunctionInfo(TreeBuilder&, FunctionRequirements, FunctionParseMode, bool nameIsInContainingScope, ConstructorKind, SuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>&, FunctionParseType); 826 827 template <class TreeBuilder> NEVER_INLINE int parseFunctionParameters(TreeBuilder&, FunctionParseMode, ParserFunctionInfo<TreeBuilder>&); 773 828 774 829 #if ENABLE(ES6_CLASS_SYNTAX) 775 830 template <class TreeBuilder> NEVER_INLINE TreeClassExpression parseClass(TreeBuilder&, FunctionRequirements, ParserClassInfo<TreeBuilder>&); 776 831 #endif 832 777 833 #if ENABLE(ES6_TEMPLATE_LITERAL_SYNTAX) 778 834 template <class TreeBuilder> NEVER_INLINE typename TreeBuilder::TemplateString parseTemplateString(TreeBuilder& context, bool isTemplateHead, typename LexerType::RawStringsBuildMode, bool& elementIsTail); … … 794 850 } 795 851 852 853 #if ENABLE(ES6_ARROWFUNCTION_SYNTAX) 854 void setEndOfStatement() 855 { 856 m_lexer->setTokenPosition(&m_token); 857 } 858 #endif 859 796 860 bool canRecurse() 797 861 {
Note:
See TracChangeset
for help on using the changeset viewer.