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

Side by Side Diff: src/parser.h

Issue 1292753007: [es6] Parameter scopes for sloppy eval (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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 #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 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 Block* ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok); 970 Block* ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok);
971 Block* ParseVariableStatement(VariableDeclarationContext var_context, 971 Block* ParseVariableStatement(VariableDeclarationContext var_context,
972 ZoneList<const AstRawString*>* names, 972 ZoneList<const AstRawString*>* names,
973 bool* ok); 973 bool* ok);
974 974
975 struct DeclarationDescriptor { 975 struct DeclarationDescriptor {
976 enum Kind { NORMAL, PARAMETER }; 976 enum Kind { NORMAL, PARAMETER };
977 Parser* parser; 977 Parser* parser;
978 Scope* declaration_scope; 978 Scope* declaration_scope;
979 Scope* scope; 979 Scope* scope;
980 Scope* hoist_scope;
980 VariableMode mode; 981 VariableMode mode;
981 bool is_const; 982 bool is_const;
982 bool needs_init; 983 bool needs_init;
983 int declaration_pos; 984 int declaration_pos;
984 int initialization_pos; 985 int initialization_pos;
985 Token::Value init_op; 986 Token::Value init_op;
986 Kind declaration_kind; 987 Kind declaration_kind;
987 }; 988 };
988 989
989 struct DeclarationParsingResult { 990 struct DeclarationParsingResult {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 // 1131 //
1131 // The var declarations are hoisted to the function scope, but originate from 1132 // The var declarations are hoisted to the function scope, but originate from
1132 // a scope where the name has also been let bound or the var declaration is 1133 // a scope where the name has also been let bound or the var declaration is
1133 // hoisted over such a scope. 1134 // hoisted over such a scope.
1134 void CheckConflictingVarDeclarations(Scope* scope, bool* ok); 1135 void CheckConflictingVarDeclarations(Scope* scope, bool* ok);
1135 1136
1136 // Parser support 1137 // Parser support
1137 VariableProxy* NewUnresolved(const AstRawString* name, VariableMode mode); 1138 VariableProxy* NewUnresolved(const AstRawString* name, VariableMode mode);
1138 Variable* Declare(Declaration* declaration, 1139 Variable* Declare(Declaration* declaration,
1139 DeclarationDescriptor::Kind declaration_kind, bool resolve, 1140 DeclarationDescriptor::Kind declaration_kind, bool resolve,
1140 bool* ok); 1141 bool* ok, Scope* declaration_scope = nullptr);
1141 1142
1142 bool TargetStackContainsLabel(const AstRawString* label); 1143 bool TargetStackContainsLabel(const AstRawString* label);
1143 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok); 1144 BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok);
1144 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); 1145 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok);
1145 1146
1146 void AddAssertIsConstruct(ZoneList<Statement*>* body, int pos); 1147 void AddAssertIsConstruct(ZoneList<Statement*>* body, int pos);
1147 Statement* BuildAssertIsCoercible(Variable* var); 1148 Statement* BuildAssertIsCoercible(Variable* var);
1148 1149
1149 // Factory methods. 1150 // Factory methods.
1150 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, 1151 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos,
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 parser_->BuildParameterInitializationBlock(parameters, ok); 1364 parser_->BuildParameterInitializationBlock(parameters, ok);
1364 if (!*ok) return; 1365 if (!*ok) return;
1365 if (init_block != nullptr) { 1366 if (init_block != nullptr) {
1366 body->Add(init_block, parser_->zone()); 1367 body->Add(init_block, parser_->zone());
1367 } 1368 }
1368 } 1369 }
1369 } 1370 }
1370 } } // namespace v8::internal 1371 } } // namespace v8::internal
1371 1372
1372 #endif // V8_PARSER_H_ 1373 #endif // V8_PARSER_H_
OLDNEW
« src/contexts.cc ('K') | « src/objects-printer.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698