Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(658)

Side by Side Diff: src/parsing/parser.cc

Issue 2094463002: Allow trailing commas in function parameter lists (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add tests with more than 1 parameter Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/parsing/parser.h" 5 #include "src/parsing/parser.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/ast-expression-rewriter.h" 9 #include "src/ast/ast-expression-rewriter.h"
10 #include "src/ast/ast-expression-visitor.h" 10 #include "src/ast/ast-expression-visitor.h"
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 set_allow_harmony_do_expressions(FLAG_harmony_do_expressions); 809 set_allow_harmony_do_expressions(FLAG_harmony_do_expressions);
810 set_allow_harmony_for_in(FLAG_harmony_for_in); 810 set_allow_harmony_for_in(FLAG_harmony_for_in);
811 set_allow_harmony_function_name(FLAG_harmony_function_name); 811 set_allow_harmony_function_name(FLAG_harmony_function_name);
812 set_allow_harmony_function_sent(FLAG_harmony_function_sent); 812 set_allow_harmony_function_sent(FLAG_harmony_function_sent);
813 set_allow_harmony_restrictive_declarations( 813 set_allow_harmony_restrictive_declarations(
814 FLAG_harmony_restrictive_declarations); 814 FLAG_harmony_restrictive_declarations);
815 set_allow_harmony_exponentiation_operator( 815 set_allow_harmony_exponentiation_operator(
816 FLAG_harmony_exponentiation_operator); 816 FLAG_harmony_exponentiation_operator);
817 set_allow_harmony_async_await(FLAG_harmony_async_await); 817 set_allow_harmony_async_await(FLAG_harmony_async_await);
818 set_allow_harmony_restrictive_generators(FLAG_harmony_restrictive_generators); 818 set_allow_harmony_restrictive_generators(FLAG_harmony_restrictive_generators);
819 set_allow_harmony_trailing_commas_in_parameters(
820 FLAG_harmony_trailing_commas_in_parameters);
819 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; 821 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount;
820 ++feature) { 822 ++feature) {
821 use_counts_[feature] = 0; 823 use_counts_[feature] = 0;
822 } 824 }
823 if (info->ast_value_factory() == NULL) { 825 if (info->ast_value_factory() == NULL) {
824 // info takes ownership of AstValueFactory. 826 // info takes ownership of AstValueFactory.
825 info->set_ast_value_factory(new AstValueFactory(zone(), info->hash_seed())); 827 info->set_ast_value_factory(new AstValueFactory(zone(), info->hash_seed()));
826 info->set_ast_value_factory_owned(); 828 info->set_ast_value_factory_owned();
827 ast_value_factory_ = info->ast_value_factory(); 829 ast_value_factory_ = info->ast_value_factory();
828 } 830 }
(...skipping 4038 matching lines...) Expand 10 before | Expand all | Expand 10 after
4867 reusable_preparser_->set_allow_lazy(true); 4869 reusable_preparser_->set_allow_lazy(true);
4868 #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); 4870 #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name());
4869 SET_ALLOW(natives); 4871 SET_ALLOW(natives);
4870 SET_ALLOW(harmony_do_expressions); 4872 SET_ALLOW(harmony_do_expressions);
4871 SET_ALLOW(harmony_for_in); 4873 SET_ALLOW(harmony_for_in);
4872 SET_ALLOW(harmony_function_name); 4874 SET_ALLOW(harmony_function_name);
4873 SET_ALLOW(harmony_function_sent); 4875 SET_ALLOW(harmony_function_sent);
4874 SET_ALLOW(harmony_exponentiation_operator); 4876 SET_ALLOW(harmony_exponentiation_operator);
4875 SET_ALLOW(harmony_restrictive_declarations); 4877 SET_ALLOW(harmony_restrictive_declarations);
4876 SET_ALLOW(harmony_async_await); 4878 SET_ALLOW(harmony_async_await);
4879 SET_ALLOW(harmony_trailing_commas_in_parameters);
4877 #undef SET_ALLOW 4880 #undef SET_ALLOW
4878 } 4881 }
4879 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction( 4882 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction(
4880 language_mode(), function_state_->kind(), scope_->has_simple_parameters(), 4883 language_mode(), function_state_->kind(), scope_->has_simple_parameters(),
4881 parsing_module_, logger, bookmark, use_counts_); 4884 parsing_module_, logger, bookmark, use_counts_);
4882 if (pre_parse_timer_ != NULL) { 4885 if (pre_parse_timer_ != NULL) {
4883 pre_parse_timer_->Stop(); 4886 pre_parse_timer_->Stop();
4884 } 4887 }
4885 return result; 4888 return result;
4886 } 4889 }
(...skipping 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after
6979 try_block, target); 6982 try_block, target);
6980 final_loop = target; 6983 final_loop = target;
6981 } 6984 }
6982 6985
6983 return final_loop; 6986 return final_loop;
6984 } 6987 }
6985 6988
6986 6989
6987 } // namespace internal 6990 } // namespace internal
6988 } // namespace v8 6991 } // namespace v8
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/parsing/parser-base.h » ('j') | src/parsing/parser-base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698