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 #include "vm/flags.h" | 6 #include "vm/flags.h" |
7 | 7 |
8 #ifndef DART_PRECOMPILED_RUNTIME | 8 #ifndef DART_PRECOMPILED_RUNTIME |
9 | 9 |
10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
(...skipping 10981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10992 const TokenPosition type_pos = TokenPos(); | 10992 const TokenPosition type_pos = TokenPos(); |
10993 const AbstractType& type = AbstractType::ZoneHandle(Z, | 10993 const AbstractType& type = AbstractType::ZoneHandle(Z, |
10994 ParseType(ClassFinalizer::kCanonicalize)); | 10994 ParseType(ClassFinalizer::kCanonicalize)); |
10995 if (!type.IsInstantiated() && (FunctionLevel() > 0)) { | 10995 if (!type.IsInstantiated() && (FunctionLevel() > 0)) { |
10996 // Make sure that the instantiator is captured. | 10996 // Make sure that the instantiator is captured. |
10997 CaptureInstantiator(); | 10997 CaptureInstantiator(); |
10998 } | 10998 } |
10999 right_operand = new(Z) TypeNode(type_pos, type); | 10999 right_operand = new(Z) TypeNode(type_pos, type); |
11000 // In production mode, the type may be malformed. | 11000 // In production mode, the type may be malformed. |
11001 // In checked mode, the type may be malformed or malbounded. | 11001 // In checked mode, the type may be malformed or malbounded. |
11002 if (((op_kind == Token::kIS) || (op_kind == Token::kISNOT) || | 11002 if (type.IsMalformedOrMalbounded()) { |
11003 (op_kind == Token::kAS)) && | |
11004 type.IsMalformedOrMalbounded()) { | |
11005 // Note that a type error is thrown in a type test or in | 11003 // Note that a type error is thrown in a type test or in |
11006 // a type cast even if the tested value is null. | 11004 // a type cast even if the tested value is null. |
11007 // We need to evaluate the left operand for potential | 11005 // We need to evaluate the left operand for potential |
11008 // side effects. | 11006 // side effects. |
11009 LetNode* let = new(Z) LetNode(left_operand->token_pos()); | 11007 LetNode* let = new(Z) LetNode(left_operand->token_pos()); |
11010 let->AddNode(left_operand); | 11008 let->AddNode(left_operand); |
11011 let->AddNode(ThrowTypeError(type_pos, type)); | 11009 let->AddNode(ThrowTypeError(type_pos, type)); |
11012 left_operand = let; | 11010 left_operand = let; |
11013 break; // Type checks and casts can't be chained. | 11011 break; // Type checks and casts can't be chained. |
11014 } | 11012 } |
(...skipping 4079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15094 const ArgumentListNode& function_args, | 15092 const ArgumentListNode& function_args, |
15095 const LocalVariable* temp_for_last_arg, | 15093 const LocalVariable* temp_for_last_arg, |
15096 bool is_super_invocation) { | 15094 bool is_super_invocation) { |
15097 UNREACHABLE(); | 15095 UNREACHABLE(); |
15098 return NULL; | 15096 return NULL; |
15099 } | 15097 } |
15100 | 15098 |
15101 } // namespace dart | 15099 } // namespace dart |
15102 | 15100 |
15103 #endif // DART_PRECOMPILED_RUNTIME | 15101 #endif // DART_PRECOMPILED_RUNTIME |
OLD | NEW |