| 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 13456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13467 TypeArguments::Handle(Z, list_type_arguments.Canonicalize())); | 13467 TypeArguments::Handle(Z, list_type_arguments.Canonicalize())); |
| 13468 Error& bound_error = Error::Handle(Z); | 13468 Error& bound_error = Error::Handle(Z); |
| 13469 for (int i = 0; i < element_list.length(); i++) { | 13469 for (int i = 0; i < element_list.length(); i++) { |
| 13470 AstNode* elem = element_list[i]; | 13470 AstNode* elem = element_list[i]; |
| 13471 // Arguments have been evaluated to a literal value already. | 13471 // Arguments have been evaluated to a literal value already. |
| 13472 ASSERT(elem->IsLiteralNode()); | 13472 ASSERT(elem->IsLiteralNode()); |
| 13473 ASSERT(!is_top_level_); // We cannot check unresolved types. | 13473 ASSERT(!is_top_level_); // We cannot check unresolved types. |
| 13474 if (I->type_checks() && !element_type.IsDynamicType() && | 13474 if (I->type_checks() && !element_type.IsDynamicType() && |
| 13475 (!elem->AsLiteralNode()->literal().IsNull() && | 13475 (!elem->AsLiteralNode()->literal().IsNull() && |
| 13476 !elem->AsLiteralNode()->literal().IsInstanceOf( | 13476 !elem->AsLiteralNode()->literal().IsInstanceOf( |
| 13477 element_type, TypeArguments::Handle(Z), &bound_error))) { | 13477 element_type, Object::null_type_arguments(), &bound_error))) { |
| 13478 // If the failure is due to a bound error, display it instead. | 13478 // If the failure is due to a bound error, display it instead. |
| 13479 if (!bound_error.IsNull()) { | 13479 if (!bound_error.IsNull()) { |
| 13480 ReportError(bound_error); | 13480 ReportError(bound_error); |
| 13481 } else { | 13481 } else { |
| 13482 ReportError( | 13482 ReportError( |
| 13483 elem->AsLiteralNode()->token_pos(), | 13483 elem->AsLiteralNode()->token_pos(), |
| 13484 "list literal element at index %d must be " | 13484 "list literal element at index %d must be " |
| 13485 "a constant of type '%s'", | 13485 "a constant of type '%s'", |
| 13486 i, String::Handle(Z, element_type.UserVisibleName()).ToCString()); | 13486 i, String::Handle(Z, element_type.UserVisibleName()).ToCString()); |
| 13487 } | 13487 } |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14304 "error while evaluating const constructor"); | 14304 "error while evaluating const constructor"); |
| 14305 } | 14305 } |
| 14306 const_instance ^= constructor_result.raw(); | 14306 const_instance ^= constructor_result.raw(); |
| 14307 CacheConstantValue(new_pos, const_instance); | 14307 CacheConstantValue(new_pos, const_instance); |
| 14308 } | 14308 } |
| 14309 new_object = new (Z) LiteralNode(new_pos, const_instance); | 14309 new_object = new (Z) LiteralNode(new_pos, const_instance); |
| 14310 if (!type_bound.IsNull()) { | 14310 if (!type_bound.IsNull()) { |
| 14311 ASSERT(!type_bound.IsMalformed()); | 14311 ASSERT(!type_bound.IsMalformed()); |
| 14312 Error& bound_error = Error::Handle(Z); | 14312 Error& bound_error = Error::Handle(Z); |
| 14313 ASSERT(!is_top_level_); // We cannot check unresolved types. | 14313 ASSERT(!is_top_level_); // We cannot check unresolved types. |
| 14314 if (!const_instance.IsInstanceOf(type_bound, TypeArguments::Handle(Z), | 14314 if (!const_instance.IsInstanceOf( |
| 14315 &bound_error)) { | 14315 type_bound, Object::null_type_arguments(), &bound_error)) { |
| 14316 type_bound = ClassFinalizer::NewFinalizedMalformedType( | 14316 type_bound = ClassFinalizer::NewFinalizedMalformedType( |
| 14317 bound_error, script_, new_pos, | 14317 bound_error, script_, new_pos, |
| 14318 "const factory result is not an instance of '%s'", | 14318 "const factory result is not an instance of '%s'", |
| 14319 String::Handle(Z, type_bound.UserVisibleName()).ToCString()); | 14319 String::Handle(Z, type_bound.UserVisibleName()).ToCString()); |
| 14320 new_object = ThrowTypeError(new_pos, type_bound); | 14320 new_object = ThrowTypeError(new_pos, type_bound); |
| 14321 } | 14321 } |
| 14322 type_bound = AbstractType::null(); | 14322 type_bound = AbstractType::null(); |
| 14323 } | 14323 } |
| 14324 } else { | 14324 } else { |
| 14325 CheckConstructorCallTypeArguments(new_pos, constructor, type_arguments); | 14325 CheckConstructorCallTypeArguments(new_pos, constructor, type_arguments); |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15197 const ArgumentListNode& function_args, | 15197 const ArgumentListNode& function_args, |
| 15198 const LocalVariable* temp_for_last_arg, | 15198 const LocalVariable* temp_for_last_arg, |
| 15199 bool is_super_invocation) { | 15199 bool is_super_invocation) { |
| 15200 UNREACHABLE(); | 15200 UNREACHABLE(); |
| 15201 return NULL; | 15201 return NULL; |
| 15202 } | 15202 } |
| 15203 | 15203 |
| 15204 } // namespace dart | 15204 } // namespace dart |
| 15205 | 15205 |
| 15206 #endif // DART_PRECOMPILED_RUNTIME | 15206 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |