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

Unified Diff: runtime/vm/parser.cc

Issue 9416067: Fix cacthing exception object: a null exception is always caught. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | tests/language/language.status » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 4404)
+++ runtime/vm/parser.cc (working copy)
@@ -4920,10 +4920,17 @@
}
AstNode* exception_type = new TypeNode(catch_pos, *exception_param.type);
AstNode* exception_var = new LoadLocalNode(catch_pos, *catch_excp_var);
- AstNode* cond_expr = new ComparisonNode(
+ // Null is also allowed.
+ AstNode* null_literal =
+ new LiteralNode(catch_pos, Instance::ZoneHandle(Instance::null()));
+ AstNode* null_cond_expr = new ComparisonNode(
+ catch_pos, Token::kEQ_STRICT, exception_var, null_literal);
+ AstNode* type_cond_expr = new ComparisonNode(
catch_pos, Token::kIS, exception_var, exception_type);
+ AstNode* or_node = new BinaryOpNode(
+ catch_pos, Token::kOR, null_cond_expr, type_cond_expr);
hausner 2012/02/21 21:46:41 As discussed offline, this compare has to be done
srdjan 2012/02/21 21:53:52 Done.
current_block_->statements->Add(
- new IfNode(catch_pos, cond_expr, catch_handler, NULL));
+ new IfNode(catch_pos, or_node, catch_handler, NULL));
} else {
// No exception type exists in the catch specifier so execute the
// catch handler code unconditionally.
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | tests/language/language.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698