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

Unified Diff: runtime/vm/parser.cc

Issue 1544703002: Ignore constructor phase parameter (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index c72dcbc58b4f17b943c51ad01186b7259307d55f..15652f065179bea2c29211722b85131919a5af5c 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -3129,7 +3129,10 @@ SequenceNode* Parser::ParseConstructor(const Function& func) {
}
SequenceNode* init_statements = CloseBlock();
- if (is_redirecting_constructor) {
+ if (FLAG_move_super) {
+ // Ignore the phase parameter.
+ current_block_->statements->Add(init_statements);
+ } else if (is_redirecting_constructor) {
// A redirecting super constructor simply passes the phase parameter on to
// the target which executes the corresponding phase.
current_block_->statements->Add(init_statements);
@@ -3276,24 +3279,29 @@ SequenceNode* Parser::ParseConstructor(const Function& func) {
SequenceNode* ctor_block = CloseBlock();
if (ctor_block->length() > 0) {
- // Generate guard around the constructor body code.
- LocalVariable* phase_param = LookupPhaseParameter();
- AstNode* phase_value =
- new LoadLocalNode(Scanner::kNoSourcePos, phase_param);
- AstNode* phase_check =
- new BinaryOpNode(Scanner::kNoSourcePos, Token::kBIT_AND,
- phase_value,
- new LiteralNode(Scanner::kNoSourcePos,
- Smi::ZoneHandle(Smi::New(Function::kCtorPhaseBody))));
- AstNode* comparison =
- new ComparisonNode(Scanner::kNoSourcePos,
- Token::kNE_STRICT,
- phase_check,
- new LiteralNode(body_pos,
- Smi::ZoneHandle(Smi::New(0))));
- AstNode* guarded_block_statements =
- new IfNode(Scanner::kNoSourcePos, comparison, ctor_block, NULL);
- current_block_->statements->Add(guarded_block_statements);
+ if (FLAG_move_super) {
+ // Ignore the phase parameter.
+ current_block_->statements->Add(ctor_block);
+ } else {
+ // Generate guard around the constructor body code.
+ LocalVariable* phase_param = LookupPhaseParameter();
+ AstNode* phase_value =
+ new LoadLocalNode(Scanner::kNoSourcePos, phase_param);
+ AstNode* phase_check =
+ new BinaryOpNode(Scanner::kNoSourcePos, Token::kBIT_AND,
+ phase_value,
+ new LiteralNode(Scanner::kNoSourcePos,
+ Smi::ZoneHandle(Smi::New(Function::kCtorPhaseBody))));
+ AstNode* comparison =
+ new ComparisonNode(Scanner::kNoSourcePos,
+ Token::kNE_STRICT,
+ phase_check,
+ new LiteralNode(body_pos,
+ Smi::ZoneHandle(Smi::New(0))));
+ AstNode* guarded_block_statements =
+ new IfNode(Scanner::kNoSourcePos, comparison, ctor_block, NULL);
+ current_block_->statements->Add(guarded_block_statements);
+ }
}
current_block_->statements->Add(new ReturnNode(func.end_token_pos()));
SequenceNode* statements = CloseBlock();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698