OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_PARSING_PARSER_H_ | 5 #ifndef V8_PARSING_PARSER_H_ |
6 #define V8_PARSING_PARSER_H_ | 6 #define V8_PARSING_PARSER_H_ |
7 | 7 |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/base/compiler-specific.h" | 10 #include "src/base/compiler-specific.h" |
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1117 } | 1117 } |
1118 | 1118 |
1119 V8_INLINE ZoneList<Expression*>* GetNonPatternList() const { | 1119 V8_INLINE ZoneList<Expression*>* GetNonPatternList() const { |
1120 return function_state_->non_patterns_to_rewrite(); | 1120 return function_state_->non_patterns_to_rewrite(); |
1121 } | 1121 } |
1122 | 1122 |
1123 V8_INLINE void CountUsage(v8::Isolate::UseCounterFeature feature) { | 1123 V8_INLINE void CountUsage(v8::Isolate::UseCounterFeature feature) { |
1124 ++use_counts_[feature]; | 1124 ++use_counts_[feature]; |
1125 } | 1125 } |
1126 | 1126 |
1127 // Returns true iff we're parsing the first function literal during | |
1128 // CreateDynamicFunction(). | |
1129 V8_INLINE bool IgnoreFunctionName() const { | |
Dan Ehrenberg
2016/12/06 00:32:13
Naming nit: How about something that's more about
jwolfe
2017/01/13 00:28:48
How about ParsingDynamicFunctionDeclaration? The s
| |
1130 return parameters_end_pos_ != kNoSourcePosition; | |
1131 } | |
1132 | |
1127 // Parser's private field members. | 1133 // Parser's private field members. |
1128 friend class DiscardableZoneScope; // Uses reusable_preparser_. | 1134 friend class DiscardableZoneScope; // Uses reusable_preparser_. |
1129 // FIXME(marja): Make reusable_preparser_ always use its own temp Zone (call | 1135 // FIXME(marja): Make reusable_preparser_ always use its own temp Zone (call |
1130 // DeleteAll after each function), so this won't be needed. | 1136 // DeleteAll after each function), so this won't be needed. |
1131 | 1137 |
1132 Scanner scanner_; | 1138 Scanner scanner_; |
1133 PreParser* reusable_preparser_; | 1139 PreParser* reusable_preparser_; |
1134 Scope* original_scope_; // for ES5 function declarations in sloppy eval | 1140 Scope* original_scope_; // for ES5 function declarations in sloppy eval |
1135 Mode mode_; | 1141 Mode mode_; |
1136 | 1142 |
1137 friend class ParserTarget; | 1143 friend class ParserTarget; |
1138 friend class ParserTargetScope; | 1144 friend class ParserTargetScope; |
1139 ParserTarget* target_stack_; // for break, continue statements | 1145 ParserTarget* target_stack_; // for break, continue statements |
1140 | 1146 |
1141 ScriptCompiler::CompileOptions compile_options_; | 1147 ScriptCompiler::CompileOptions compile_options_; |
1142 ParseData* cached_parse_data_; | 1148 ParseData* cached_parse_data_; |
1143 | 1149 |
1144 PendingCompilationErrorHandler pending_error_handler_; | 1150 PendingCompilationErrorHandler pending_error_handler_; |
1145 | 1151 |
1146 // Other information which will be stored in Parser and moved to Isolate after | 1152 // Other information which will be stored in Parser and moved to Isolate after |
1147 // parsing. | 1153 // parsing. |
1148 int use_counts_[v8::Isolate::kUseCounterFeatureCount]; | 1154 int use_counts_[v8::Isolate::kUseCounterFeatureCount]; |
1149 int total_preparse_skipped_; | 1155 int total_preparse_skipped_; |
1150 bool allow_lazy_; | 1156 bool allow_lazy_; |
1151 bool temp_zoned_; | 1157 bool temp_zoned_; |
1152 ParserLogger* log_; | 1158 ParserLogger* log_; |
1159 | |
1160 // If not kNoSourcePosition, indicates that the first function literal | |
1161 // encountered is a dynamic function, see CreateDynamicFunction(). This field | |
1162 // indicates the correct position of the ')' that closes the parameter list. | |
1163 // After that ')' is encountered, this field is reset to kNoSourcePosition. | |
1164 int parameters_end_pos_; | |
1153 }; | 1165 }; |
1154 | 1166 |
1155 // ---------------------------------------------------------------------------- | 1167 // ---------------------------------------------------------------------------- |
1156 // Target is a support class to facilitate manipulation of the | 1168 // Target is a support class to facilitate manipulation of the |
1157 // Parser's target_stack_ (the stack of potential 'break' and | 1169 // Parser's target_stack_ (the stack of potential 'break' and |
1158 // 'continue' statement targets). Upon construction, a new target is | 1170 // 'continue' statement targets). Upon construction, a new target is |
1159 // added; it is removed upon destruction. | 1171 // added; it is removed upon destruction. |
1160 | 1172 |
1161 class ParserTarget BASE_EMBEDDED { | 1173 class ParserTarget BASE_EMBEDDED { |
1162 public: | 1174 public: |
(...skipping 27 matching lines...) Expand all Loading... | |
1190 | 1202 |
1191 private: | 1203 private: |
1192 ParserTarget** variable_; | 1204 ParserTarget** variable_; |
1193 ParserTarget* previous_; | 1205 ParserTarget* previous_; |
1194 }; | 1206 }; |
1195 | 1207 |
1196 } // namespace internal | 1208 } // namespace internal |
1197 } // namespace v8 | 1209 } // namespace v8 |
1198 | 1210 |
1199 #endif // V8_PARSING_PARSER_H_ | 1211 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |