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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 void ThrowPendingError(Isolate* isolate, Handle<Script> script); | 1021 void ThrowPendingError(Isolate* isolate, Handle<Script> script); |
1012 | 1022 |
1013 TemplateLiteralState OpenTemplateLiteral(int pos); | 1023 TemplateLiteralState OpenTemplateLiteral(int pos); |
1014 void AddTemplateSpan(TemplateLiteralState* state, bool tail); | 1024 void AddTemplateSpan(TemplateLiteralState* state, bool tail); |
1015 void AddTemplateExpression(TemplateLiteralState* state, | 1025 void AddTemplateExpression(TemplateLiteralState* state, |
1016 Expression* expression); | 1026 Expression* expression); |
1017 Expression* CloseTemplateLiteral(TemplateLiteralState* state, int start, | 1027 Expression* CloseTemplateLiteral(TemplateLiteralState* state, int start, |
1018 Expression* tag); | 1028 Expression* tag); |
1019 uint32_t ComputeTemplateLiteralHash(const TemplateLiteral* lit); | 1029 uint32_t ComputeTemplateLiteralHash(const TemplateLiteral* lit); |
1020 | 1030 |
| 1031 ZoneList<v8::internal::Expression*>* PrepareSpreadArguments( |
| 1032 ZoneList<v8::internal::Expression*>* list); |
| 1033 Expression* SpreadCall(Expression* function, |
| 1034 ZoneList<v8::internal::Expression*>* args, int pos); |
| 1035 Expression* SpreadCallNew(Expression* function, |
| 1036 ZoneList<v8::internal::Expression*>* args, int pos); |
| 1037 |
1021 Scanner scanner_; | 1038 Scanner scanner_; |
1022 PreParser* reusable_preparser_; | 1039 PreParser* reusable_preparser_; |
1023 Scope* original_scope_; // for ES5 function declarations in sloppy eval | 1040 Scope* original_scope_; // for ES5 function declarations in sloppy eval |
1024 Target* target_stack_; // for break, continue statements | 1041 Target* target_stack_; // for break, continue statements |
1025 ScriptCompiler::CompileOptions compile_options_; | 1042 ScriptCompiler::CompileOptions compile_options_; |
1026 ParseData* cached_parse_data_; | 1043 ParseData* cached_parse_data_; |
1027 | 1044 |
1028 bool parsing_lazy_arrow_parameters_; // for lazily parsed arrow functions. | 1045 bool parsing_lazy_arrow_parameters_; // for lazily parsed arrow functions. |
1029 | 1046 |
1030 PendingCompilationErrorHandler pending_error_handler_; | 1047 PendingCompilationErrorHandler pending_error_handler_; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 void ParserTraits::AddTemplateExpression(TemplateLiteralState* state, | 1137 void ParserTraits::AddTemplateExpression(TemplateLiteralState* state, |
1121 Expression* expression) { | 1138 Expression* expression) { |
1122 parser_->AddTemplateExpression(state, expression); | 1139 parser_->AddTemplateExpression(state, expression); |
1123 } | 1140 } |
1124 | 1141 |
1125 | 1142 |
1126 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, | 1143 Expression* ParserTraits::CloseTemplateLiteral(TemplateLiteralState* state, |
1127 int start, Expression* tag) { | 1144 int start, Expression* tag) { |
1128 return parser_->CloseTemplateLiteral(state, start, tag); | 1145 return parser_->CloseTemplateLiteral(state, start, tag); |
1129 } | 1146 } |
| 1147 |
| 1148 |
| 1149 ZoneList<v8::internal::Expression*>* ParserTraits::PrepareSpreadArguments( |
| 1150 ZoneList<v8::internal::Expression*>* list) { |
| 1151 return parser_->PrepareSpreadArguments(list); |
| 1152 } |
| 1153 |
| 1154 |
| 1155 Expression* ParserTraits::SpreadCall(Expression* function, |
| 1156 ZoneList<v8::internal::Expression*>* args, |
| 1157 int pos) { |
| 1158 return parser_->SpreadCall(function, args, pos); |
| 1159 } |
| 1160 |
| 1161 |
| 1162 Expression* ParserTraits::SpreadCallNew( |
| 1163 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { |
| 1164 return parser_->SpreadCallNew(function, args, pos); |
| 1165 } |
1130 } } // namespace v8::internal | 1166 } } // namespace v8::internal |
1131 | 1167 |
1132 #endif // V8_PARSER_H_ | 1168 #endif // V8_PARSER_H_ |
OLD | NEW |