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

Unified Diff: runtime/lib/mirrors.cc

Issue 23224016: Implement ParameterMirror.metadata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/mirrors.cc
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index 55b99b7d0458405bb7df0dc1ccdbd9df7f4232e3..dbead74ecea3e7fc86a6879a72b926a2eb10876c 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -125,7 +125,7 @@ static RawInstance* CreateParameterMirrorList(const Function& func,
const intptr_t index_of_first_named_param =
non_implicit_param_count - func.NumOptionalNamedParameters();
const Array& results = Array::Handle(Array::New(non_implicit_param_count));
- const Array& args = Array::Handle(Array::New(8));
+ const Array& args = Array::Handle(Array::New(9));
// Return for synthetic functions and getters.
if (func.IsGetterFunction() ||
@@ -140,10 +140,12 @@ static RawInstance* CreateParameterMirrorList(const Function& func,
Instance& param = Instance::Handle();
Bool& is_final = Bool::Handle();
Object& default_value = Object::Handle();
+ Object& metadata = Object::Handle();
// Reparse the function for the following information:
// * The default value of a parameter.
// * Whether a parameters has been deflared as final.
+ // * Any metadata associated with the parameter.
const Object& result = Object::Handle(Parser::ParseFunctionParameters(func));
if (result.IsError()) {
ThrowInvokeError(Error::Cast(result));
@@ -154,12 +156,18 @@ static RawInstance* CreateParameterMirrorList(const Function& func,
args.SetAt(2, owner_mirror);
const Array& param_descriptor = Array::Cast(result);
- ASSERT(param_descriptor.Length() == (2 * non_implicit_param_count));
+ ASSERT(param_descriptor.Length() ==
+ (Parser::kParameterEntrySize * non_implicit_param_count));
for (intptr_t i = 0; i < non_implicit_param_count; i++) {
pos ^= Smi::New(i);
name ^= func.ParameterNameAt(implicit_param_count + i);
- is_final ^= param_descriptor.At(i * 2);
- default_value = param_descriptor.At(i * 2 + 1);
+ is_final ^= param_descriptor.At(
+ i * Parser::kParameterEntrySize + Parser::kParameterIsFinalOffset);
+ default_value = param_descriptor.At(
+ i * Parser::kParameterEntrySize + Parser::kParameterDefaultValueOffset);
+ metadata = param_descriptor.At(
+ i * Parser::kParameterEntrySize + Parser::kParameterMetadataOffset);
+
ASSERT(default_value.IsNull() || default_value.IsInstance());
// Arguments 0 (referent) and 2 (owner) are the same for all parameters. See
@@ -170,6 +178,7 @@ static RawInstance* CreateParameterMirrorList(const Function& func,
args.SetAt(5, Bool::Get(i >= index_of_first_named_param));
args.SetAt(6, is_final);
args.SetAt(7, default_value);
+ args.SetAt(8, metadata);
param ^= CreateMirror(Symbols::_LocalParameterMirrorImpl(), args);
results.SetAt(i, param);
}
« no previous file with comments | « no previous file | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698