OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |