| 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 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1705 // so as to produce the same NoSuchMethodError as the non-reflective case. | 1705 // so as to produce the same NoSuchMethodError as the non-reflective case. |
| 1706 lookup_constructor = Function::null(); | 1706 lookup_constructor = Function::null(); |
| 1707 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), | 1707 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()), |
| 1708 internal_constructor_name, | 1708 internal_constructor_name, |
| 1709 lookup_constructor, | 1709 lookup_constructor, |
| 1710 InvocationMirror::kConstructor, | 1710 InvocationMirror::kConstructor, |
| 1711 InvocationMirror::kMethod); | 1711 InvocationMirror::kMethod); |
| 1712 UNREACHABLE(); | 1712 UNREACHABLE(); |
| 1713 } | 1713 } |
| 1714 | 1714 |
| 1715 if (klass.is_abstract() && !lookup_constructor.IsFactory()) { |
| 1716 const Array& error_args = Array::Handle(Array::New(3)); |
| 1717 error_args.SetAt(0, klass_name); |
| 1718 // 1 = script url |
| 1719 // 2 = token position |
| 1720 Exceptions::ThrowByType(Exceptions::kAbstractClassInstantiation, |
| 1721 error_args); |
| 1722 UNREACHABLE(); |
| 1723 } |
| 1724 |
| 1715 ASSERT(!type.IsNull()); | 1725 ASSERT(!type.IsNull()); |
| 1716 AbstractTypeArguments& type_arguments = | 1726 AbstractTypeArguments& type_arguments = |
| 1717 AbstractTypeArguments::Handle(type.arguments()); | 1727 AbstractTypeArguments::Handle(type.arguments()); |
| 1718 if (!type.IsInstantiated()) { | 1728 if (!type.IsInstantiated()) { |
| 1719 // Must have been a declaration type. | 1729 // Must have been a declaration type. |
| 1720 AbstractType& rare_type = AbstractType::Handle(klass.RareType()); | 1730 AbstractType& rare_type = AbstractType::Handle(klass.RareType()); |
| 1721 ASSERT(rare_type.IsInstantiated()); | 1731 ASSERT(rare_type.IsInstantiated()); |
| 1722 type_arguments = rare_type.arguments(); | 1732 type_arguments = rare_type.arguments(); |
| 1723 } | 1733 } |
| 1724 | 1734 |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2052 | 2062 |
| 2053 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) { | 2063 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) { |
| 2054 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | 2064 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
| 2055 const Field& field = Field::Handle(ref.GetFieldReferent()); | 2065 const Field& field = Field::Handle(ref.GetFieldReferent()); |
| 2056 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1)); | 2066 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1)); |
| 2057 const AbstractType& type = AbstractType::Handle(field.type()); | 2067 const AbstractType& type = AbstractType::Handle(field.type()); |
| 2058 return InstantiateType(type, instantiator); | 2068 return InstantiateType(type, instantiator); |
| 2059 } | 2069 } |
| 2060 | 2070 |
| 2061 } // namespace dart | 2071 } // namespace dart |
| OLD | NEW |