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

Side by Side Diff: sdk/lib/_internal/compiler/js_lib/js_mirrors.dart

Issue 1198293002: dart2js: Use an abstract Name class for names in the generated JavaScript ast. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix tests Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart._js_mirrors; 5 library dart._js_mirrors;
6 6
7 import 'dart:_js_embedded_names' show 7 import 'dart:_js_embedded_names' show
8 JsGetName, 8 JsGetName,
9 ALL_CLASSES, 9 ALL_CLASSES,
10 LAZIES, 10 LAZIES,
(...skipping 1966 matching lines...) Expand 10 before | Expand all | Expand 10 after
1977 1977
1978 ClassMirror get superclass { 1978 ClassMirror get superclass {
1979 if (_superclass == null) { 1979 if (_superclass == null) {
1980 var typeInformationContainer = JS_EMBEDDED_GLOBAL('', TYPE_INFORMATION); 1980 var typeInformationContainer = JS_EMBEDDED_GLOBAL('', TYPE_INFORMATION);
1981 List<int> typeInformation = 1981 List<int> typeInformation =
1982 JS('List|Null', '#[#]', typeInformationContainer, _mangledName); 1982 JS('List|Null', '#[#]', typeInformationContainer, _mangledName);
1983 if (typeInformation != null) { 1983 if (typeInformation != null) {
1984 var type = getType(typeInformation[0]); 1984 var type = getType(typeInformation[0]);
1985 _superclass = typeMirrorFromRuntimeTypeRepresentation(this, type); 1985 _superclass = typeMirrorFromRuntimeTypeRepresentation(this, type);
1986 } else { 1986 } else {
1987 var superclassName = _fieldsDescriptor.split(';')[0]; 1987 var superclassName = _fieldsDescriptor.split(';')[0].split(':')[0];
1988 // TODO(zarah): Remove special handing of mixins. 1988 // TODO(zarah): Remove special handing of mixins.
1989 var mixins = superclassName.split('+'); 1989 var mixins = superclassName.split('+');
1990 if (mixins.length > 1) { 1990 if (mixins.length > 1) {
1991 if (mixins.length != 2) { 1991 if (mixins.length != 2) {
1992 throw new RuntimeError('Strange mixin: $_fieldsDescriptor'); 1992 throw new RuntimeError('Strange mixin: $_fieldsDescriptor');
1993 } 1993 }
1994 _superclass = reflectClassByMangledName(mixins[0]); 1994 _superclass = reflectClassByMangledName(mixins[0]);
1995 } else { 1995 } else {
1996 // Use _superclass == this to represent class with no superclass 1996 // Use _superclass == this to represent class with no superclass
1997 // (Object). 1997 // (Object).
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
3046 // have a part (following a '.') that starts with '_'. 3046 // have a part (following a '.') that starts with '_'.
3047 const int UNDERSCORE = 0x5f; 3047 const int UNDERSCORE = 0x5f;
3048 if (name.isEmpty) return true; 3048 if (name.isEmpty) return true;
3049 int index = -1; 3049 int index = -1;
3050 do { 3050 do {
3051 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false; 3051 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false;
3052 index = name.indexOf('.', index + 1); 3052 index = name.indexOf('.', index + 1);
3053 } while (index >= 0 && index + 1 < name.length); 3053 } while (index >= 0 && index + 1 < name.length);
3054 return true; 3054 return true;
3055 } 3055 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698