| 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 part of dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * If true, print a warning for each method that was resolved, but not | 8 * If true, print a warning for each method that was resolved, but not |
| 9 * compiled. | 9 * compiled. |
| 10 */ | 10 */ |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 ClassElement numClass; | 311 ClassElement numClass; |
| 312 ClassElement intClass; | 312 ClassElement intClass; |
| 313 ClassElement doubleClass; | 313 ClassElement doubleClass; |
| 314 ClassElement stringClass; | 314 ClassElement stringClass; |
| 315 ClassElement functionClass; | 315 ClassElement functionClass; |
| 316 ClassElement nullClass; | 316 ClassElement nullClass; |
| 317 ClassElement listClass; | 317 ClassElement listClass; |
| 318 ClassElement typeClass; | 318 ClassElement typeClass; |
| 319 ClassElement mapClass; | 319 ClassElement mapClass; |
| 320 ClassElement symbolClass; | 320 ClassElement symbolClass; |
| 321 ClassElement stackTraceClass; |
| 321 | 322 |
| 322 // Initialized after mirrorSystemClass has been resolved. | 323 // Initialized after mirrorSystemClass has been resolved. |
| 323 FunctionElement symbolConstructor; | 324 FunctionElement symbolConstructor; |
| 324 | 325 |
| 325 // Initialized when dart:mirrors is loaded. | 326 // Initialized when dart:mirrors is loaded. |
| 326 ClassElement mirrorSystemClass; | 327 ClassElement mirrorSystemClass; |
| 327 | 328 |
| 328 // Initialized after mirrorSystemClass has been resolved. | 329 // Initialized after mirrorSystemClass has been resolved. |
| 329 FunctionElement mirrorSystemGetNameFunction; | 330 FunctionElement mirrorSystemGetNameFunction; |
| 330 | 331 |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 objectClass = lookupCoreClass('Object'); | 674 objectClass = lookupCoreClass('Object'); |
| 674 boolClass = lookupCoreClass('bool'); | 675 boolClass = lookupCoreClass('bool'); |
| 675 numClass = lookupCoreClass('num'); | 676 numClass = lookupCoreClass('num'); |
| 676 intClass = lookupCoreClass('int'); | 677 intClass = lookupCoreClass('int'); |
| 677 doubleClass = lookupCoreClass('double'); | 678 doubleClass = lookupCoreClass('double'); |
| 678 stringClass = lookupCoreClass('String'); | 679 stringClass = lookupCoreClass('String'); |
| 679 functionClass = lookupCoreClass('Function'); | 680 functionClass = lookupCoreClass('Function'); |
| 680 listClass = lookupCoreClass('List'); | 681 listClass = lookupCoreClass('List'); |
| 681 typeClass = lookupCoreClass('Type'); | 682 typeClass = lookupCoreClass('Type'); |
| 682 mapClass = lookupCoreClass('Map'); | 683 mapClass = lookupCoreClass('Map'); |
| 684 stackTraceClass = lookupCoreClass('StackTrace'); |
| 683 if (!missingCoreClasses.isEmpty) { | 685 if (!missingCoreClasses.isEmpty) { |
| 684 internalErrorOnElement(coreLibrary, | 686 internalErrorOnElement(coreLibrary, |
| 685 'dart:core library does not contain required classes: ' | 687 'dart:core library does not contain required classes: ' |
| 686 '$missingCoreClasses'); | 688 '$missingCoreClasses'); |
| 687 } | 689 } |
| 688 | 690 |
| 689 // The Symbol class may not exist during unit testing. | 691 // The Symbol class may not exist during unit testing. |
| 690 // TODO(ahe): It is possible that we have to require the presence | 692 // TODO(ahe): It is possible that we have to require the presence |
| 691 // of Symbol as we change how we implement noSuchMethod. | 693 // of Symbol as we change how we implement noSuchMethod. |
| 692 symbolClass = lookupCoreClass('Symbol'); | 694 symbolClass = lookupCoreClass('Symbol'); |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1102 } | 1104 } |
| 1103 | 1105 |
| 1104 SourceSpan spanFromNode(Node node, [Uri uri]) { | 1106 SourceSpan spanFromNode(Node node, [Uri uri]) { |
| 1105 return spanFromTokens(node.getBeginToken(), node.getEndToken(), uri); | 1107 return spanFromTokens(node.getBeginToken(), node.getEndToken(), uri); |
| 1106 } | 1108 } |
| 1107 | 1109 |
| 1108 SourceSpan spanFromElement(Element element) { | 1110 SourceSpan spanFromElement(Element element) { |
| 1109 if (Elements.isErroneousElement(element)) { | 1111 if (Elements.isErroneousElement(element)) { |
| 1110 element = element.enclosingElement; | 1112 element = element.enclosingElement; |
| 1111 } | 1113 } |
| 1112 if (element.position() == null && !element.isCompilationUnit()) { | 1114 if (element.position() == null && |
| 1115 !element.isLibrary() && |
| 1116 !element.isCompilationUnit()) { |
| 1113 // Sometimes, the backend fakes up elements that have no | 1117 // Sometimes, the backend fakes up elements that have no |
| 1114 // position. So we use the enclosing element instead. It is | 1118 // position. So we use the enclosing element instead. It is |
| 1115 // not a good error location, but cancel really is "internal | 1119 // not a good error location, but cancel really is "internal |
| 1116 // error" or "not implemented yet", so the vicinity is good | 1120 // error" or "not implemented yet", so the vicinity is good |
| 1117 // enough for now. | 1121 // enough for now. |
| 1118 element = element.enclosingElement; | 1122 element = element.enclosingElement; |
| 1119 // TODO(ahe): I plan to overhaul this infrastructure anyways. | 1123 // TODO(ahe): I plan to overhaul this infrastructure anyways. |
| 1120 } | 1124 } |
| 1121 if (element == null) { | 1125 if (element == null) { |
| 1122 element = currentElement; | 1126 element = currentElement; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 | 1332 |
| 1329 void close() {} | 1333 void close() {} |
| 1330 | 1334 |
| 1331 toString() => name; | 1335 toString() => name; |
| 1332 | 1336 |
| 1333 /// Convenience method for getting an [api.CompilerOutputProvider]. | 1337 /// Convenience method for getting an [api.CompilerOutputProvider]. |
| 1334 static NullSink outputProvider(String name, String extension) { | 1338 static NullSink outputProvider(String name, String extension) { |
| 1335 return new NullSink('$name.$extension'); | 1339 return new NullSink('$name.$extension'); |
| 1336 } | 1340 } |
| 1337 } | 1341 } |
| OLD | NEW |