Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: runtime/lib/mirrors.cc

Issue 2632253002: VM: [Kernel] Partial support for metadata annotations (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "vm/dart_entry.h" 11 #include "vm/dart_entry.h"
12 #include "vm/exceptions.h" 12 #include "vm/exceptions.h"
13 #include "vm/flags.h" 13 #include "vm/flags.h"
14 #include "vm/kernel_to_il.h"
14 #include "vm/object_store.h" 15 #include "vm/object_store.h"
15 #include "vm/parser.h" 16 #include "vm/parser.h"
16 #include "vm/port.h" 17 #include "vm/port.h"
17 #include "vm/resolver.h" 18 #include "vm/resolver.h"
18 #include "vm/symbols.h" 19 #include "vm/symbols.h"
19 20
20 namespace dart { 21 namespace dart {
21 22
22 #ifndef PRODUCT 23 #ifndef PRODUCT
23 24
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // hence do not have a token position, and therefore cannot be reparsed. 144 // hence do not have a token position, and therefore cannot be reparsed.
144 has_extra_parameter_info = false; 145 has_extra_parameter_info = false;
145 } 146 }
146 147
147 Array& param_descriptor = Array::Handle(); 148 Array& param_descriptor = Array::Handle();
148 if (has_extra_parameter_info) { 149 if (has_extra_parameter_info) {
149 // Reparse the function for the following information: 150 // Reparse the function for the following information:
150 // * The default value of a parameter. 151 // * The default value of a parameter.
151 // * Whether a parameters has been declared as final. 152 // * Whether a parameters has been declared as final.
152 // * Any metadata associated with the parameter. 153 // * Any metadata associated with the parameter.
153 const Object& result = 154 Object& result = Object::Handle();
154 Object::Handle(Parser::ParseFunctionParameters(func)); 155
156 kernel::TreeNode* kernel_node =
157 reinterpret_cast<kernel::TreeNode*>(func.kernel_function());
158 if (kernel_node != NULL) {
159 result = kernel::BuildParameterDescriptor(kernel_node);
160 } else {
161 result = Parser::ParseFunctionParameters(func);
162 }
155 if (result.IsError()) { 163 if (result.IsError()) {
156 Exceptions::PropagateError(Error::Cast(result)); 164 Exceptions::PropagateError(Error::Cast(result));
157 UNREACHABLE(); 165 UNREACHABLE();
158 } 166 }
159 param_descriptor ^= result.raw(); 167 param_descriptor ^= result.raw();
160 ASSERT(param_descriptor.Length() == 168 ASSERT(param_descriptor.Length() ==
161 (Parser::kParameterEntrySize * non_implicit_param_count)); 169 (Parser::kParameterEntrySize * non_implicit_param_count));
162 } 170 }
163 171
164 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(func))); 172 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(func)));
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 2088
2081 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { 2089 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) {
2082 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); 2090 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0));
2083 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); 2091 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1));
2084 return Bool::Get(a.IsSubtypeOf(b, NULL, NULL, Heap::kNew)).raw(); 2092 return Bool::Get(a.IsSubtypeOf(b, NULL, NULL, Heap::kNew)).raw();
2085 } 2093 }
2086 2094
2087 #endif // !PRODUCT 2095 #endif // !PRODUCT
2088 2096
2089 } // namespace dart 2097 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698