OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/parser.h" | 5 #include "vm/parser.h" |
6 | 6 |
7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
(...skipping 6045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6056 } | 6056 } |
6057 TypeNode* exception_type = new TypeNode(catch_pos, *exception_param.type); | 6057 TypeNode* exception_type = new TypeNode(catch_pos, *exception_param.type); |
6058 AstNode* exception_var = new LoadLocalNode(catch_pos, catch_excp_var); | 6058 AstNode* exception_var = new LoadLocalNode(catch_pos, catch_excp_var); |
6059 if (!exception_type->type().IsInstantiated()) { | 6059 if (!exception_type->type().IsInstantiated()) { |
6060 EnsureExpressionTemp(); | 6060 EnsureExpressionTemp(); |
6061 } | 6061 } |
6062 AstNode* type_cond_expr = new ComparisonNode( | 6062 AstNode* type_cond_expr = new ComparisonNode( |
6063 catch_pos, Token::kIS, exception_var, exception_type); | 6063 catch_pos, Token::kIS, exception_var, exception_type); |
6064 current_block_->statements->Add( | 6064 current_block_->statements->Add( |
6065 new IfNode(catch_pos, type_cond_expr, catch_handler, NULL)); | 6065 new IfNode(catch_pos, type_cond_expr, catch_handler, NULL)); |
6066 ASSERT(exception_type->type().IsInstantiated()); | 6066 |
6067 handler_types.Add(*exception_param.type); | 6067 // Do not add uninstantiated types (e.g. type parameter T or |
| 6068 // generic type List<T>), since the debugger won't be able to |
| 6069 // instantiate it when walking the stack. |
| 6070 // This means that the debugger is not able to determine whether |
| 6071 // an exception is caught if the catch clause uses generic types. |
| 6072 // It will report the exception as uncaught when in fact it might |
| 6073 // be caught and handled when we unwind the stack. |
| 6074 if (exception_param.type->IsInstantiated()) { |
| 6075 handler_types.Add(*exception_param.type); |
| 6076 } |
6068 } else { | 6077 } else { |
6069 // No exception type exists in the catch specifier so execute the | 6078 // No exception type exists in the catch specifier so execute the |
6070 // catch handler code unconditionally. | 6079 // catch handler code unconditionally. |
6071 current_block_->statements->Add(catch_handler); | 6080 current_block_->statements->Add(catch_handler); |
6072 generic_catch_seen = true; | 6081 generic_catch_seen = true; |
6073 // This catch clause will handle all exceptions. We can safely forget | 6082 // This catch clause will handle all exceptions. We can safely forget |
6074 // all previous catch clause types. | 6083 // all previous catch clause types. |
6075 handler_types.SetLength(0); | 6084 handler_types.SetLength(0); |
6076 handler_types.Add(*exception_param.type); | 6085 handler_types.Add(*exception_param.type); |
6077 } | 6086 } |
(...skipping 3638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9716 void Parser::SkipQualIdent() { | 9725 void Parser::SkipQualIdent() { |
9717 ASSERT(IsIdentifier()); | 9726 ASSERT(IsIdentifier()); |
9718 ConsumeToken(); | 9727 ConsumeToken(); |
9719 if (CurrentToken() == Token::kPERIOD) { | 9728 if (CurrentToken() == Token::kPERIOD) { |
9720 ConsumeToken(); // Consume the kPERIOD token. | 9729 ConsumeToken(); // Consume the kPERIOD token. |
9721 ExpectIdentifier("identifier expected after '.'"); | 9730 ExpectIdentifier("identifier expected after '.'"); |
9722 } | 9731 } |
9723 } | 9732 } |
9724 | 9733 |
9725 } // namespace dart | 9734 } // namespace dart |
OLD | NEW |