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

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: 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..e2e9e83dfb9e04f24c78c3fd99cf2dd69317f7b6 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
@@ -636,12 +636,26 @@ 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 = getNativeName(element);
+ return name != null ? name : getName(element);
+ }
+
+ String getNativeName(ClassElement 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 {
- return getName(element);
+ } else if (cls == backend.jsStringClass) {
+ return 'String';
+ } else if (cls == backend.jsArrayClass) {
+ return 'List';
}
}

Powered by Google App Engine
This is Rietveld 408576698