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_PARSER_H_ | 5 #ifndef V8_PARSER_H_ |
6 #define V8_PARSER_H_ | 6 #define V8_PARSER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/compiler.h" // TODO(titzer): remove this include dependency | 10 #include "src/compiler.h" // TODO(titzer): remove this include dependency |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 V8_INLINE void AddTemplateSpan(TemplateLiteralState* state, bool tail); | 804 V8_INLINE void AddTemplateSpan(TemplateLiteralState* state, bool tail); |
805 V8_INLINE void AddTemplateExpression(TemplateLiteralState* state, | 805 V8_INLINE void AddTemplateExpression(TemplateLiteralState* state, |
806 Expression* expression); | 806 Expression* expression); |
807 V8_INLINE Expression* CloseTemplateLiteral(TemplateLiteralState* state, | 807 V8_INLINE Expression* CloseTemplateLiteral(TemplateLiteralState* state, |
808 int start, Expression* tag); | 808 int start, Expression* tag); |
809 V8_INLINE Expression* NoTemplateTag() { return NULL; } | 809 V8_INLINE Expression* NoTemplateTag() { return NULL; } |
810 V8_INLINE static bool IsTaggedTemplate(const Expression* tag) { | 810 V8_INLINE static bool IsTaggedTemplate(const Expression* tag) { |
811 return tag != NULL; | 811 return tag != NULL; |
812 } | 812 } |
813 | 813 |
| 814 V8_INLINE ZoneList<v8::internal::Expression*>* PrepareSpreadArguments( |
| 815 ZoneList<v8::internal::Expression*>* list); |
| 816 V8_INLINE void MaterializeUnspreadArgumentsLiterals(int count) {} |
| 817 V8_INLINE Expression* SpreadCall(Expression* function, |
| 818 ZoneList<v8::internal::Expression*>* args, |
| 819 int pos); |
| 820 V8_INLINE Expression* SpreadCallNew(Expression* function, |
| 821 ZoneList<v8::internal::Expression*>* args, |
| 822 int pos); |
| 823 |
814 private: | 824 private: |
815 Parser* parser_; | 825 Parser* parser_; |
816 }; | 826 }; |
817 | 827 |
818 | 828 |
819 class Parser : public ParserBase<ParserTraits> { | 829 class Parser : public ParserBase<ParserTraits> { |
820 public: | 830 public: |
821 explicit Parser(ParseInfo* info); | 831 explicit Parser(ParseInfo* info); |
822 ~Parser() { | 832 ~Parser() { |
823 delete reusable_preparser_; | 833 delete reusable_preparser_; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 void ThrowPendingError(Isolate* isolate, Handle<Script> script); | 1020 void ThrowPendingError(Isolate* isolate, Handle<Script> script); |
1011 | 1021 |
1012 TemplateLiteralState OpenTemplateLiteral(int pos); | 1022 TemplateLiteralState OpenTemplateLiteral(int pos); |
1013 void AddTemplateSpan(TemplateLiteralState* state, bool tail); | 1023 void AddTemplateSpan(TemplateLiteralState* state, bool tail); |
1014 void AddTemplateExpression(TemplateLiteralState* state, | 1024 void AddTemplateExpression(TemplateLiteralState* state, |
1015 Expression* expression); | 1025 Expression* expression); |
1016 Expression* CloseTemplateLiteral(TemplateLiteralState* state, int start, | 1026 Expression* CloseTemplateLiteral(TemplateLiteralState* state, int start, |
1017 Expression* tag); | 1027 Expression* tag); |
1018 uint32_t ComputeTemplateLiteralHash(const TemplateLiteral* lit); | 1028 uint32_t ComputeTemplateLiteralHash(const TemplateLiteral* lit); |
1019 | 1029 |
| 1030 ZoneList<v8::internal::Expression*>* PrepareSpreadArguments( |
| 1031 ZoneList<v8::internal::Expression*>* list); |
| 1032 Expression* SpreadCall(Expression* function, |
| 1033 ZoneList<v8::internal::Expression*>* args, int pos); |
| 1034 Expression* SpreadCallNew(Expression* function, |
| 1035 ZoneList<v8::internal::Expression*>* args, int pos); |
| 1036 |
1020 Scanner scanner_; | 1037 Scanner scanner_; |
1021 PreParser* reusable_preparser_; | 1038 PreParser* reusable_preparser_; |
1022 Scope* original_scope_; // for ES5 function declarations in sloppy eval | 1039 Scope* original_scope_; // for ES5 function declarations in sloppy eval |
1023 Target* target_stack_; // for break, continue statements | 1040 Target* target_stack_; // for break, continue statements |
1024 ScriptCompiler::CompileOptions compile_options_; | 1041 ScriptCompiler::CompileOptions compile_options_; |
1025 ParseData* cached_parse_data_; | 1042 ParseData* cached_parse_data_; |
1026 | 1043 |
1027 bool parsing_lazy_arrow_parameters_; // for lazily parsed arrow functions. | 1044 bool parsing_lazy_arrow_parameters_; // for lazily parsed arrow functions. |
1028 | 1045 |
1029 PendingCompilationErrorHandler pending_error_handler_; | 1046 PendingCompilationErrorHandler pending_error_handler_; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 void ParserTraits::AddTemplateExpression(TemplateLiteralState* state, | 1136 void ParserTraits::AddTemplateExpression(TemplateLiteralState* state, |
1120 Expression* expression) { | 1137 Expression* expression) { |
1121 parser_->AddTemplateExpression(state, expression); | 1138 parser_->AddTemplateExpression(state, expression); |
1122 } | 1139 } |
1123 | 1140 |
1124 | 1141 |
1125 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, | 1142 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, |
1126 int start, Expression* tag) { | 1143 int start, Expression* tag) { |
1127 return parser_->CloseTemplateLiteral(state, start, tag); | 1144 return parser_->CloseTemplateLiteral(state, start, tag); |
1128 } | 1145 } |
| 1146 |
| 1147 |
| 1148 ZoneList<v8::internal::Expression*>* ParserTraits::PrepareSpreadArguments( |
| 1149 ZoneList<v8::internal::Expression*>* list) { |
| 1150 return parser_->PrepareSpreadArguments(list); |
| 1151 } |
| 1152 |
| 1153 |
| 1154 Expression* ParserTraits::SpreadCall(Expression* function, |
| 1155 ZoneList<v8::internal::Expression*>* args, |
| 1156 int pos) { |
| 1157 return parser_->SpreadCall(function, args, pos); |
| 1158 } |
| 1159 |
| 1160 |
| 1161 Expression* ParserTraits::SpreadCallNew( |
| 1162 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { |
| 1163 return parser_->SpreadCallNew(function, args, pos); |
| 1164 } |
1129 } } // namespace v8::internal | 1165 } } // namespace v8::internal |
1130 | 1166 |
1131 #endif // V8_PARSER_H_ | 1167 #endif // V8_PARSER_H_ |
OLD | NEW |