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

Unified Diff: sdk/lib/_internal/compiler/js_lib/js_mirrors.dart

Issue 1040623002: Clean up naming scheme for reflection names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Exclude methods that are not reflectable Created 5 years, 9 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
Index: sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
diff --git a/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart b/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
index 9fc50b79836fd5d187c75d30a091f6f814f8cc1e..c69e159d9803716540224ef8862e6814bfdb8b75 100644
--- a/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
+++ b/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
@@ -991,7 +991,7 @@ class JsInstanceMirror extends JsObjectMirror implements InstanceMirror {
case JSInvocationMirror.METHOD:
if (namedArguments.isNotEmpty) return '$name*';
int nbArgs = positionalArguments.length as int;
- return "$name:$nbArgs:0";
+ return "$name:$nbArgs";
}
throw new RuntimeError("Could not compute reflective name for $name");
}
@@ -1685,7 +1685,7 @@ class JsClassMirror extends JsTypeMirror with JsObjectMirror
// reflection with metadata.
if (simpleName == null) continue;
var function = JS('', '#[#]', prototype, key);
- if (isNoSuchMethodStub(function)) continue;
+ if (!isOrdinaryReflectableMethod(function)) continue;
if (isAliasedSuperMethod(function, key)) continue;
var mirror =
new JsMethodMirror.fromUnmangledName(
@@ -2331,8 +2331,11 @@ class JsMethodMirror extends JsDeclarationMirror implements MethodMirror {
requiredParameterCount = 0;
}
} else {
- requiredParameterCount = int.parse(info[1]);
- optionalParameterCount = int.parse(info[2]);
+ ReflectionInfo reflectionInfo = new ReflectionInfo(jsFunction);
+ requiredParameterCount = reflectionInfo.requiredParameterCount;
+ optionalParameterCount = reflectionInfo.optionalParameterCount;
+ assert(int.parse(info[1]) == requiredParameterCount
+ + optionalParameterCount);
}
return new JsMethodMirror(
s(name), jsFunction, requiredParameterCount, optionalParameterCount,
@@ -2959,8 +2962,10 @@ bool isReflectiveDataInPrototype(String key) {
return firstChar == '*' || firstChar == '+';
}
-bool isNoSuchMethodStub(var jsFunction) {
- return JS('bool', r'#.$reflectable == 2', jsFunction);
+/// Returns `true` if [jsFunction] is an ordinary reflectable method and
+/// not a (potentially reflectable) stub or otherwise non-reflectable method.
+bool isOrdinaryReflectableMethod(var jsFunction) {
+ return JS('bool', r'#.$reflectable === 1', jsFunction);
}
/// Returns true if [key] is only an aliased entry for [function] in the

Powered by Google App Engine
This is Rietveld 408576698