Chromium Code Reviews| 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. |