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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 kind_flags |= (func.IsGetterFunction() << Mirrors::kGetter); | 271 kind_flags |= (func.IsGetterFunction() << Mirrors::kGetter); |
272 kind_flags |= (func.IsSetterFunction() << Mirrors::kSetter); | 272 kind_flags |= (func.IsSetterFunction() << Mirrors::kSetter); |
273 bool is_ctor = (func.kind() == RawFunction::kConstructor); | 273 bool is_ctor = (func.kind() == RawFunction::kConstructor); |
274 kind_flags |= (is_ctor << Mirrors::kConstructor); | 274 kind_flags |= (is_ctor << Mirrors::kConstructor); |
275 kind_flags |= ((is_ctor && func.is_const()) << Mirrors::kConstCtor); | 275 kind_flags |= ((is_ctor && func.is_const()) << Mirrors::kConstCtor); |
276 kind_flags |= ((is_ctor && func.IsGenerativeConstructor()) | 276 kind_flags |= ((is_ctor && func.IsGenerativeConstructor()) |
277 << Mirrors::kGenerativeCtor); | 277 << Mirrors::kGenerativeCtor); |
278 kind_flags |= ((is_ctor && func.is_redirecting()) | 278 kind_flags |= ((is_ctor && func.is_redirecting()) |
279 << Mirrors::kRedirectingCtor); | 279 << Mirrors::kRedirectingCtor); |
280 kind_flags |= ((is_ctor && func.IsFactory()) << Mirrors::kFactoryCtor); | 280 kind_flags |= ((is_ctor && func.IsFactory()) << Mirrors::kFactoryCtor); |
281 kind_flags |= (func.is_external() << Mirrors::kExternal); | |
281 args.SetAt(5, Smi::Handle(Smi::New(kind_flags))); | 282 args.SetAt(5, Smi::Handle(Smi::New(kind_flags))); |
282 | 283 |
283 return CreateMirror(Symbols::_LocalMethodMirror(), args); | 284 return CreateMirror(Symbols::_LocalMethodMirror(), args); |
284 } | 285 } |
285 | 286 |
286 | 287 |
287 static RawInstance* CreateVariableMirror(const Field& field, | 288 static RawInstance* CreateVariableMirror(const Field& field, |
288 const Instance& owner_mirror) { | 289 const Instance& owner_mirror) { |
289 const MirrorReference& field_ref = | 290 const MirrorReference& field_ref = |
290 MirrorReference::Handle(MirrorReference::New(field)); | 291 MirrorReference::Handle(MirrorReference::New(field)); |
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1967 return InstantiateType(type, instantiator); | 1968 return InstantiateType(type, instantiator); |
1968 } | 1969 } |
1969 | 1970 |
1970 | 1971 |
1971 DEFINE_NATIVE_ENTRY(MethodMirror_source, 1) { | 1972 DEFINE_NATIVE_ENTRY(MethodMirror_source, 1) { |
1972 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | 1973 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
1973 const Function& func = Function::Handle(ref.GetFunctionReferent()); | 1974 const Function& func = Function::Handle(ref.GetFunctionReferent()); |
1974 return func.GetSource(); | 1975 return func.GetSource(); |
1975 } | 1976 } |
1976 | 1977 |
1977 | |
siva
2015/10/30 02:09:17
Extra line got deleted (we usually have two blank
Jacob
2015/10/30 02:16:03
Done.
| |
1978 static RawInstance* CreateSourceLocation(const String& uri, | 1978 static RawInstance* CreateSourceLocation(const String& uri, |
1979 intptr_t line, | 1979 intptr_t line, |
1980 intptr_t column) { | 1980 intptr_t column) { |
1981 const Array& args = Array::Handle(Array::New(3)); | 1981 const Array& args = Array::Handle(Array::New(3)); |
1982 args.SetAt(0, uri); | 1982 args.SetAt(0, uri); |
1983 args.SetAt(1, Smi::Handle(Smi::New(line))); | 1983 args.SetAt(1, Smi::Handle(Smi::New(line))); |
1984 args.SetAt(2, Smi::Handle(Smi::New(column))); | 1984 args.SetAt(2, Smi::Handle(Smi::New(column))); |
1985 return CreateMirror(Symbols::_SourceLocation(), args); | 1985 return CreateMirror(Symbols::_SourceLocation(), args); |
1986 } | 1986 } |
1987 | 1987 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2106 } | 2106 } |
2107 | 2107 |
2108 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { | 2108 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { |
2109 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); | 2109 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); |
2110 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); | 2110 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); |
2111 return Bool::Get(a.IsSubtypeOf(b, NULL)).raw(); | 2111 return Bool::Get(a.IsSubtypeOf(b, NULL)).raw(); |
2112 } | 2112 } |
2113 | 2113 |
2114 | 2114 |
2115 } // namespace dart | 2115 } // namespace dart |
OLD | NEW |