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 dart2js.compiler_base; | 5 library dart2js.compiler_base; |
6 | 6 |
7 import 'dart:async' show | 7 import 'dart:async' show |
8 EventSink, | 8 EventSink, |
9 Future; | 9 Future; |
10 | 10 |
11 import '../compiler_new.dart' as api; | 11 import '../compiler_new.dart' as api; |
12 import 'cache_strategy.dart' show | 12 import 'cache_strategy.dart' show |
13 CacheStrategy; | 13 CacheStrategy; |
14 import 'closure.dart' as closureMapping show | 14 import 'closure.dart' as closureMapping show |
15 ClosureTask; | 15 ClosureTask; |
16 import 'common/backend_api.dart' show | 16 import 'common/backend_api.dart' show |
17 Backend; | 17 Backend; |
18 import 'common/codegen.dart' show | 18 import 'common/codegen.dart' show |
19 CodegenRegistry, | 19 CodegenRegistry, |
20 CodegenWorkItem; | 20 CodegenWorkItem; |
21 import 'common/names.dart' show | 21 import 'common/names.dart' show |
22 Identifiers, | 22 Identifiers, |
23 Uris; | 23 Uris; |
24 import 'common/registry.dart' show | 24 import 'common/registry.dart' show |
25 Registry; | 25 Registry; |
26 import 'common/resolution.dart' show | 26 import 'common/resolution.dart' show |
27 Parsing, | 27 Parsing, |
28 Resolution, | 28 Resolution, |
29 ResolutionWorkItem, | 29 ResolutionWorkItem; |
30 ResolutionWorldImpact; | |
31 import 'common/tasks.dart' show | 30 import 'common/tasks.dart' show |
32 CompilerTask, | 31 CompilerTask, |
33 GenericTask; | 32 GenericTask; |
34 import 'common/work.dart' show | 33 import 'common/work.dart' show |
35 WorkItem; | 34 WorkItem; |
36 import 'compile_time_constants.dart'; | 35 import 'compile_time_constants.dart'; |
37 import 'constants/values.dart'; | 36 import 'constants/values.dart'; |
38 import 'core_types.dart' show | 37 import 'core_types.dart' show |
39 CoreTypes; | 38 CoreTypes; |
40 import 'dart_backend/dart_backend.dart' as dart_backend; | 39 import 'dart_backend/dart_backend.dart' as dart_backend; |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 .then((LibraryElement libraryElement) { | 762 .then((LibraryElement libraryElement) { |
764 documentClass = libraryElement.find('Comment'); | 763 documentClass = libraryElement.find('Comment'); |
765 }); | 764 }); |
766 } | 765 } |
767 }).then((_) => backend.onLibrariesLoaded(loadedLibraries)); | 766 }).then((_) => backend.onLibrariesLoaded(loadedLibraries)); |
768 } | 767 } |
769 | 768 |
770 bool isProxyConstant(ConstantValue value) { | 769 bool isProxyConstant(ConstantValue value) { |
771 FieldElement field = coreLibrary.find('proxy'); | 770 FieldElement field = coreLibrary.find('proxy'); |
772 if (field == null) return false; | 771 if (field == null) return false; |
773 if (!resolution.hasBeenResolved(field)) return false; | 772 if (!enqueuer.resolution.hasBeenResolved(field)) return false; |
774 if (proxyConstant == null) { | 773 if (proxyConstant == null) { |
775 proxyConstant = | 774 proxyConstant = |
776 constants.getConstantValue( | 775 constants.getConstantValue( |
777 resolver.constantCompiler.compileConstant(field)); | 776 resolver.constantCompiler.compileConstant(field)); |
778 } | 777 } |
779 return proxyConstant == value; | 778 return proxyConstant == value; |
780 } | 779 } |
781 | 780 |
782 Element findRequiredElement(LibraryElement library, String name) { | 781 Element findRequiredElement(LibraryElement library, String name) { |
783 var element = library.find(name); | 782 var element = library.find(name); |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 * processing the queues). Also compute the number of methods that | 1153 * processing the queues). Also compute the number of methods that |
1155 * were resolved, but not compiled (aka excess resolution). | 1154 * were resolved, but not compiled (aka excess resolution). |
1156 */ | 1155 */ |
1157 checkQueues() { | 1156 checkQueues() { |
1158 for (Enqueuer world in [enqueuer.resolution, enqueuer.codegen]) { | 1157 for (Enqueuer world in [enqueuer.resolution, enqueuer.codegen]) { |
1159 world.forEach((WorkItem work) { | 1158 world.forEach((WorkItem work) { |
1160 reporter.internalError(work.element, "Work list is not empty."); | 1159 reporter.internalError(work.element, "Work list is not empty."); |
1161 }); | 1160 }); |
1162 } | 1161 } |
1163 if (!REPORT_EXCESS_RESOLUTION) return; | 1162 if (!REPORT_EXCESS_RESOLUTION) return; |
1164 var resolved = new Set.from(enqueuer.resolution.processedElements); | 1163 var resolved = new Set.from(enqueuer.resolution.resolvedElements); |
1165 for (Element e in enqueuer.codegen.generatedCode.keys) { | 1164 for (Element e in enqueuer.codegen.generatedCode.keys) { |
1166 resolved.remove(e); | 1165 resolved.remove(e); |
1167 } | 1166 } |
1168 for (Element e in new Set.from(resolved)) { | 1167 for (Element e in new Set.from(resolved)) { |
1169 if (e.isClass || | 1168 if (e.isClass || |
1170 e.isField || | 1169 e.isField || |
1171 e.isTypeVariable || | 1170 e.isTypeVariable || |
1172 e.isTypedef || | 1171 e.isTypedef || |
1173 identical(e.kind, ElementKind.ABSTRACT_FIELD)) { | 1172 identical(e.kind, ElementKind.ABSTRACT_FIELD)) { |
1174 resolved.remove(e); | 1173 resolved.remove(e); |
1175 } | 1174 } |
1176 if (identical(e.kind, ElementKind.GENERATIVE_CONSTRUCTOR)) { | 1175 if (identical(e.kind, ElementKind.GENERATIVE_CONSTRUCTOR)) { |
1177 resolved.remove(e); | 1176 resolved.remove(e); |
1178 } | 1177 } |
1179 if (backend.isBackendLibrary(e.library)) { | 1178 if (backend.isBackendLibrary(e.library)) { |
1180 resolved.remove(e); | 1179 resolved.remove(e); |
1181 } | 1180 } |
1182 } | 1181 } |
1183 reporter.log('Excess resolution work: ${resolved.length}.'); | 1182 reporter.log('Excess resolution work: ${resolved.length}.'); |
1184 for (Element e in resolved) { | 1183 for (Element e in resolved) { |
1185 reporter.reportWarningMessage(e, | 1184 reporter.reportWarningMessage(e, |
1186 MessageKind.GENERIC, | 1185 MessageKind.GENERIC, |
1187 {'text': 'Warning: $e resolved but not compiled.'}); | 1186 {'text': 'Warning: $e resolved but not compiled.'}); |
1188 } | 1187 } |
1189 } | 1188 } |
1190 | 1189 |
1191 ResolutionWorldImpact analyzeElement(Element element) { | 1190 WorldImpact analyzeElement(Element element) { |
1192 assert(invariant(element, | 1191 assert(invariant(element, |
1193 element.impliesType || | 1192 element.impliesType || |
1194 element.isField || | 1193 element.isField || |
1195 element.isFunction || | 1194 element.isFunction || |
1196 element.isGenerativeConstructor || | 1195 element.isGenerativeConstructor || |
1197 element.isGetter || | 1196 element.isGetter || |
1198 element.isSetter, | 1197 element.isSetter, |
1199 message: 'Unexpected element kind: ${element.kind}')); | 1198 message: 'Unexpected element kind: ${element.kind}')); |
1200 assert(invariant(element, element is AnalyzableElement, | 1199 assert(invariant(element, element is AnalyzableElement, |
1201 message: 'Element $element is not analyzable.')); | 1200 message: 'Element $element is not analyzable.')); |
1202 assert(invariant(element, element.isDeclaration)); | 1201 assert(invariant(element, element.isDeclaration)); |
1203 return resolution.analyzeElement(element); | 1202 ResolutionEnqueuer world = enqueuer.resolution; |
| 1203 if (world.hasBeenResolved(element)) { |
| 1204 return const WorldImpact(); |
| 1205 } |
| 1206 assert(parser != null); |
| 1207 Node tree = parser.parse(element); |
| 1208 assert(invariant(element, !element.isSynthesized || tree == null)); |
| 1209 WorldImpact worldImpact = resolver.resolve(element); |
| 1210 if (tree != null && !analyzeSignaturesOnly && !suppressWarnings) { |
| 1211 // Only analyze nodes with a corresponding [TreeElements]. |
| 1212 checker.check(element); |
| 1213 } |
| 1214 world.registerResolvedElement(element); |
| 1215 return worldImpact; |
1204 } | 1216 } |
1205 | 1217 |
1206 ResolutionWorldImpact analyze(ResolutionWorkItem work, | 1218 WorldImpact analyze(ResolutionWorkItem work, ResolutionEnqueuer world) { |
1207 ResolutionEnqueuer world) { | |
1208 assert(invariant(work.element, identical(world, enqueuer.resolution))); | 1219 assert(invariant(work.element, identical(world, enqueuer.resolution))); |
1209 assert(invariant(work.element, !work.isAnalyzed, | 1220 assert(invariant(work.element, !work.isAnalyzed, |
1210 message: 'Element ${work.element} has already been analyzed')); | 1221 message: 'Element ${work.element} has already been analyzed')); |
1211 if (shouldPrintProgress) { | 1222 if (shouldPrintProgress) { |
1212 // TODO(ahe): Add structured diagnostics to the compiler API and | 1223 // TODO(ahe): Add structured diagnostics to the compiler API and |
1213 // use it to separate this from the --verbose option. | 1224 // use it to separate this from the --verbose option. |
1214 if (phase == PHASE_RESOLVING) { | 1225 if (phase == PHASE_RESOLVING) { |
1215 reporter.log( | 1226 reporter.log( |
1216 'Resolved ${enqueuer.resolution.processedElements.length} ' | 1227 'Resolved ${enqueuer.resolution.resolvedElements.length} ' |
1217 'elements.'); | 1228 'elements.'); |
1218 progress.reset(); | 1229 progress.reset(); |
1219 } | 1230 } |
1220 } | 1231 } |
1221 AstElement element = work.element; | 1232 AstElement element = work.element; |
1222 if (world.hasBeenProcessed(element)) { | 1233 if (world.hasBeenResolved(element)) { |
1223 return const ResolutionWorldImpact(); | 1234 return const WorldImpact(); |
1224 } | 1235 } |
1225 ResolutionWorldImpact worldImpact = analyzeElement(element); | 1236 WorldImpact worldImpact = analyzeElement(element); |
1226 backend.onElementResolved(element, element.resolvedAst.elements); | 1237 backend.onElementResolved(element, element.resolvedAst.elements); |
1227 world.registerProcessedElement(element); | |
1228 return worldImpact; | 1238 return worldImpact; |
1229 } | 1239 } |
1230 | 1240 |
1231 WorldImpact codegen(CodegenWorkItem work, CodegenEnqueuer world) { | 1241 WorldImpact codegen(CodegenWorkItem work, CodegenEnqueuer world) { |
1232 assert(invariant(work.element, identical(world, enqueuer.codegen))); | 1242 assert(invariant(work.element, identical(world, enqueuer.codegen))); |
1233 if (shouldPrintProgress) { | 1243 if (shouldPrintProgress) { |
1234 // TODO(ahe): Add structured diagnostics to the compiler API and | 1244 // TODO(ahe): Add structured diagnostics to the compiler API and |
1235 // use it to separate this from the --verbose option. | 1245 // use it to separate this from the --verbose option. |
1236 reporter.log( | 1246 reporter.log( |
1237 'Compiled ${enqueuer.codegen.generatedCode.length} methods.'); | 1247 'Compiled ${enqueuer.codegen.generatedCode.length} methods.'); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 prevToken = currentToken; | 1323 prevToken = currentToken; |
1314 currentToken = currentToken.next; | 1324 currentToken = currentToken.next; |
1315 } | 1325 } |
1316 return firstToken; | 1326 return firstToken; |
1317 } | 1327 } |
1318 | 1328 |
1319 void reportUnusedCode() { | 1329 void reportUnusedCode() { |
1320 void checkLive(member) { | 1330 void checkLive(member) { |
1321 if (member.isErroneous) return; | 1331 if (member.isErroneous) return; |
1322 if (member.isFunction) { | 1332 if (member.isFunction) { |
1323 if (!enqueuer.resolution.hasBeenProcessed(member)) { | 1333 if (!enqueuer.resolution.hasBeenResolved(member)) { |
1324 reporter.reportHintMessage( | 1334 reporter.reportHintMessage( |
1325 member, MessageKind.UNUSED_METHOD, {'name': member.name}); | 1335 member, MessageKind.UNUSED_METHOD, {'name': member.name}); |
1326 } | 1336 } |
1327 } else if (member.isClass) { | 1337 } else if (member.isClass) { |
1328 if (!member.isResolved) { | 1338 if (!member.isResolved) { |
1329 reporter.reportHintMessage( | 1339 reporter.reportHintMessage( |
1330 member, MessageKind.UNUSED_CLASS, {'name': member.name}); | 1340 member, MessageKind.UNUSED_CLASS, {'name': member.name}); |
1331 } else { | 1341 } else { |
1332 member.forEachLocalMember(checkLive); | 1342 member.forEachLocalMember(checkLive); |
1333 } | 1343 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 ClassElement symbolClass; | 1483 ClassElement symbolClass; |
1474 ClassElement stackTraceClass; | 1484 ClassElement stackTraceClass; |
1475 ClassElement futureClass; | 1485 ClassElement futureClass; |
1476 ClassElement iterableClass; | 1486 ClassElement iterableClass; |
1477 ClassElement streamClass; | 1487 ClassElement streamClass; |
1478 ClassElement resourceClass; | 1488 ClassElement resourceClass; |
1479 | 1489 |
1480 _CompilerCoreTypes(this.resolution); | 1490 _CompilerCoreTypes(this.resolution); |
1481 | 1491 |
1482 @override | 1492 @override |
1483 InterfaceType get objectType { | 1493 InterfaceType get objectType => objectClass.computeType(resolution); |
1484 objectClass.ensureResolved(resolution); | |
1485 return objectClass.rawType; | |
1486 } | |
1487 | 1494 |
1488 @override | 1495 @override |
1489 InterfaceType get boolType { | 1496 InterfaceType get boolType => boolClass.computeType(resolution); |
1490 boolClass.ensureResolved(resolution); | |
1491 return boolClass.rawType; | |
1492 } | |
1493 | 1497 |
1494 @override | 1498 @override |
1495 InterfaceType get doubleType { | 1499 InterfaceType get doubleType => doubleClass.computeType(resolution); |
1496 doubleClass.ensureResolved(resolution); | |
1497 return doubleClass.rawType; | |
1498 } | |
1499 | 1500 |
1500 @override | 1501 @override |
1501 InterfaceType get functionType { | 1502 InterfaceType get functionType => functionClass.computeType(resolution); |
1502 functionClass.ensureResolved(resolution); | |
1503 return functionClass.rawType; | |
1504 } | |
1505 | 1503 |
1506 @override | 1504 @override |
1507 InterfaceType get intType { | 1505 InterfaceType get intType => intClass.computeType(resolution); |
1508 intClass.ensureResolved(resolution); | |
1509 return intClass.rawType; | |
1510 } | |
1511 | 1506 |
1512 @override | 1507 @override |
1513 InterfaceType get resourceType { | 1508 InterfaceType get resourceType => resourceClass.computeType(resolution); |
1514 resourceClass.ensureResolved(resolution); | |
1515 return resourceClass.rawType; | |
1516 } | |
1517 | 1509 |
1518 @override | 1510 @override |
1519 InterfaceType listType([DartType elementType]) { | 1511 InterfaceType listType([DartType elementType]) { |
1520 listClass.ensureResolved(resolution); | 1512 InterfaceType type = listClass.computeType(resolution); |
1521 InterfaceType type = listClass.rawType; | |
1522 if (elementType == null) { | 1513 if (elementType == null) { |
1523 return type; | 1514 return listClass.rawType; |
1524 } | 1515 } |
1525 return type.createInstantiation([elementType]); | 1516 return type.createInstantiation([elementType]); |
1526 } | 1517 } |
1527 | 1518 |
1528 @override | 1519 @override |
1529 InterfaceType mapType([DartType keyType, | 1520 InterfaceType mapType([DartType keyType, |
1530 DartType valueType]) { | 1521 DartType valueType]) { |
1531 mapClass.ensureResolved(resolution); | 1522 InterfaceType type = mapClass.computeType(resolution); |
1532 InterfaceType type = mapClass.rawType; | |
1533 if (keyType == null && valueType == null) { | 1523 if (keyType == null && valueType == null) { |
1534 return type; | 1524 return mapClass.rawType; |
1535 } else if (keyType == null) { | 1525 } else if (keyType == null) { |
1536 keyType = const DynamicType(); | 1526 keyType = const DynamicType(); |
1537 } else if (valueType == null) { | 1527 } else if (valueType == null) { |
1538 valueType = const DynamicType(); | 1528 valueType = const DynamicType(); |
1539 } | 1529 } |
1540 return type.createInstantiation([keyType, valueType]); | 1530 return type.createInstantiation([keyType, valueType]); |
1541 } | 1531 } |
1542 | 1532 |
1543 @override | 1533 @override |
1544 InterfaceType get nullType { | 1534 InterfaceType get nullType => nullClass.computeType(resolution); |
1545 nullClass.ensureResolved(resolution); | |
1546 return nullClass.rawType; | |
1547 } | |
1548 | 1535 |
1549 @override | 1536 @override |
1550 InterfaceType get numType { | 1537 InterfaceType get numType => numClass.computeType(resolution); |
1551 numClass.ensureResolved(resolution); | |
1552 return numClass.rawType; | |
1553 } | |
1554 | 1538 |
1555 @override | 1539 @override |
1556 InterfaceType get stringType { | 1540 InterfaceType get stringType => stringClass.computeType(resolution); |
1557 stringClass.ensureResolved(resolution); | |
1558 return stringClass.rawType; | |
1559 } | |
1560 | 1541 |
1561 @override | 1542 @override |
1562 InterfaceType get symbolType { | 1543 InterfaceType get symbolType => symbolClass.computeType(resolution); |
1563 symbolClass.ensureResolved(resolution); | |
1564 return symbolClass.rawType; | |
1565 } | |
1566 | 1544 |
1567 @override | 1545 @override |
1568 InterfaceType get typeType { | 1546 InterfaceType get typeType => typeClass.computeType(resolution); |
1569 typeClass.ensureResolved(resolution); | |
1570 return typeClass.rawType; | |
1571 } | |
1572 | 1547 |
1573 @override | 1548 @override |
1574 InterfaceType iterableType([DartType elementType]) { | 1549 InterfaceType iterableType([DartType elementType]) { |
1575 iterableClass.ensureResolved(resolution); | 1550 InterfaceType type = iterableClass.computeType(resolution); |
1576 InterfaceType type = iterableClass.rawType; | |
1577 if (elementType == null) { | 1551 if (elementType == null) { |
1578 return type; | 1552 return iterableClass.rawType; |
1579 } | 1553 } |
1580 return type.createInstantiation([elementType]); | 1554 return type.createInstantiation([elementType]); |
1581 } | 1555 } |
1582 | 1556 |
1583 @override | 1557 @override |
1584 InterfaceType futureType([DartType elementType]) { | 1558 InterfaceType futureType([DartType elementType]) { |
1585 futureClass.ensureResolved(resolution); | 1559 InterfaceType type = futureClass.computeType(resolution); |
1586 InterfaceType type = futureClass.rawType; | |
1587 if (elementType == null) { | 1560 if (elementType == null) { |
1588 return type; | 1561 return futureClass.rawType; |
1589 } | 1562 } |
1590 return type.createInstantiation([elementType]); | 1563 return type.createInstantiation([elementType]); |
1591 } | 1564 } |
1592 | 1565 |
1593 @override | 1566 @override |
1594 InterfaceType streamType([DartType elementType]) { | 1567 InterfaceType streamType([DartType elementType]) { |
1595 streamClass.ensureResolved(resolution); | 1568 InterfaceType type = streamClass.computeType(resolution); |
1596 InterfaceType type = streamClass.rawType; | |
1597 if (elementType == null) { | 1569 if (elementType == null) { |
1598 return type; | 1570 return streamClass.rawType; |
1599 } | 1571 } |
1600 return type.createInstantiation([elementType]); | 1572 return type.createInstantiation([elementType]); |
1601 } | 1573 } |
1602 } | 1574 } |
1603 | 1575 |
1604 class _CompilerDiagnosticReporter extends DiagnosticReporter { | 1576 class _CompilerDiagnosticReporter extends DiagnosticReporter { |
1605 final Compiler compiler; | 1577 final Compiler compiler; |
1606 final DiagnosticOptions options; | 1578 final DiagnosticOptions options; |
1607 | 1579 |
1608 Element _currentElement; | 1580 Element _currentElement; |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1941 const <DiagnosticMessage>[], | 1913 const <DiagnosticMessage>[], |
1942 api.Diagnostic.HINT); | 1914 api.Diagnostic.HINT); |
1943 }); | 1915 }); |
1944 } | 1916 } |
1945 } | 1917 } |
1946 } | 1918 } |
1947 | 1919 |
1948 // TODO(johnniwinther): Move [ResolverTask] here. | 1920 // TODO(johnniwinther): Move [ResolverTask] here. |
1949 class _CompilerResolution implements Resolution { | 1921 class _CompilerResolution implements Resolution { |
1950 final Compiler compiler; | 1922 final Compiler compiler; |
1951 final Map<Element, ResolutionWorldImpact> _worldImpactCache = | |
1952 <Element, ResolutionWorldImpact>{}; | |
1953 | 1923 |
1954 _CompilerResolution(this.compiler); | 1924 _CompilerResolution(this.compiler); |
1955 | 1925 |
1956 @override | 1926 @override |
1957 DiagnosticReporter get reporter => compiler.reporter; | 1927 DiagnosticReporter get reporter => compiler.reporter; |
1958 | 1928 |
1959 @override | 1929 @override |
1960 Parsing get parsing => compiler.parsing; | 1930 Parsing get parsing => compiler.parsing; |
1961 | 1931 |
1962 @override | 1932 @override |
(...skipping 21 matching lines...) Expand all Loading... |
1984 | 1954 |
1985 @override | 1955 @override |
1986 FunctionSignature resolveSignature(FunctionElement function) { | 1956 FunctionSignature resolveSignature(FunctionElement function) { |
1987 return compiler.resolver.resolveSignature(function); | 1957 return compiler.resolver.resolveSignature(function); |
1988 } | 1958 } |
1989 | 1959 |
1990 @override | 1960 @override |
1991 DartType resolveTypeAnnotation(Element element, TypeAnnotation node) { | 1961 DartType resolveTypeAnnotation(Element element, TypeAnnotation node) { |
1992 return compiler.resolver.resolveTypeAnnotation(element, node); | 1962 return compiler.resolver.resolveTypeAnnotation(element, node); |
1993 } | 1963 } |
1994 | |
1995 ResolutionWorldImpact analyzeElement(Element element) { | |
1996 return _worldImpactCache.putIfAbsent(element, () { | |
1997 assert(compiler.parser != null); | |
1998 Node tree = compiler.parser.parse(element); | |
1999 assert(invariant(element, !element.isSynthesized || tree == null)); | |
2000 ResolutionWorldImpact worldImpact = compiler.resolver.resolve(element); | |
2001 if (tree != null && | |
2002 !compiler.analyzeSignaturesOnly && | |
2003 !compiler.suppressWarnings) { | |
2004 // Only analyze nodes with a corresponding [TreeElements]. | |
2005 compiler.checker.check(element); | |
2006 } | |
2007 return worldImpact; | |
2008 }); | |
2009 } | |
2010 | |
2011 @override | |
2012 bool hasBeenResolved(Element element) { | |
2013 return _worldImpactCache.containsKey(element); | |
2014 } | |
2015 } | 1964 } |
2016 | 1965 |
2017 // TODO(johnniwinther): Move [ParserTask], [PatchParserTask], [DietParserTask] | 1966 // TODO(johnniwinther): Move [ParserTask], [PatchParserTask], [DietParserTask] |
2018 // and [ScannerTask] here. | 1967 // and [ScannerTask] here. |
2019 class _CompilerParsing implements Parsing { | 1968 class _CompilerParsing implements Parsing { |
2020 final Compiler compiler; | 1969 final Compiler compiler; |
2021 | 1970 |
2022 _CompilerParsing(this.compiler); | 1971 _CompilerParsing(this.compiler); |
2023 | 1972 |
2024 @override | 1973 @override |
2025 DiagnosticReporter get reporter => compiler.reporter; | 1974 DiagnosticReporter get reporter => compiler.reporter; |
2026 | 1975 |
2027 @override | 1976 @override |
2028 measure(f()) => compiler.parser.measure(f); | 1977 measure(f()) => compiler.parser.measure(f); |
2029 | 1978 |
2030 @override | 1979 @override |
2031 void parsePatchClass(ClassElement cls) { | 1980 void parsePatchClass(ClassElement cls) { |
2032 compiler.patchParser.measure(() { | 1981 compiler.patchParser.measure(() { |
2033 if (cls.isPatch) { | 1982 if (cls.isPatch) { |
2034 compiler.patchParser.parsePatchClassNode(cls); | 1983 compiler.patchParser.parsePatchClassNode(cls); |
2035 } | 1984 } |
2036 }); | 1985 }); |
2037 } | 1986 } |
2038 } | 1987 } |
OLD | NEW |