Changeset 63055 in webkit for trunk/JavaScriptCore/parser/JSParser.cpp
- Timestamp:
- Jul 10, 2010, 5:11:08 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/parser/JSParser.cpp
r63024 r63055 59 59 #define TreeProperty typename TreeBuilder::Property 60 60 #define TreePropertyList typename TreeBuilder::PropertyList 61 62 COMPILE_ASSERT(LastUntaggedToken < 64, LessThan64UntaggedTokens); 61 63 62 64 // This matches v8 … … 161 163 enum FunctionRequirements { FunctionNoRequirements, FunctionNeedsName }; 162 164 template <FunctionRequirements, class TreeBuilder> bool parseFunctionInfo(TreeBuilder&, const Identifier*&, TreeFormalParameterList&, TreeFunctionBody&, int& openBrace, int& closeBrace, int& bodyStartLine); 163 int isBinaryOperator(JSTokenType token);165 ALWAYS_INLINE int isBinaryOperator(JSTokenType token); 164 166 bool allowAutomaticSemicolon(); 165 167 … … 1030 1032 } 1031 1033 1032 static bool isUnaryOp(JSTokenType token) 1033 { 1034 switch (token) { 1035 case EXCLAMATION: 1036 case TILDE: 1037 case MINUS: 1038 case PLUS: 1039 case PLUSPLUS: 1040 case AUTOPLUSPLUS: 1041 case MINUSMINUS: 1042 case AUTOMINUSMINUS: 1043 case TYPEOF: 1044 case VOIDTOKEN: 1045 case DELETETOKEN: 1046 return true; 1047 default: 1048 return false; 1049 } 1034 ALWAYS_INLINE static bool isUnaryOp(JSTokenType token) 1035 { 1036 return token & UnaryOpTokenFlag; 1050 1037 } 1051 1038 1052 1039 int JSParser::isBinaryOperator(JSTokenType token) 1053 1040 { 1054 switch (token) { 1055 case OR: 1056 return 1; 1057 1058 case AND: 1059 return 2; 1060 1061 case BITOR: 1062 return 3; 1063 1064 case BITXOR: 1065 return 4; 1066 1067 case BITAND: 1068 return 5; 1069 1070 case EQEQ: 1071 case NE: 1072 case STREQ: 1073 case STRNEQ: 1074 return 6; 1075 1076 case LT: 1077 case GT: 1078 case LE: 1079 case GE: 1080 case INSTANCEOF: 1081 return 7; 1082 1083 case INTOKEN: 1084 // same precedence as the above but needs a validity check 1085 if (m_allowsIn) 1086 return 7; 1087 return 0; 1088 1089 case LSHIFT: 1090 case RSHIFT: 1091 case URSHIFT: 1092 return 8; 1093 1094 case PLUS: 1095 case MINUS: 1096 return 9; 1097 1098 case TIMES: 1099 case DIVIDE: 1100 case MOD: 1101 return 10; 1102 1103 default: 1104 return 0; 1105 } 1041 if (m_allowsIn) 1042 return token & (BinaryOpTokenPrecedenceMask << BinaryOpTokenAllowsInPrecedenceAdditionalShift); 1043 return token & BinaryOpTokenPrecedenceMask; 1106 1044 } 1107 1045
Note:
See TracChangeset
for help on using the changeset viewer.