| 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('../../../lib/compiler/compiler.dart', prefix: 'diagnostics'); | 7 #import('../../../lib/compiler/compiler.dart', prefix: 'diagnostics'); |
| 8 #import('../../../lib/compiler/implementation/elements/elements.dart'); | 8 #import('../../../lib/compiler/implementation/elements/elements.dart'); |
| 9 #import('../../../lib/compiler/implementation/apiimpl.dart', prefix: 'api'); | 9 #import('../../../lib/compiler/implementation/apiimpl.dart', prefix: 'api'); |
| 10 #import('../../../lib/compiler/implementation/scanner/scannerlib.dart'); | 10 #import('../../../lib/compiler/implementation/scanner/scannerlib.dart'); |
| 11 #import('../../../lib/compiler/implementation/leg.dart'); | 11 #import('../../../lib/compiler/implementation/leg.dart'); |
| 12 #import('../../../lib/compiler/implementation/filenames.dart'); | 12 #import('../../../lib/compiler/implementation/filenames.dart'); |
| 13 #import('../../../lib/compiler/implementation/source_file.dart'); | 13 #import('../../../lib/compiler/implementation/source_file.dart'); |
| 14 #import('../../../lib/compiler/implementation/tree/tree.dart'); | 14 #import('../../../lib/compiler/implementation/tree/tree.dart'); |
| 15 #import('../../../lib/compiler/implementation/util/util.dart'); | 15 #import('../../../lib/compiler/implementation/util/util.dart'); |
| 16 #import('../../../lib/compiler/implementation/util/uri_extras.dart'); | 16 #import('../../../lib/compiler/implementation/util/uri_extras.dart'); |
| 17 #import('../../../lib/compiler/implementation/dart2js.dart'); | 17 #import('../../../lib/compiler/implementation/dart2js.dart'); |
| 18 #import('../../../lib/compiler/implementation/ssa/ssa.dart'); | |
| 19 #import('mirrors.dart'); | 18 #import('mirrors.dart'); |
| 20 #import('util.dart'); | 19 #import('util.dart'); |
| 21 #import('dart:io'); | 20 #import('dart:io'); |
| 22 #import('dart:uri'); | 21 #import('dart:uri'); |
| 23 | 22 |
| 24 | 23 |
| 25 //------------------------------------------------------------------------------ | 24 //------------------------------------------------------------------------------ |
| 26 // Utility types and functions for the dart2js mirror system | 25 // Utility types and functions for the dart2js mirror system |
| 27 //------------------------------------------------------------------------------ | 26 //------------------------------------------------------------------------------ |
| 28 | 27 |
| (...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 _kind = Dart2JsMethodKind.SETTER; | 1227 _kind = Dart2JsMethodKind.SETTER; |
| 1229 _canonicalName = '$_name='; | 1228 _canonicalName = '$_name='; |
| 1230 } else if (_function.kind == ElementKind.GENERATIVE_CONSTRUCTOR) { | 1229 } else if (_function.kind == ElementKind.GENERATIVE_CONSTRUCTOR) { |
| 1231 _constructorName = ''; | 1230 _constructorName = ''; |
| 1232 int dollarPos = _name.indexOf('\$'); | 1231 int dollarPos = _name.indexOf('\$'); |
| 1233 if (dollarPos != -1) { | 1232 if (dollarPos != -1) { |
| 1234 _constructorName = _name.substring(dollarPos + 1); | 1233 _constructorName = _name.substring(dollarPos + 1); |
| 1235 _name = _name.substring(0, dollarPos); | 1234 _name = _name.substring(0, dollarPos); |
| 1236 // canonical name is TypeName.constructorName | 1235 // canonical name is TypeName.constructorName |
| 1237 _canonicalName = '$_name.$_constructorName'; | 1236 _canonicalName = '$_name.$_constructorName'; |
| 1238 } else if (_name == 'negate') { | |
| 1239 _operatorName = _name; | |
| 1240 _name = 'operator'; | |
| 1241 _kind = Dart2JsMethodKind.OPERATOR; | |
| 1242 // canonical name is 'operator operatorName' | |
| 1243 _canonicalName = 'operator $_operatorName'; | |
| 1244 } else if (_name.startsWith('operator\$')) { | |
| 1245 String str = _name.substring(9); | |
| 1246 _name = 'operator'; | |
| 1247 _kind = Dart2JsMethodKind.OPERATOR; | |
| 1248 _operatorName = _getOperatorFromOperatorName(str); | |
| 1249 // canonical name is 'operator operatorName' | |
| 1250 _canonicalName = 'operator $_operatorName'; | |
| 1251 } else { | 1237 } else { |
| 1252 // canonical name is TypeName | 1238 // canonical name is TypeName |
| 1253 _canonicalName = _name; | 1239 _canonicalName = _name; |
| 1254 } | 1240 } |
| 1255 if (_function.modifiers !== null && _function.modifiers.isConst()) { | 1241 if (_function.modifiers !== null && _function.modifiers.isConst()) { |
| 1256 _kind = Dart2JsMethodKind.CONST; | 1242 _kind = Dart2JsMethodKind.CONST; |
| 1257 } else { | 1243 } else { |
| 1258 _kind = Dart2JsMethodKind.CONSTRUCTOR; | 1244 _kind = Dart2JsMethodKind.CONSTRUCTOR; |
| 1259 } | 1245 } |
| 1260 } else if (_function.modifiers !== null && | 1246 } else if (_function.modifiers !== null && |
| 1261 _function.modifiers.isFactory()) { | 1247 _function.modifiers.isFactory()) { |
| 1262 _kind = Dart2JsMethodKind.FACTORY; | 1248 _kind = Dart2JsMethodKind.FACTORY; |
| 1263 _constructorName = ''; | 1249 _constructorName = ''; |
| 1264 int dollarPos = _name.indexOf('\$'); | 1250 int dollarPos = _name.indexOf('\$'); |
| 1265 if (dollarPos != -1) { | 1251 if (dollarPos != -1) { |
| 1266 _constructorName = _name.substring(dollarPos+1); | 1252 _constructorName = _name.substring(dollarPos+1); |
| 1267 _name = _name.substring(0, dollarPos); | 1253 _name = _name.substring(0, dollarPos); |
| 1268 } | 1254 } |
| 1269 // canonical name is TypeName.constructorName | 1255 // canonical name is TypeName.constructorName |
| 1270 _canonicalName = '$_name.$_constructorName'; | 1256 _canonicalName = '$_name.$_constructorName'; |
| 1257 } else if (_name == 'negate') { |
| 1258 _operatorName = _name; |
| 1259 _name = 'operator'; |
| 1260 _kind = Dart2JsMethodKind.OPERATOR; |
| 1261 // canonical name is 'operator operatorName' |
| 1262 _canonicalName = 'operator $_operatorName'; |
| 1271 } else if (_name.startsWith('operator\$')) { | 1263 } else if (_name.startsWith('operator\$')) { |
| 1272 String str = _name.substring(9); | 1264 String str = _name.substring(9); |
| 1273 _name = 'operator'; | 1265 _name = 'operator'; |
| 1274 _kind = Dart2JsMethodKind.OPERATOR; | 1266 _kind = Dart2JsMethodKind.OPERATOR; |
| 1275 _operatorName = _getOperatorFromOperatorName(str); | 1267 _operatorName = _getOperatorFromOperatorName(str); |
| 1276 // canonical name is 'operator operatorName' | 1268 // canonical name is 'operator operatorName' |
| 1277 _canonicalName = 'operator $_operatorName'; | 1269 _canonicalName = 'operator $_operatorName'; |
| 1278 } else { | 1270 } else { |
| 1279 _kind = Dart2JsMethodKind.NORMAL; | 1271 _kind = Dart2JsMethodKind.NORMAL; |
| 1280 _canonicalName = _name; | 1272 _canonicalName = _name; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1389 if (node !== null) { | 1381 if (node !== null) { |
| 1390 var span = system.compiler.spanFromNode(node, script.uri); | 1382 var span = system.compiler.spanFromNode(node, script.uri); |
| 1391 return new Dart2JsLocation(script, span); | 1383 return new Dart2JsLocation(script, span); |
| 1392 } else { | 1384 } else { |
| 1393 var span = system.compiler.spanFromElement(_variable); | 1385 var span = system.compiler.spanFromElement(_variable); |
| 1394 return new Dart2JsLocation(script, span); | 1386 return new Dart2JsLocation(script, span); |
| 1395 } | 1387 } |
| 1396 } | 1388 } |
| 1397 } | 1389 } |
| 1398 | 1390 |
| OLD | NEW |