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 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 } | 1231 } |
1232 ASSERT(!ctxt_library.IsNull()); | 1232 ASSERT(!ctxt_library.IsNull()); |
1233 const Object& result = | 1233 const Object& result = |
1234 Object::Handle(ctxt_library.Evaluate(expression, | 1234 Object::Handle(ctxt_library.Evaluate(expression, |
1235 Array::empty_array(), | 1235 Array::empty_array(), |
1236 Array::empty_array())); | 1236 Array::empty_array())); |
1237 if (result.IsError()) { | 1237 if (result.IsError()) { |
1238 Exceptions::PropagateError(Error::Cast(result)); | 1238 Exceptions::PropagateError(Error::Cast(result)); |
1239 UNREACHABLE(); | 1239 UNREACHABLE(); |
1240 } | 1240 } |
| 1241 |
| 1242 // Because we currently only use this native for building field extractors and |
| 1243 // setters, assume the result is a closure and mark its function as invisible, |
| 1244 // so it will not appear in stack traces. Whenever we support |
| 1245 // ObjectMirror.evaluate this will need to be separated. |
| 1246 ASSERT(Instance::Cast(result).IsClosure()); |
| 1247 const Function& func = |
| 1248 Function::Handle(Closure::function(Instance::Cast(result))); |
| 1249 func.set_is_visible(false); |
| 1250 func.set_is_debuggable(false); |
| 1251 |
1241 return result.raw(); | 1252 return result.raw(); |
1242 } | 1253 } |
1243 | 1254 |
1244 DEFINE_NATIVE_ENTRY(TypedefMirror_declaration, 1) { | 1255 DEFINE_NATIVE_ENTRY(TypedefMirror_declaration, 1) { |
1245 GET_NON_NULL_NATIVE_ARGUMENT(Type, type, arguments->NativeArgAt(0)); | 1256 GET_NON_NULL_NATIVE_ARGUMENT(Type, type, arguments->NativeArgAt(0)); |
1246 const Class& cls = Class::Handle(type.type_class()); | 1257 const Class& cls = Class::Handle(type.type_class()); |
1247 // We represent typedefs as non-canonical signature classes. | 1258 // We represent typedefs as non-canonical signature classes. |
1248 ASSERT(cls.IsSignatureClass() && !cls.IsCanonicalSignatureClass()); | 1259 ASSERT(cls.IsSignatureClass() && !cls.IsCanonicalSignatureClass()); |
1249 return CreateTypedefMirror(cls, | 1260 return CreateTypedefMirror(cls, |
1250 AbstractType::Handle(cls.DeclarationType()), | 1261 AbstractType::Handle(cls.DeclarationType()), |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2036 } | 2047 } |
2037 | 2048 |
2038 DEFINE_NATIVE_ENTRY(TypeMirror_moreSpecificTest, 2) { | 2049 DEFINE_NATIVE_ENTRY(TypeMirror_moreSpecificTest, 2) { |
2039 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); | 2050 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); |
2040 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); | 2051 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); |
2041 return Bool::Get(a.IsMoreSpecificThan(b, NULL)).raw(); | 2052 return Bool::Get(a.IsMoreSpecificThan(b, NULL)).raw(); |
2042 } | 2053 } |
2043 | 2054 |
2044 | 2055 |
2045 } // namespace dart | 2056 } // namespace dart |
OLD | NEW |