Index: runtime/vm/parser.cc |
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc |
index 6a89bd0eeffadb3e15b2cae7b8bfbf4ff4aeb173..ac2ea97c6ed63702ba22efb9669e8d2a413fe622 100644 |
--- a/runtime/vm/parser.cc |
+++ b/runtime/vm/parser.cc |
@@ -9175,21 +9175,13 @@ AstNode* Parser::MakeAssertCall(TokenPosition begin, TokenPosition end) { |
} |
-AstNode* Parser::InsertClosureCallNodes(AstNode* condition) { |
- if (condition->IsClosureNode() || |
- (condition->IsStoreLocalNode() && |
- condition->AsStoreLocalNode()->value()->IsClosureNode())) { |
- // Function literal in assert implies a call. |
- const TokenPosition pos = condition->token_pos(); |
- condition = BuildClosureCall(pos, |
- condition, |
- new(Z) ArgumentListNode(pos)); |
- } else if (condition->IsConditionalExprNode()) { |
- ConditionalExprNode* cond_expr = condition->AsConditionalExprNode(); |
- cond_expr->set_true_expr(InsertClosureCallNodes(cond_expr->true_expr())); |
- cond_expr->set_false_expr(InsertClosureCallNodes(cond_expr->false_expr())); |
- } |
- return condition; |
+AstNode* Parser::HandleAssertCondition(AstNode* condition) { |
+ const TokenPosition pos = condition->token_pos(); |
+ ArgumentListNode* arguments = new(Z) ArgumentListNode(pos); |
+ arguments->Add(condition); |
+ return MakeStaticCall(Symbols::AssertionError(), |
+ Library::PrivateCoreLibName(Symbols::HandleCondition()), |
+ arguments); |
} |
@@ -9206,7 +9198,7 @@ AstNode* Parser::ParseAssertStatement() { |
AstNode* condition = ParseAwaitableExpr(kAllowConst, kConsumeCascades, NULL); |
const TokenPosition condition_end = TokenPos(); |
ExpectToken(Token::kRPAREN); |
- condition = InsertClosureCallNodes(condition); |
+ condition = HandleAssertCondition(condition); |
condition = new(Z) UnaryOpNode(condition_pos, Token::kNOT, condition); |
AstNode* assert_throw = MakeAssertCall(condition_pos, condition_end); |
return new(Z) IfNode( |
hausner
2016/06/14 17:51:31
Since you now call a Dart function to evaluate the
Lasse Reichstein Nielsen
2016/06/15 05:57:02
I'm not particularly worried about passing two ext
|