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

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

Issue 24703003: Fix a problem revealed by mirror_printer_test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments 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 | dart/tests/lib/lib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/sdk/lib/_internal/lib/js_mirrors.dart
diff --git a/dart/sdk/lib/_internal/lib/js_mirrors.dart b/dart/sdk/lib/_internal/lib/js_mirrors.dart
index 8453ab675048837c6e801707bcc1ce8f5c029cca..2887c43e96c54ee929b4c4cdeee517e96f7c0d8f 100644
--- a/dart/sdk/lib/_internal/lib/js_mirrors.dart
+++ b/dart/sdk/lib/_internal/lib/js_mirrors.dart
@@ -33,6 +33,8 @@ import 'dart:_interceptors' show
JSExtendableArray;
import 'dart:_js_names';
+const String METHODS_WITH_OPTIONAL_ARGUMENTS = r'$methodsWithOptionalArguments';
+
/// No-op method that is called to inform the compiler that tree-shaking needs
/// to be disabled.
disableTreeShaking() => preserveNames();
@@ -1007,7 +1009,7 @@ class JsClassMirror extends JsTypeMirror with JsObjectMirror
List<String> keys = extractKeys(prototype);
var result = <JsMethodMirror>[];
for (String key in keys) {
- if (key == '') continue;
+ if (isReflectiveDataInPrototype(key)) continue;
String simpleName = mangledNames[key];
// [simpleName] can be null if [key] represents an implementation
// detail, for example, a bailout method, or runtime type support.
@@ -1026,7 +1028,7 @@ class JsClassMirror extends JsTypeMirror with JsObjectMirror
int length = keys.length;
for (int i = 0; i < length; i++) {
String mangledName = keys[i];
- if (mangledName == '') continue; // Skip static field descriptor.
+ if (isReflectiveDataInPrototype(mangledName)) continue;
String unmangledName = mangledName;
var jsFunction = JS('', '#[#]', owner._globalObject, mangledName);
@@ -1895,6 +1897,14 @@ bool isOperatorName(String name) {
}
}
+/// Returns true if the key represent ancillary reflection data, that is, not a
+/// method.
+bool isReflectiveDataInPrototype(String key) {
+ if (key == '' || key == METHODS_WITH_OPTIONAL_ARGUMENTS) return true;
+ String firstChar = key[0];
+ return firstChar == '*' || firstChar == '+';
+}
+
// Copied from package "unmodifiable_collection".
// TODO(ahe): Lobby to get it added to dart:collection.
class UnmodifiableMapView<K, V> implements Map<K, V> {
« no previous file with comments | « no previous file | dart/tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698