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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
672 objectClass = lookupCoreClass('Object'); | 673 objectClass = lookupCoreClass('Object'); |
673 boolClass = lookupCoreClass('bool'); | 674 boolClass = lookupCoreClass('bool'); |
674 numClass = lookupCoreClass('num'); | 675 numClass = lookupCoreClass('num'); |
675 intClass = lookupCoreClass('int'); | 676 intClass = lookupCoreClass('int'); |
676 doubleClass = lookupCoreClass('double'); | 677 doubleClass = lookupCoreClass('double'); |
677 stringClass = lookupCoreClass('String'); | 678 stringClass = lookupCoreClass('String'); |
678 functionClass = lookupCoreClass('Function'); | 679 functionClass = lookupCoreClass('Function'); |
679 listClass = lookupCoreClass('List'); | 680 listClass = lookupCoreClass('List'); |
680 typeClass = lookupCoreClass('Type'); | 681 typeClass = lookupCoreClass('Type'); |
681 mapClass = lookupCoreClass('Map'); | 682 mapClass = lookupCoreClass('Map'); |
683 stackTraceClass = lookupCoreClass('StackTrace'); | |
682 if (!missingCoreClasses.isEmpty) { | 684 if (!missingCoreClasses.isEmpty) { |
683 internalErrorOnElement(coreLibrary, | 685 internalErrorOnElement(coreLibrary, |
684 'dart:core library does not contain required classes: ' | 686 'dart:core library does not contain required classes: ' |
685 '$missingCoreClasses'); | 687 '$missingCoreClasses'); |
686 } | 688 } |
687 | 689 |
688 // The Symbol class may not exist during unit testing. | 690 // The Symbol class may not exist during unit testing. |
689 // TODO(ahe): It is possible that we have to require the presence | 691 // TODO(ahe): It is possible that we have to require the presence |
690 // of Symbol as we change how we implement noSuchMethod. | 692 // of Symbol as we change how we implement noSuchMethod. |
691 symbolClass = lookupCoreClass('Symbol'); | 693 symbolClass = lookupCoreClass('Symbol'); |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1101 } | 1103 } |
1102 | 1104 |
1103 SourceSpan spanFromNode(Node node, [Uri uri]) { | 1105 SourceSpan spanFromNode(Node node, [Uri uri]) { |
1104 return spanFromTokens(node.getBeginToken(), node.getEndToken(), uri); | 1106 return spanFromTokens(node.getBeginToken(), node.getEndToken(), uri); |
1105 } | 1107 } |
1106 | 1108 |
1107 SourceSpan spanFromElement(Element element) { | 1109 SourceSpan spanFromElement(Element element) { |
1108 if (Elements.isErroneousElement(element)) { | 1110 if (Elements.isErroneousElement(element)) { |
1109 element = element.enclosingElement; | 1111 element = element.enclosingElement; |
1110 } | 1112 } |
1111 if (element.position() == null && !element.isCompilationUnit()) { | 1113 if (element.position() == null && |
1114 !(element.isLibrary() || element.isCompilationUnit())) { | |
karlklose
2013/05/27 08:45:22
I think
!element.isLibrary() && !element.i
Johnni Winther
2013/05/27 11:01:23
Done.
| |
1112 // Sometimes, the backend fakes up elements that have no | 1115 // Sometimes, the backend fakes up elements that have no |
1113 // position. So we use the enclosing element instead. It is | 1116 // position. So we use the enclosing element instead. It is |
1114 // not a good error location, but cancel really is "internal | 1117 // not a good error location, but cancel really is "internal |
1115 // error" or "not implemented yet", so the vicinity is good | 1118 // error" or "not implemented yet", so the vicinity is good |
1116 // enough for now. | 1119 // enough for now. |
1117 element = element.enclosingElement; | 1120 element = element.enclosingElement; |
1118 // TODO(ahe): I plan to overhaul this infrastructure anyways. | 1121 // TODO(ahe): I plan to overhaul this infrastructure anyways. |
1119 } | 1122 } |
1120 if (element == null) { | 1123 if (element == null) { |
1121 element = currentElement; | 1124 element = currentElement; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1327 | 1330 |
1328 void close() {} | 1331 void close() {} |
1329 | 1332 |
1330 toString() => name; | 1333 toString() => name; |
1331 | 1334 |
1332 /// Convenience method for getting an [api.CompilerOutputProvider]. | 1335 /// Convenience method for getting an [api.CompilerOutputProvider]. |
1333 static NullSink outputProvider(String name, String extension) { | 1336 static NullSink outputProvider(String name, String extension) { |
1334 return new NullSink('$name.$extension'); | 1337 return new NullSink('$name.$extension'); |
1335 } | 1338 } |
1336 } | 1339 } |
OLD | NEW |