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

Side by Side Diff: src/parsing/parser-base.h

Issue 1819123002: Remove support for legacy const, part 1 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased, deleted one more file Created 4 years, 9 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
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef V8_PARSING_PARSER_BASE_H 5 #ifndef V8_PARSING_PARSER_BASE_H
6 #define V8_PARSING_PARSER_BASE_H 6 #define V8_PARSING_PARSER_BASE_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/hashmap.h" 10 #include "src/hashmap.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 zone_(zone), 106 zone_(zone),
107 scanner_(scanner), 107 scanner_(scanner),
108 stack_overflow_(false), 108 stack_overflow_(false),
109 allow_lazy_(false), 109 allow_lazy_(false),
110 allow_natives_(false), 110 allow_natives_(false),
111 allow_tailcalls_(false), 111 allow_tailcalls_(false),
112 allow_harmony_sloppy_(false), 112 allow_harmony_sloppy_(false),
113 allow_harmony_sloppy_function_(false), 113 allow_harmony_sloppy_function_(false),
114 allow_harmony_sloppy_let_(false), 114 allow_harmony_sloppy_let_(false),
115 allow_harmony_restrictive_declarations_(false), 115 allow_harmony_restrictive_declarations_(false),
116 allow_legacy_const_(true),
117 allow_harmony_do_expressions_(false), 116 allow_harmony_do_expressions_(false),
118 allow_harmony_function_name_(false), 117 allow_harmony_function_name_(false),
119 allow_harmony_function_sent_(false) {} 118 allow_harmony_function_sent_(false) {}
120 119
121 #define ALLOW_ACCESSORS(name) \ 120 #define ALLOW_ACCESSORS(name) \
122 bool allow_##name() const { return allow_##name##_; } \ 121 bool allow_##name() const { return allow_##name##_; } \
123 void set_allow_##name(bool allow) { allow_##name##_ = allow; } 122 void set_allow_##name(bool allow) { allow_##name##_ = allow; }
124 123
125 #define SCANNER_ACCESSORS(name) \ 124 #define SCANNER_ACCESSORS(name) \
126 bool allow_##name() const { return scanner_->allow_##name(); } \ 125 bool allow_##name() const { return scanner_->allow_##name(); } \
127 void set_allow_##name(bool allow) { \ 126 void set_allow_##name(bool allow) { \
128 return scanner_->set_allow_##name(allow); \ 127 return scanner_->set_allow_##name(allow); \
129 } 128 }
130 129
131 ALLOW_ACCESSORS(lazy); 130 ALLOW_ACCESSORS(lazy);
132 ALLOW_ACCESSORS(natives); 131 ALLOW_ACCESSORS(natives);
133 ALLOW_ACCESSORS(tailcalls); 132 ALLOW_ACCESSORS(tailcalls);
134 ALLOW_ACCESSORS(harmony_sloppy); 133 ALLOW_ACCESSORS(harmony_sloppy);
135 ALLOW_ACCESSORS(harmony_sloppy_function); 134 ALLOW_ACCESSORS(harmony_sloppy_function);
136 ALLOW_ACCESSORS(harmony_sloppy_let); 135 ALLOW_ACCESSORS(harmony_sloppy_let);
137 ALLOW_ACCESSORS(harmony_restrictive_declarations); 136 ALLOW_ACCESSORS(harmony_restrictive_declarations);
138 ALLOW_ACCESSORS(legacy_const);
139 ALLOW_ACCESSORS(harmony_do_expressions); 137 ALLOW_ACCESSORS(harmony_do_expressions);
140 ALLOW_ACCESSORS(harmony_function_name); 138 ALLOW_ACCESSORS(harmony_function_name);
141 ALLOW_ACCESSORS(harmony_function_sent); 139 ALLOW_ACCESSORS(harmony_function_sent);
142 SCANNER_ACCESSORS(harmony_exponentiation_operator); 140 SCANNER_ACCESSORS(harmony_exponentiation_operator);
143 141
144 #undef SCANNER_ACCESSORS 142 #undef SCANNER_ACCESSORS
145 #undef ALLOW_ACCESSORS 143 #undef ALLOW_ACCESSORS
146 144
147 uintptr_t stack_limit() const { return stack_limit_; } 145 uintptr_t stack_limit() const { return stack_limit_; }
148 146
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 } 554 }
557 555
558 typename Traits::Type::Factory* factory() { 556 typename Traits::Type::Factory* factory() {
559 return function_state_->factory(); 557 return function_state_->factory();
560 } 558 }
561 559
562 LanguageMode language_mode() { return scope_->language_mode(); } 560 LanguageMode language_mode() { return scope_->language_mode(); }
563 bool is_generator() const { return function_state_->is_generator(); } 561 bool is_generator() const { return function_state_->is_generator(); }
564 562
565 bool allow_const() { 563 bool allow_const() {
566 return is_strict(language_mode()) || allow_harmony_sloppy() || 564 return is_strict(language_mode()) || allow_harmony_sloppy();
567 allow_legacy_const();
568 } 565 }
569 566
570 bool allow_let() { 567 bool allow_let() {
571 return is_strict(language_mode()) || allow_harmony_sloppy_let(); 568 return is_strict(language_mode()) || allow_harmony_sloppy_let();
572 } 569 }
573 570
574 // Report syntax errors. 571 // Report syntax errors.
575 void ReportMessage(MessageTemplate::Template message, const char* arg = NULL, 572 void ReportMessage(MessageTemplate::Template message, const char* arg = NULL,
576 ParseErrorType error_type = kSyntaxError) { 573 ParseErrorType error_type = kSyntaxError) {
577 Scanner::Location source_location = scanner()->location(); 574 Scanner::Location source_location = scanner()->location();
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 Scanner* scanner_; 919 Scanner* scanner_;
923 bool stack_overflow_; 920 bool stack_overflow_;
924 921
925 bool allow_lazy_; 922 bool allow_lazy_;
926 bool allow_natives_; 923 bool allow_natives_;
927 bool allow_tailcalls_; 924 bool allow_tailcalls_;
928 bool allow_harmony_sloppy_; 925 bool allow_harmony_sloppy_;
929 bool allow_harmony_sloppy_function_; 926 bool allow_harmony_sloppy_function_;
930 bool allow_harmony_sloppy_let_; 927 bool allow_harmony_sloppy_let_;
931 bool allow_harmony_restrictive_declarations_; 928 bool allow_harmony_restrictive_declarations_;
932 bool allow_legacy_const_;
933 bool allow_harmony_do_expressions_; 929 bool allow_harmony_do_expressions_;
934 bool allow_harmony_function_name_; 930 bool allow_harmony_function_name_;
935 bool allow_harmony_function_sent_; 931 bool allow_harmony_function_sent_;
936 }; 932 };
937 933
938 template <class Traits> 934 template <class Traits>
939 ParserBase<Traits>::FunctionState::FunctionState( 935 ParserBase<Traits>::FunctionState::FunctionState(
940 FunctionState** function_state_stack, Scope** scope_stack, Scope* scope, 936 FunctionState** function_state_stack, Scope** scope_stack, Scope* scope,
941 FunctionKind kind, typename Traits::Type::Factory* factory) 937 FunctionKind kind, typename Traits::Type::Factory* factory)
942 : next_materialized_literal_index_(0), 938 : next_materialized_literal_index_(0),
(...skipping 2180 matching lines...) Expand 10 before | Expand all | Expand 10 after
3123 has_seen_constructor_ = true; 3119 has_seen_constructor_ = true;
3124 return; 3120 return;
3125 } 3121 }
3126 } 3122 }
3127 3123
3128 3124
3129 } // namespace internal 3125 } // namespace internal
3130 } // namespace v8 3126 } // namespace v8
3131 3127
3132 #endif // V8_PARSING_PARSER_BASE_H 3128 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698