| 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 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 } | 1359 } |
| 1360 | 1360 |
| 1361 | 1361 |
| 1362 DEFINE_NATIVE_ENTRY(ClosureMirror_function, 1) { | 1362 DEFINE_NATIVE_ENTRY(ClosureMirror_function, 1) { |
| 1363 GET_NON_NULL_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0)); | 1363 GET_NON_NULL_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0)); |
| 1364 ASSERT(!closure.IsNull()); | 1364 ASSERT(!closure.IsNull()); |
| 1365 | 1365 |
| 1366 Function& function = Function::Handle(); | 1366 Function& function = Function::Handle(); |
| 1367 bool callable = closure.IsCallable(&function); | 1367 bool callable = closure.IsCallable(&function); |
| 1368 if (callable) { | 1368 if (callable) { |
| 1369 if (function.IsImplicitClosureFunction()) { |
| 1370 // The VM uses separate Functions for tear-offs, but the mirrors consider |
| 1371 // the tear-offs to be the same as the torn-off methods. Avoid handing out |
| 1372 // a reference to the tear-off here to avoid a special case in the |
| 1373 // the equality test. |
| 1374 function = function.parent_function(); |
| 1375 } |
| 1369 return CreateMethodMirror(function, Instance::null_instance()); | 1376 return CreateMethodMirror(function, Instance::null_instance()); |
| 1370 } | 1377 } |
| 1371 return Instance::null(); | 1378 return Instance::null(); |
| 1372 } | 1379 } |
| 1373 | 1380 |
| 1374 | 1381 |
| 1375 DEFINE_NATIVE_ENTRY(ClassMirror_invoke, 5) { | 1382 DEFINE_NATIVE_ENTRY(ClassMirror_invoke, 5) { |
| 1376 // Argument 0 is the mirror, which is unused by the native. It exists | 1383 // Argument 0 is the mirror, which is unused by the native. It exists |
| 1377 // because this native is an instance method in order to be polymorphic | 1384 // because this native is an instance method in order to be polymorphic |
| 1378 // with its cousins. | 1385 // with its cousins. |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2029 } | 2036 } |
| 2030 | 2037 |
| 2031 DEFINE_NATIVE_ENTRY(TypeMirror_moreSpecificTest, 2) { | 2038 DEFINE_NATIVE_ENTRY(TypeMirror_moreSpecificTest, 2) { |
| 2032 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); | 2039 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); |
| 2033 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); | 2040 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); |
| 2034 return Bool::Get(a.IsMoreSpecificThan(b, NULL)).raw(); | 2041 return Bool::Get(a.IsMoreSpecificThan(b, NULL)).raw(); |
| 2035 } | 2042 } |
| 2036 | 2043 |
| 2037 | 2044 |
| 2038 } // namespace dart | 2045 } // namespace dart |
| OLD | NEW |