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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 UNREACHABLE(); | 104 UNREACHABLE(); |
105 } | 105 } |
106 ASSERT(id_obj.IsSmi() || id_obj.IsMint()); | 106 ASSERT(id_obj.IsSmi() || id_obj.IsMint()); |
107 Integer& id = Integer::Handle(); | 107 Integer& id = Integer::Handle(); |
108 id ^= id_obj.raw(); | 108 id ^= id_obj.raw(); |
109 Dart_Port port_id = static_cast<Dart_Port>(id.AsInt64Value()); | 109 Dart_Port port_id = static_cast<Dart_Port>(id.AsInt64Value()); |
110 return Bool::Get(PortMap::IsLocalPort(port_id)).raw(); | 110 return Bool::Get(PortMap::IsLocalPort(port_id)).raw(); |
111 } | 111 } |
112 | 112 |
113 static void EnsureConstructorsAreCompiled(const Function& func) { | 113 static void EnsureConstructorsAreCompiled(const Function& func) { |
114 if (func.kind() != RawFunction::kConstructor) return; | 114 // Only generative constructors can have initializing formals. |
| 115 if (!func.IsConstructor()) return; |
| 116 |
115 const Class& cls = Class::Handle(func.Owner()); | 117 const Class& cls = Class::Handle(func.Owner()); |
116 const Error& error = Error::Handle(cls.EnsureIsFinalized(Isolate::Current())); | 118 const Error& error = Error::Handle(cls.EnsureIsFinalized(Isolate::Current())); |
117 if (!error.IsNull()) { | 119 if (!error.IsNull()) { |
118 ThrowInvokeError(error); | 120 ThrowInvokeError(error); |
119 UNREACHABLE(); | 121 UNREACHABLE(); |
120 } | 122 } |
121 if (!func.HasCode()) { | 123 if (!func.HasCode()) { |
122 const Error& error = Error::Handle(Compiler::CompileFunction(func)); | 124 const Error& error = Error::Handle(Compiler::CompileFunction(func)); |
123 if (!error.IsNull()) { | 125 if (!error.IsNull()) { |
124 ThrowInvokeError(error); | 126 ThrowInvokeError(error); |
(...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1972 } | 1974 } |
1973 | 1975 |
1974 | 1976 |
1975 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { | 1977 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { |
1976 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); | 1978 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); |
1977 const Field& field = Field::Handle(ref.GetFieldReferent()); | 1979 const Field& field = Field::Handle(ref.GetFieldReferent()); |
1978 return field.type(); | 1980 return field.type(); |
1979 } | 1981 } |
1980 | 1982 |
1981 } // namespace dart | 1983 } // namespace dart |
OLD | NEW |