| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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('mirrors.dart2js'); | 5 #library('mirrors.dart2js'); |
| 6 | 6 |
| 7 #import('dart:io'); | 7 #import('dart:io'); |
| 8 #import('dart:uri'); | 8 #import('dart:uri'); |
| 9 | 9 |
| 10 #import('../../../../../lib/compiler/compiler.dart', prefix: 'diagnostics'); | 10 #import('../../../../../lib/compiler/compiler.dart', prefix: 'diagnostics'); |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 map[type.canonicalName] = type; | 747 map[type.canonicalName] = type; |
| 748 link = link.tail; | 748 link = link.tail; |
| 749 } | 749 } |
| 750 return new ImmutableMapWrapper<Object, InterfaceMirror>(map); | 750 return new ImmutableMapWrapper<Object, InterfaceMirror>(map); |
| 751 } | 751 } |
| 752 | 752 |
| 753 bool get isClass => !_class.isInterface(); | 753 bool get isClass => !_class.isInterface(); |
| 754 | 754 |
| 755 bool get isInterface => _class.isInterface(); | 755 bool get isInterface => _class.isInterface(); |
| 756 | 756 |
| 757 bool get isAbstract => | 757 bool get isAbstract => _class.modifiers.isAbstract(); |
| 758 _class.modifiers !== null && _class.modifiers.isAbstract(); | |
| 759 | 758 |
| 760 bool get isPrivate => _isPrivate(simpleName); | 759 bool get isPrivate => _isPrivate(simpleName); |
| 761 | 760 |
| 762 bool get isDeclaration => true; | 761 bool get isDeclaration => true; |
| 763 | 762 |
| 764 List<TypeMirror> get typeArguments { | 763 List<TypeMirror> get typeArguments { |
| 765 throw new UnsupportedOperationException( | 764 throw new UnsupportedOperationException( |
| 766 'Declarations do not have type arguments'); | 765 'Declarations do not have type arguments'); |
| 767 } | 766 } |
| 768 | 767 |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 int dollarPos = _name.indexOf('\$'); | 1245 int dollarPos = _name.indexOf('\$'); |
| 1247 if (dollarPos != -1) { | 1246 if (dollarPos != -1) { |
| 1248 _constructorName = _name.substring(dollarPos + 1); | 1247 _constructorName = _name.substring(dollarPos + 1); |
| 1249 _name = _name.substring(0, dollarPos); | 1248 _name = _name.substring(0, dollarPos); |
| 1250 // canonical name is TypeName.constructorName | 1249 // canonical name is TypeName.constructorName |
| 1251 _canonicalName = '$_name.$_constructorName'; | 1250 _canonicalName = '$_name.$_constructorName'; |
| 1252 } else { | 1251 } else { |
| 1253 // canonical name is TypeName | 1252 // canonical name is TypeName |
| 1254 _canonicalName = _name; | 1253 _canonicalName = _name; |
| 1255 } | 1254 } |
| 1256 if (_function.modifiers !== null && _function.modifiers.isConst()) { | 1255 if (_function.modifiers.isConst()) { |
| 1257 _kind = Dart2JsMethodKind.CONST; | 1256 _kind = Dart2JsMethodKind.CONST; |
| 1258 } else { | 1257 } else { |
| 1259 _kind = Dart2JsMethodKind.CONSTRUCTOR; | 1258 _kind = Dart2JsMethodKind.CONSTRUCTOR; |
| 1260 } | 1259 } |
| 1261 } else if (_function.modifiers !== null && | 1260 } else if (_function.modifiers.isFactory()) { |
| 1262 _function.modifiers.isFactory()) { | |
| 1263 _kind = Dart2JsMethodKind.FACTORY; | 1261 _kind = Dart2JsMethodKind.FACTORY; |
| 1264 _constructorName = ''; | 1262 _constructorName = ''; |
| 1265 int dollarPos = _name.indexOf('\$'); | 1263 int dollarPos = _name.indexOf('\$'); |
| 1266 if (dollarPos != -1) { | 1264 if (dollarPos != -1) { |
| 1267 _constructorName = _name.substring(dollarPos+1); | 1265 _constructorName = _name.substring(dollarPos+1); |
| 1268 _name = _name.substring(0, dollarPos); | 1266 _name = _name.substring(0, dollarPos); |
| 1269 } | 1267 } |
| 1270 // canonical name is TypeName.constructorName | 1268 // canonical name is TypeName.constructorName |
| 1271 _canonicalName = '$_name.$_constructorName'; | 1269 _canonicalName = '$_name.$_constructorName'; |
| 1272 } else if (_name == 'negate') { | 1270 } else if (_name == 'negate') { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1303 | 1301 |
| 1304 bool get isConstructor | 1302 bool get isConstructor |
| 1305 => _kind == Dart2JsMethodKind.CONSTRUCTOR || isConst || isFactory; | 1303 => _kind == Dart2JsMethodKind.CONSTRUCTOR || isConst || isFactory; |
| 1306 | 1304 |
| 1307 bool get isField => false; | 1305 bool get isField => false; |
| 1308 | 1306 |
| 1309 bool get isMethod => !isConstructor; | 1307 bool get isMethod => !isConstructor; |
| 1310 | 1308 |
| 1311 bool get isPrivate => _isPrivate(simpleName); | 1309 bool get isPrivate => _isPrivate(simpleName); |
| 1312 | 1310 |
| 1313 bool get isStatic => | 1311 bool get isStatic => _function.modifiers.isStatic(); |
| 1314 _function.modifiers !== null && _function.modifiers.isStatic(); | |
| 1315 | 1312 |
| 1316 List<ParameterMirror> get parameters { | 1313 List<ParameterMirror> get parameters { |
| 1317 return _parametersFromFunctionSignature(system, this, | 1314 return _parametersFromFunctionSignature(system, this, |
| 1318 _function.computeSignature(system.compiler)); | 1315 _function.computeSignature(system.compiler)); |
| 1319 } | 1316 } |
| 1320 | 1317 |
| 1321 TypeMirror get returnType => _convertTypeToTypeMirror( | 1318 TypeMirror get returnType => _convertTypeToTypeMirror( |
| 1322 system, _function.computeSignature(system.compiler).returnType, | 1319 system, _function.computeSignature(system.compiler).returnType, |
| 1323 system.compiler.types.dynamicType); | 1320 system.compiler.types.dynamicType); |
| 1324 | 1321 |
| 1325 bool get isAbstract => | 1322 bool get isAbstract => _function.modifiers.isAbstract(); |
| 1326 _function.modifiers !== null && _function.modifiers.isAbstract(); | |
| 1327 | 1323 |
| 1328 bool get isConst => _kind == Dart2JsMethodKind.CONST; | 1324 bool get isConst => _kind == Dart2JsMethodKind.CONST; |
| 1329 | 1325 |
| 1330 bool get isFactory => _kind == Dart2JsMethodKind.FACTORY; | 1326 bool get isFactory => _kind == Dart2JsMethodKind.FACTORY; |
| 1331 | 1327 |
| 1332 String get constructorName => _constructorName; | 1328 String get constructorName => _constructorName; |
| 1333 | 1329 |
| 1334 bool get isGetter => _kind == Dart2JsMethodKind.GETTER; | 1330 bool get isGetter => _kind == Dart2JsMethodKind.GETTER; |
| 1335 | 1331 |
| 1336 bool get isSetter => _kind == Dart2JsMethodKind.SETTER; | 1332 bool get isSetter => _kind == Dart2JsMethodKind.SETTER; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1399 if (node !== null) { | 1395 if (node !== null) { |
| 1400 var span = system.compiler.spanFromNode(node, script.uri); | 1396 var span = system.compiler.spanFromNode(node, script.uri); |
| 1401 return new Dart2JsLocation(script, span); | 1397 return new Dart2JsLocation(script, span); |
| 1402 } else { | 1398 } else { |
| 1403 var span = system.compiler.spanFromElement(_variable); | 1399 var span = system.compiler.spanFromElement(_variable); |
| 1404 return new Dart2JsLocation(script, span); | 1400 return new Dart2JsLocation(script, span); |
| 1405 } | 1401 } |
| 1406 } | 1402 } |
| 1407 } | 1403 } |
| 1408 | 1404 |
| OLD | NEW |