Chromium Code Reviews| 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 |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 bool get disableTypeInference { | 535 bool get disableTypeInference { |
| 536 return disableTypeInferenceFlag || compilationFailed; | 536 return disableTypeInferenceFlag || compilationFailed; |
| 537 } | 537 } |
| 538 | 538 |
| 539 int getNextFreeClassId() => nextFreeClassId++; | 539 int getNextFreeClassId() => nextFreeClassId++; |
| 540 | 540 |
| 541 void unimplemented(Spannable spannable, String methodName) { | 541 void unimplemented(Spannable spannable, String methodName) { |
| 542 reporter.internalError(spannable, "$methodName not implemented."); | 542 reporter.internalError(spannable, "$methodName not implemented."); |
| 543 } | 543 } |
| 544 | 544 |
| 545 // Compiles the dart script at [uri]. | |
| 546 // | |
| 547 // The resulting future will complete with true if the compilation | |
| 548 // succeded. | |
|
Johnni Winther
2015/10/29 10:48:32
Thanks!
sigurdm
2015/10/29 12:30:42
Acknowledged.
| |
| 545 Future<bool> run(Uri uri) { | 549 Future<bool> run(Uri uri) { |
| 546 totalCompileTime.start(); | 550 totalCompileTime.start(); |
| 547 | 551 |
| 548 return new Future.sync(() => runCompiler(uri)) | 552 return new Future.sync(() => runInternal(uri)) |
| 549 .catchError((error) => _reporter.onError(uri, error)) | 553 .catchError((error) => _reporter.onError(uri, error)) |
| 550 .whenComplete(() { | 554 .whenComplete(() { |
| 551 tracer.close(); | 555 tracer.close(); |
| 552 totalCompileTime.stop(); | 556 totalCompileTime.stop(); |
| 553 }).then((_) { | 557 }).then((_) { |
| 554 return !compilationFailed; | 558 return !compilationFailed; |
| 555 }); | 559 }); |
| 556 } | 560 } |
| 557 | 561 |
| 558 /// This method is called immediately after the [LibraryElement] [library] has | 562 /// This method is called immediately after the [LibraryElement] [library] has |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 821 return _filledListConstructor = | 825 return _filledListConstructor = |
| 822 coreClasses.listClass.lookupConstructor("filled"); | 826 coreClasses.listClass.lookupConstructor("filled"); |
| 823 } | 827 } |
| 824 | 828 |
| 825 /** | 829 /** |
| 826 * Get an [Uri] pointing to a patch for the dart: library with | 830 * Get an [Uri] pointing to a patch for the dart: library with |
| 827 * the given path. Returns null if there is no patch. | 831 * the given path. Returns null if there is no patch. |
| 828 */ | 832 */ |
| 829 Uri resolvePatchUri(String dartLibraryPath); | 833 Uri resolvePatchUri(String dartLibraryPath); |
| 830 | 834 |
| 831 Future runCompiler(Uri uri) { | 835 Future runInternal(Uri uri) { |
| 832 // TODO(ahe): This prevents memory leaks when invoking the compiler | 836 // TODO(ahe): This prevents memory leaks when invoking the compiler |
| 833 // multiple times. Implement a better mechanism where we can store | 837 // multiple times. Implement a better mechanism where we can store |
| 834 // such caches in the compiler and get access to them through a | 838 // such caches in the compiler and get access to them through a |
| 835 // suitably maintained static reference to the current compiler. | 839 // suitably maintained static reference to the current compiler. |
| 836 StringToken.canonicalizedSubstrings.clear(); | 840 StringToken.canonicalizedSubstrings.clear(); |
| 837 Selector.canonicalizedValues.clear(); | 841 Selector.canonicalizedValues.clear(); |
| 838 | 842 |
| 839 assert(uri != null || analyzeOnly || hasIncrementalSupport); | 843 assert(uri != null || analyzeOnly || hasIncrementalSupport); |
| 840 return new Future.sync(() { | 844 return new Future.sync(() { |
| 841 if (librariesToAnalyzeWhenRun != null) { | 845 if (librariesToAnalyzeWhenRun != null) { |
| (...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2047 if (_otherDependencies == null) { | 2051 if (_otherDependencies == null) { |
| 2048 _otherDependencies = new Setlet<Element>(); | 2052 _otherDependencies = new Setlet<Element>(); |
| 2049 } | 2053 } |
| 2050 _otherDependencies.add(element.implementation); | 2054 _otherDependencies.add(element.implementation); |
| 2051 } | 2055 } |
| 2052 | 2056 |
| 2053 Iterable<Element> get otherDependencies { | 2057 Iterable<Element> get otherDependencies { |
| 2054 return _otherDependencies != null ? _otherDependencies : const <Element>[]; | 2058 return _otherDependencies != null ? _otherDependencies : const <Element>[]; |
| 2055 } | 2059 } |
| 2056 } | 2060 } |
| OLD | NEW |