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 "lib/mirrors.h" | 5 #include "lib/mirrors.h" |
6 | 6 |
7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "vm/bootstrap_natives.h" | 8 #include "vm/bootstrap_natives.h" |
9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 if (function.IsImplicitClosureFunction()) { | 1464 if (function.IsImplicitClosureFunction()) { |
1465 // The VM uses separate Functions for tear-offs, but the mirrors consider | 1465 // The VM uses separate Functions for tear-offs, but the mirrors consider |
1466 // the tear-offs to be the same as the torn-off methods. Avoid handing out | 1466 // the tear-offs to be the same as the torn-off methods. Avoid handing out |
1467 // a reference to the tear-off here to avoid a special case in the | 1467 // a reference to the tear-off here to avoid a special case in the |
1468 // the equality test. | 1468 // the equality test. |
1469 function = function.parent_function(); | 1469 function = function.parent_function(); |
1470 } | 1470 } |
1471 | 1471 |
1472 Type& instantiator = Type::Handle(); | 1472 Type& instantiator = Type::Handle(); |
1473 if (closure.IsClosure()) { | 1473 if (closure.IsClosure()) { |
1474 const TypeArguments& arguments = | 1474 const TypeArguments& arguments = TypeArguments::Handle( |
1475 TypeArguments::Handle(Closure::Cast(closure).instantiator()); | 1475 Closure::Cast(closure).instantiator_type_arguments()); |
| 1476 // TODO(regis): Mirrors need work to properly support generic functions. |
| 1477 // The 'instantiator' created below should not be a type, but two type |
| 1478 // argument vectors: instantiator_type_arguments and |
| 1479 // function_type_arguments. |
1476 const Class& cls = | 1480 const Class& cls = |
1477 Class::Handle(Isolate::Current()->object_store()->object_class()); | 1481 Class::Handle(Isolate::Current()->object_store()->object_class()); |
1478 instantiator = Type::New(cls, arguments, TokenPosition::kNoSource); | 1482 instantiator = Type::New(cls, arguments, TokenPosition::kNoSource); |
1479 instantiator.SetIsFinalized(); | 1483 instantiator.SetIsFinalized(); |
1480 } | 1484 } |
1481 return CreateMethodMirror(function, Instance::null_instance(), | 1485 return CreateMethodMirror(function, Instance::null_instance(), |
1482 instantiator); | 1486 instantiator); |
1483 } | 1487 } |
1484 return Instance::null(); | 1488 return Instance::null(); |
1485 } | 1489 } |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2097 | 2101 |
2098 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { | 2102 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { |
2099 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); | 2103 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); |
2100 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); | 2104 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); |
2101 return Bool::Get(a.IsSubtypeOf(b, NULL, NULL, Heap::kNew)).raw(); | 2105 return Bool::Get(a.IsSubtypeOf(b, NULL, NULL, Heap::kNew)).raw(); |
2102 } | 2106 } |
2103 | 2107 |
2104 #endif // !PRODUCT && !DART_PRECOMPILED_RUNTIME | 2108 #endif // !PRODUCT && !DART_PRECOMPILED_RUNTIME |
2105 | 2109 |
2106 } // namespace dart | 2110 } // namespace dart |
OLD | NEW |