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 #include "src/parser.h" | 5 #include "src/parser.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/ast-literal-reindexer.h" | 9 #include "src/ast-literal-reindexer.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 DCHECK(!info->script().is_null() || info->source_stream() != NULL); | 915 DCHECK(!info->script().is_null() || info->source_stream() != NULL); |
916 set_allow_lazy(info->allow_lazy_parsing()); | 916 set_allow_lazy(info->allow_lazy_parsing()); |
917 set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); | 917 set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); |
918 set_allow_harmony_sloppy(FLAG_harmony_sloppy); | 918 set_allow_harmony_sloppy(FLAG_harmony_sloppy); |
919 set_allow_harmony_sloppy_function(FLAG_harmony_sloppy_function); | 919 set_allow_harmony_sloppy_function(FLAG_harmony_sloppy_function); |
920 set_allow_harmony_sloppy_let(FLAG_harmony_sloppy_let); | 920 set_allow_harmony_sloppy_let(FLAG_harmony_sloppy_let); |
921 set_allow_harmony_rest_parameters(FLAG_harmony_rest_parameters); | 921 set_allow_harmony_rest_parameters(FLAG_harmony_rest_parameters); |
922 set_allow_harmony_default_parameters(FLAG_harmony_default_parameters); | 922 set_allow_harmony_default_parameters(FLAG_harmony_default_parameters); |
923 set_allow_harmony_spread_calls(FLAG_harmony_spread_calls); | 923 set_allow_harmony_spread_calls(FLAG_harmony_spread_calls); |
924 set_allow_harmony_destructuring(FLAG_harmony_destructuring); | 924 set_allow_harmony_destructuring(FLAG_harmony_destructuring); |
| 925 set_allow_harmony_destructuring_assignment( |
| 926 FLAG_harmony_destructuring_assignment); |
925 set_allow_harmony_spread_arrays(FLAG_harmony_spread_arrays); | 927 set_allow_harmony_spread_arrays(FLAG_harmony_spread_arrays); |
926 set_allow_harmony_new_target(FLAG_harmony_new_target); | 928 set_allow_harmony_new_target(FLAG_harmony_new_target); |
927 set_allow_strong_mode(FLAG_strong_mode); | 929 set_allow_strong_mode(FLAG_strong_mode); |
928 set_allow_legacy_const(FLAG_legacy_const); | 930 set_allow_legacy_const(FLAG_legacy_const); |
929 set_allow_harmony_do_expressions(FLAG_harmony_do_expressions); | 931 set_allow_harmony_do_expressions(FLAG_harmony_do_expressions); |
930 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; | 932 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; |
931 ++feature) { | 933 ++feature) { |
932 use_counts_[feature] = 0; | 934 use_counts_[feature] = 0; |
933 } | 935 } |
934 if (info->ast_value_factory() == NULL) { | 936 if (info->ast_value_factory() == NULL) { |
(...skipping 2414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3349 assign_iterator, | 3351 assign_iterator, |
3350 next_result, | 3352 next_result, |
3351 result_done, | 3353 result_done, |
3352 assign_each); | 3354 assign_each); |
3353 } else { | 3355 } else { |
3354 stmt->Initialize(each, subject, body); | 3356 stmt->Initialize(each, subject, body); |
3355 } | 3357 } |
3356 } | 3358 } |
3357 | 3359 |
3358 | 3360 |
| 3361 Expression* Parser::RewriteDestructuringAssignmentExpression( |
| 3362 Expression* expression) { |
| 3363 return expression; |
| 3364 } |
| 3365 |
| 3366 |
3359 Statement* Parser::DesugarLexicalBindingsInForStatement( | 3367 Statement* Parser::DesugarLexicalBindingsInForStatement( |
3360 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, | 3368 Scope* inner_scope, bool is_const, ZoneList<const AstRawString*>* names, |
3361 ForStatement* loop, Statement* init, Expression* cond, Statement* next, | 3369 ForStatement* loop, Statement* init, Expression* cond, Statement* next, |
3362 Statement* body, bool* ok) { | 3370 Statement* body, bool* ok) { |
3363 // ES6 13.7.4.8 specifies that on each loop iteration the let variables are | 3371 // ES6 13.7.4.8 specifies that on each loop iteration the let variables are |
3364 // copied into a new environment. Moreover, the "next" statement must be | 3372 // copied into a new environment. Moreover, the "next" statement must be |
3365 // evaluated not in the environment of the just completed iteration but in | 3373 // evaluated not in the environment of the just completed iteration but in |
3366 // that of the upcoming one. We achieve this with the following desugaring. | 3374 // that of the upcoming one. We achieve this with the following desugaring. |
3367 // Extra care is needed to preserve the completion value of the original loop. | 3375 // Extra care is needed to preserve the completion value of the original loop. |
3368 // | 3376 // |
(...skipping 3018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6387 | 6395 |
6388 Expression* Parser::SpreadCallNew(Expression* function, | 6396 Expression* Parser::SpreadCallNew(Expression* function, |
6389 ZoneList<v8::internal::Expression*>* args, | 6397 ZoneList<v8::internal::Expression*>* args, |
6390 int pos) { | 6398 int pos) { |
6391 args->InsertAt(0, function, zone()); | 6399 args->InsertAt(0, function, zone()); |
6392 | 6400 |
6393 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); | 6401 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); |
6394 } | 6402 } |
6395 } // namespace internal | 6403 } // namespace internal |
6396 } // namespace v8 | 6404 } // namespace v8 |
OLD | NEW |