| 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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 struct ParserFormalParameters : FormalParametersBase { | 539 struct ParserFormalParameters : FormalParametersBase { |
| 540 struct Parameter { | 540 struct Parameter { |
| 541 Parameter(const AstRawString* name, Expression* pattern, | 541 Parameter(const AstRawString* name, Expression* pattern, |
| 542 Expression* initializer, bool is_rest) | 542 Expression* initializer, bool is_rest) |
| 543 : name(name), pattern(pattern), initializer(initializer), | 543 : name(name), pattern(pattern), initializer(initializer), |
| 544 is_rest(is_rest) {} | 544 is_rest(is_rest) {} |
| 545 const AstRawString* name; | 545 const AstRawString* name; |
| 546 Expression* pattern; | 546 Expression* pattern; |
| 547 Expression* initializer; | 547 Expression* initializer; |
| 548 bool is_rest; | 548 bool is_rest; |
| 549 bool is_simple() const { |
| 550 return pattern->IsVariableProxy() && initializer == nullptr && !is_rest; |
| 551 } |
| 549 }; | 552 }; |
| 550 | 553 |
| 551 explicit ParserFormalParameters(Scope* scope) | 554 explicit ParserFormalParameters(Scope* scope) |
| 552 : FormalParametersBase(scope), params(4, scope->zone()) {} | 555 : FormalParametersBase(scope), params(4, scope->zone()) {} |
| 553 ZoneList<Parameter> params; | 556 ZoneList<Parameter> params; |
| 554 | 557 |
| 555 int Arity() const { return params.length(); } | 558 int Arity() const { return params.length(); } |
| 556 const Parameter& at(int i) const { return params[i]; } | 559 const Parameter& at(int i) const { return params[i]; } |
| 557 }; | 560 }; |
| 558 | 561 |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 parser_->BuildParameterInitializationBlock(parameters, ok); | 1364 parser_->BuildParameterInitializationBlock(parameters, ok); |
| 1362 if (!*ok) return; | 1365 if (!*ok) return; |
| 1363 if (init_block != nullptr) { | 1366 if (init_block != nullptr) { |
| 1364 body->Add(init_block, parser_->zone()); | 1367 body->Add(init_block, parser_->zone()); |
| 1365 } | 1368 } |
| 1366 } | 1369 } |
| 1367 } | 1370 } |
| 1368 } } // namespace v8::internal | 1371 } } // namespace v8::internal |
| 1369 | 1372 |
| 1370 #endif // V8_PARSER_H_ | 1373 #endif // V8_PARSER_H_ |
| OLD | NEW |