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

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

Issue 11417005: Do not canonicalize Type instances. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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/lib/js_helper.dart
diff --git a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
index 6dae54a419aa7bc9389316cf0fd57520654e820c..f0d2760394be6d17e6866f021ad37e26f61c5065 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
@@ -2,15 +2,15 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#library('dart:_js_helper');
+library org_dartlang_js_helper;
-#import('dart:collection');
+import 'dart:collection';
-#source('constant_map.dart');
-#source('native_helper.dart');
-#source('regexp_helper.dart');
-#source('string_helper.dart');
-#source('mirror_opt_in_message.dart');
+part 'constant_map.dart';
+part 'native_helper.dart';
+part 'regexp_helper.dart';
+part 'string_helper.dart';
+part 'mirror_opt_in_message.dart';
// Performance critical helper methods.
add(var a, var b) => (a is num && b is num)
@@ -1466,20 +1466,15 @@ class TypeImpl implements Type {
final String typeName;
TypeImpl(this.typeName);
toString() => typeName;
-}
-
-var runtimeTypeCache = JS('var', '{}');
-
-Type getOrCreateCachedRuntimeType(String key) {
- Type result = JS('Type', r'#[#]', runtimeTypeCache, key);
- if (result == null) {
- result = new TypeImpl(key);
- JS('var', r'#[#] = #', runtimeTypeCache, key, result);
+ bool operator ==(other) {
+ if (other is !TypeImpl) return false;
+ return typeName == other.typeName;
}
- return result;
}
String getRuntimeTypeString(var object) {
var typeInfo = JS('Object', r'#.builtin$typeInfo', object);
return JS('String', r'#.runtimeType', typeInfo);
}
+
+createRuntimeType(String name) => new TypeImpl(name);

Powered by Google App Engine
This is Rietveld 408576698