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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/namer.dart

Issue 14018036: Remove holders for runtime type information. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix type annotation. Created 7 years, 8 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/implementation/js_backend/namer.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart b/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
index 3a60f41ebf84c907dcb19a17fc5c6c04ae5bce93..ea9a82f110ef39e1c2f8b088d15a442399386c75 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
@@ -636,12 +636,32 @@ class Namer implements ClosureNamer {
/// Returns the runtime name for [element]. The result is not safe as an id.
String getRuntimeTypeName(Element element) {
- if (element == compiler.intClass) {
+ JavaScriptBackend backend = compiler.backend;
+ element = backend.getImplementationClass(element);
+ String name = getPrimitiveInterceptorRuntimeName(element);
+ return name != null ? name : getName(element);
+ }
+
+ /**
+ * Return a string to be used as the runtime name of this class (instead of
+ * the class name) or [null] if the class name should be used.
+ */
+ String getPrimitiveInterceptorRuntimeName(Element cls) {
+ JavaScriptBackend backend = compiler.backend;
+ if (cls == backend.jsIntClass) {
return 'int';
- } else if (element == compiler.doubleClass) {
+ } else if (cls == backend.jsNumberClass) {
+ return 'num';
+ } else if (cls == backend.jsBoolClass) {
+ return 'bool';
+ } else if (cls == backend.jsDoubleClass) {
return 'double';
+ } else if (cls == backend.jsStringClass) {
+ return 'String';
+ } else if (cls == backend.jsArrayClass) {
+ return 'List';
} else {
- return getName(element);
+ return null;
}
}

Powered by Google App Engine
This is Rietveld 408576698