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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart

Issue 15861005: Implement ClassMirror.owner and LibraryMirror.uri. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix problem in deferred code Created 7 years, 7 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: dart/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart b/dart/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
index 016418fb4cca44f9585bfeed676ebf0ee13329f6..d691fd012c5b6c93a895352de8897982025397ab 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
@@ -13,14 +13,7 @@ import 'dart:_foreign_helper' show DART_CLOSURE_TO_JS,
JS_OPERATOR_IS_PREFIX,
JS_OPERATOR_AS_PREFIX,
RAW_DART_FUNCTION_REF;
-import 'dart:_interceptors' show getInterceptor,
- interceptedNames,
- dispatchPropertyName,
- makeDispatchRecord,
- setDispatchProperty,
- Interceptor,
- JSMutableIndexable,
- JSUnknown;
+import 'dart:_interceptors';
import "dart:_collection-dev" as _symbol_dev;
part 'constant_map.dart';
@@ -578,6 +571,14 @@ class Primitives {
}
static getConstructor(String className) {
+ // TODO(ahe): Generalize this and improve test coverage of
+ // reflecting on intercepted classes.
+ if (JS('bool', '# == "String"', className)) return const JSString();
+ if (JS('bool', '# == "int"', int)) return const JSInt();
+ if (JS('bool', '# == "double"', int)) return const JSDouble();
+ if (JS('bool', '# == "num"', int)) return const JSNumber();
+ if (JS('bool', '# == "bool"', int)) return const JSBool();
+ if (JS('bool', '# == "List"', int)) return const JSArray();
// TODO(ahe): How to safely access $?
return JS('var', r'$[#]', className);
}

Powered by Google App Engine
This is Rietveld 408576698