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

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

Issue 804423003: dart2js: Change typedef encoding. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add comment. Created 6 years 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/js_lib/js_mirrors.dart
diff --git a/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart b/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
index bb1674941751ac9f9769bc744e8e267ed504df7b..9d55eed28348cf7dd64e65e45d9317e3d6dd0ed6 100644
--- a/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
+++ b/sdk/lib/_internal/compiler/js_lib/js_mirrors.dart
@@ -4,13 +4,14 @@
library dart._js_mirrors;
-import 'dart:_js_runtime_data' as encoding;
import 'dart:_js_embedded_names' show
ALL_CLASSES,
LAZIES,
LIBRARIES,
STATICS,
- TYPE_INFORMATION;
+ TYPE_INFORMATION,
+ TYPEDEF_PREDICATE_PROPERTY_NAME,
+ TYPEDEF_TYPE_PROPERTY_NAME;
import 'dart:collection' show
UnmodifiableListView,
@@ -634,6 +635,19 @@ TypeMirror reflectClassByName(Symbol symbol, String mangledName) {
if (descriptor == null) {
// This is a native class, or an intercepted class.
// TODO(ahe): Preserve descriptor for such classes.
+ } else if (JS('bool', '# in #',
+ TYPEDEF_PREDICATE_PROPERTY_NAME, descriptor)) {
+ // Typedefs are represented as normal classes with two special properties:
+ // TYPEDEF_PREDICATE_PROPERTY_NAME and TYPEDEF_TYPE_PROPERTY_NAME.
+ // For example:
+ // MyTypedef: {
+ // "^": "Object;",
+ // $typedefType: 58,
+ // $$isTypedef: true
+ // }
+ // The typedefType is the index into the metadata table.
+ int index = JS('int', '#[#]', descriptor, TYPEDEF_TYPE_PROPERTY_NAME);
+ mirror = new JsTypedefMirror(symbol, mangledName, getMetadata(index));
} else {
fields = JS('', '#[#]', descriptor,
JS_GET_NAME('CLASS_DESCRIPTOR_PROPERTY'));
@@ -648,10 +662,7 @@ TypeMirror reflectClassByName(Symbol symbol, String mangledName) {
}
}
- if (encoding.isTypedefDescriptor(fields)) {
- int index = encoding.getTypeFromTypedef(fields);
- mirror = new JsTypedefMirror(symbol, mangledName, getMetadata(index));
- } else {
+ if (mirror == null) {
var superclassName = fields.split(';')[0];
var mixins = superclassName.split('+');
if (mixins.length > 1 && mangledGlobalNames[mangledName] == null) {
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart ('k') | sdk/lib/_internal/compiler/js_lib/shared/embedded_names.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698