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/invocation_mirror.h" | 5 #include "lib/invocation_mirror.h" |
6 #include "vm/bootstrap_natives.h" | 6 #include "vm/bootstrap_natives.h" |
7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 static RawInstance* CreateMethodMirror(const Function& func, | 254 static RawInstance* CreateMethodMirror(const Function& func, |
255 const Instance& owner_mirror) { | 255 const Instance& owner_mirror) { |
256 const Array& args = Array::Handle(Array::New(12)); | 256 const Array& args = Array::Handle(Array::New(12)); |
257 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(func))); | 257 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(func))); |
258 args.SetAt(1, String::Handle(func.UserVisibleName())); | 258 args.SetAt(1, String::Handle(func.UserVisibleName())); |
259 args.SetAt(2, owner_mirror); | 259 args.SetAt(2, owner_mirror); |
260 args.SetAt(3, Bool::Get(func.is_static())); | 260 args.SetAt(3, Bool::Get(func.is_static())); |
261 args.SetAt(4, Bool::Get(func.is_abstract())); | 261 args.SetAt(4, Bool::Get(func.is_abstract())); |
262 args.SetAt(5, Bool::Get(func.IsGetterFunction())); | 262 args.SetAt(5, Bool::Get(func.IsGetterFunction())); |
263 args.SetAt(6, Bool::Get(func.IsSetterFunction())); | 263 args.SetAt(6, Bool::Get(func.IsSetterFunction())); |
264 args.SetAt(7, Bool::Get(func.kind() == RawFunction::kConstructor)); | 264 |
265 // TODO(mlippautz): Implement different constructor kinds. | 265 bool isConstructor = (func.kind() == RawFunction::kConstructor); |
266 args.SetAt(8, Bool::False()); | 266 args.SetAt(7, Bool::Get(isConstructor)); |
267 args.SetAt(9, Bool::False()); | 267 args.SetAt(8, Bool::Get(isConstructor && func.is_const())); |
268 args.SetAt(10, Bool::False()); | 268 args.SetAt(9, Bool::Get(isConstructor && func.IsConstructor())); |
269 args.SetAt(11, Bool::False()); | 269 args.SetAt(10, Bool::Get(isConstructor && func.is_redirecting())); |
| 270 args.SetAt(11, Bool::Get(isConstructor && func.IsFactory())); |
| 271 |
270 return CreateMirror(Symbols::_LocalMethodMirrorImpl(), args); | 272 return CreateMirror(Symbols::_LocalMethodMirrorImpl(), args); |
271 } | 273 } |
272 | 274 |
273 | 275 |
274 static RawInstance* CreateVariableMirror(const Field& field, | 276 static RawInstance* CreateVariableMirror(const Field& field, |
275 const Instance& owner_mirror) { | 277 const Instance& owner_mirror) { |
276 const MirrorReference& field_ref = | 278 const MirrorReference& field_ref = |
277 MirrorReference::Handle(MirrorReference::New(field)); | 279 MirrorReference::Handle(MirrorReference::New(field)); |
278 | 280 |
279 const String& name = String::Handle(field.UserVisibleName()); | 281 const String& name = String::Handle(field.UserVisibleName()); |
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 } | 1716 } |
1715 | 1717 |
1716 | 1718 |
1717 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { | 1719 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { |
1718 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | 1720 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
1719 const Field& field = Field::Handle(ref.GetFieldReferent()); | 1721 const Field& field = Field::Handle(ref.GetFieldReferent()); |
1720 return field.type(); | 1722 return field.type(); |
1721 } | 1723 } |
1722 | 1724 |
1723 } // namespace dart | 1725 } // namespace dart |
OLD | NEW |