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 13203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13214 *constructor = type_class.LookupConstructor(constructor_name); | 13214 *constructor = type_class.LookupConstructor(constructor_name); |
13215 if (constructor->IsNull()) { | 13215 if (constructor->IsNull()) { |
13216 *constructor = type_class.LookupFactory(constructor_name); | 13216 *constructor = type_class.LookupFactory(constructor_name); |
13217 ASSERT(!constructor->IsNull()); | 13217 ASSERT(!constructor->IsNull()); |
13218 if (constructor->IsRedirectingFactory()) { | 13218 if (constructor->IsRedirectingFactory()) { |
13219 ClassFinalizer::ResolveRedirectingFactory(type_class, *constructor); | 13219 ClassFinalizer::ResolveRedirectingFactory(type_class, *constructor); |
13220 type = constructor->RedirectionType(); | 13220 type = constructor->RedirectionType(); |
13221 ASSERT(!type.IsMalformedOrMalbounded()); | 13221 ASSERT(!type.IsMalformedOrMalbounded()); |
13222 if (!type.IsInstantiated()) { | 13222 if (!type.IsInstantiated()) { |
13223 Error& error = Error::Handle(Z); | 13223 Error& error = Error::Handle(Z); |
13224 type ^= type.InstantiateFrom(*type_arguments, &error, NULL, Heap::kOld); | 13224 type ^= type.InstantiateFrom(*type_arguments, |
| 13225 &error, |
| 13226 NULL, // instantiation_trail |
| 13227 NULL, // bound_trail |
| 13228 Heap::kOld); |
13225 ASSERT(error.IsNull()); | 13229 ASSERT(error.IsNull()); |
13226 } | 13230 } |
13227 *type_arguments = type.arguments(); | 13231 *type_arguments = type.arguments(); |
13228 *constructor = constructor->RedirectionTarget(); | 13232 *constructor = constructor->RedirectionTarget(); |
13229 } | 13233 } |
13230 } | 13234 } |
13231 } | 13235 } |
13232 | 13236 |
13233 | 13237 |
13234 AstNode* Parser::ParseNewOperator(Token::Kind op_kind) { | 13238 AstNode* Parser::ParseNewOperator(Token::Kind op_kind) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13378 ClassFinalizer::ResolveRedirectingFactory(type_class, constructor); | 13382 ClassFinalizer::ResolveRedirectingFactory(type_class, constructor); |
13379 Type& redirect_type = Type::Handle(Z, constructor.RedirectionType()); | 13383 Type& redirect_type = Type::Handle(Z, constructor.RedirectionType()); |
13380 if (!redirect_type.IsMalformedOrMalbounded() && | 13384 if (!redirect_type.IsMalformedOrMalbounded() && |
13381 !redirect_type.IsInstantiated()) { | 13385 !redirect_type.IsInstantiated()) { |
13382 // The type arguments of the redirection type are instantiated from the | 13386 // The type arguments of the redirection type are instantiated from the |
13383 // type arguments of the parsed type of the 'new' or 'const' expression. | 13387 // type arguments of the parsed type of the 'new' or 'const' expression. |
13384 Error& error = Error::Handle(Z); | 13388 Error& error = Error::Handle(Z); |
13385 redirect_type ^= redirect_type.InstantiateFrom( | 13389 redirect_type ^= redirect_type.InstantiateFrom( |
13386 type_arguments, | 13390 type_arguments, |
13387 &error, | 13391 &error, |
13388 NULL, // trail | 13392 NULL, // instantiation_trail |
| 13393 NULL, // bound_trail |
13389 Heap::kOld); | 13394 Heap::kOld); |
13390 if (!error.IsNull()) { | 13395 if (!error.IsNull()) { |
13391 redirect_type = ClassFinalizer::NewFinalizedMalformedType( | 13396 redirect_type = ClassFinalizer::NewFinalizedMalformedType( |
13392 error, | 13397 error, |
13393 script_, | 13398 script_, |
13394 call_pos, | 13399 call_pos, |
13395 "redirecting factory type '%s' cannot be instantiated", | 13400 "redirecting factory type '%s' cannot be instantiated", |
13396 String::Handle(Z, redirect_type.UserVisibleName()).ToCString()); | 13401 String::Handle(Z, redirect_type.UserVisibleName()).ToCString()); |
13397 } | 13402 } |
13398 } | 13403 } |
(...skipping 19 matching lines...) Expand all Loading... |
13418 String::Handle(Z, redirect_type.UserVisibleName()).ToCString()); | 13423 String::Handle(Z, redirect_type.UserVisibleName()).ToCString()); |
13419 } | 13424 } |
13420 | 13425 |
13421 if (redirect_type.IsMalformedOrMalbounded()) { | 13426 if (redirect_type.IsMalformedOrMalbounded()) { |
13422 if (is_const) { | 13427 if (is_const) { |
13423 ReportError(Error::Handle(Z, redirect_type.error())); | 13428 ReportError(Error::Handle(Z, redirect_type.error())); |
13424 } | 13429 } |
13425 return ThrowTypeError(redirect_type.token_pos(), redirect_type); | 13430 return ThrowTypeError(redirect_type.token_pos(), redirect_type); |
13426 } | 13431 } |
13427 if (I->flags().type_checks() && | 13432 if (I->flags().type_checks() && |
13428 !redirect_type.IsSubtypeOf(type, NULL, Heap::kOld)) { | 13433 !redirect_type.IsSubtypeOf(type, NULL, NULL, Heap::kOld)) { |
13429 // Additional type checking of the result is necessary. | 13434 // Additional type checking of the result is necessary. |
13430 type_bound = type.raw(); | 13435 type_bound = type.raw(); |
13431 } | 13436 } |
13432 type = redirect_type.raw(); | 13437 type = redirect_type.raw(); |
13433 type_class = type.type_class(); | 13438 type_class = type.type_class(); |
13434 type_class_name = type_class.Name(); | 13439 type_class_name = type_class.Name(); |
13435 type_arguments = type.arguments(); | 13440 type_arguments = type.arguments(); |
13436 constructor = constructor.RedirectionTarget(); | 13441 constructor = constructor.RedirectionTarget(); |
13437 constructor_name = constructor.name(); | 13442 constructor_name = constructor.name(); |
13438 ASSERT(!constructor.IsNull()); | 13443 ASSERT(!constructor.IsNull()); |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14406 const ArgumentListNode& function_args, | 14411 const ArgumentListNode& function_args, |
14407 const LocalVariable* temp_for_last_arg, | 14412 const LocalVariable* temp_for_last_arg, |
14408 bool is_super_invocation) { | 14413 bool is_super_invocation) { |
14409 UNREACHABLE(); | 14414 UNREACHABLE(); |
14410 return NULL; | 14415 return NULL; |
14411 } | 14416 } |
14412 | 14417 |
14413 } // namespace dart | 14418 } // namespace dart |
14414 | 14419 |
14415 #endif // DART_PRECOMPILED_RUNTIME | 14420 #endif // DART_PRECOMPILED_RUNTIME |
OLD | NEW |