OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.resolver; | 5 library engine.resolver; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import "dart:math" as math; | 8 import "dart:math" as math; |
9 | 9 |
10 import 'java_core.dart'; | 10 import 'java_core.dart'; |
(...skipping 8839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8850 computer.add(unit); | 8850 computer.add(unit); |
8851 } | 8851 } |
8852 } on AnalysisException catch (exception, stackTrace) { | 8852 } on AnalysisException catch (exception, stackTrace) { |
8853 AnalysisEngine.instance.logger.logError( | 8853 AnalysisEngine.instance.logger.logError( |
8854 "Internal Error: Could not access AST for ${source.fullName} dur
ing constant evaluation", | 8854 "Internal Error: Could not access AST for ${source.fullName} dur
ing constant evaluation", |
8855 new CaughtException(exception, stackTrace)); | 8855 new CaughtException(exception, stackTrace)); |
8856 } | 8856 } |
8857 } | 8857 } |
8858 } | 8858 } |
8859 computer.computeValues(); | 8859 computer.computeValues(); |
| 8860 // As a temporary workaround for issue 21572, run ConstantVerifier now. |
| 8861 // TODO(paulberry): remove this workaround once issue 21572 is fixed. |
| 8862 for (Library library in _librariesInCycles) { |
| 8863 for (Source source in library.compilationUnitSources) { |
| 8864 try { |
| 8865 CompilationUnit unit = library.getAST(source); |
| 8866 ErrorReporter errorReporter = new ErrorReporter( |
| 8867 _errorListener, source); |
| 8868 ConstantVerifier constantVerifier = new ConstantVerifier( |
| 8869 errorReporter, library.libraryElement, _typeProvider); |
| 8870 unit.accept(constantVerifier); |
| 8871 } on AnalysisException catch (exception, stackTrace) { |
| 8872 AnalysisEngine.instance.logger.logError( |
| 8873 "Internal Error: Could not access AST for ${source.fullName} " |
| 8874 "during constant verification", |
| 8875 new CaughtException(exception, stackTrace)); |
| 8876 } |
| 8877 } |
| 8878 } |
8860 } finally { | 8879 } finally { |
8861 timeCounter.stop(); | 8880 timeCounter.stop(); |
8862 } | 8881 } |
8863 } | 8882 } |
8864 | 8883 |
8865 /** | 8884 /** |
8866 * Resolve the identifiers and perform type analysis in the libraries in the c
urrent cycle. | 8885 * Resolve the identifiers and perform type analysis in the libraries in the c
urrent cycle. |
8867 * | 8886 * |
8868 * @throws AnalysisException if any of the identifiers could not be resolved o
r if any of the | 8887 * @throws AnalysisException if any of the identifiers could not be resolved o
r if any of the |
8869 * libraries could not have their types analyzed | 8888 * libraries could not have their types analyzed |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9375 ConstantValueComputer computer = new ConstantValueComputer(_typeProvider,
analysisContext.declaredVariables); | 9394 ConstantValueComputer computer = new ConstantValueComputer(_typeProvider,
analysisContext.declaredVariables); |
9376 for (ResolvableLibrary library in _librariesInCycle) { | 9395 for (ResolvableLibrary library in _librariesInCycle) { |
9377 for (ResolvableCompilationUnit unit in library.resolvableCompilationUnit
s) { | 9396 for (ResolvableCompilationUnit unit in library.resolvableCompilationUnit
s) { |
9378 CompilationUnit ast = unit.compilationUnit; | 9397 CompilationUnit ast = unit.compilationUnit; |
9379 if (ast != null) { | 9398 if (ast != null) { |
9380 computer.add(ast); | 9399 computer.add(ast); |
9381 } | 9400 } |
9382 } | 9401 } |
9383 } | 9402 } |
9384 computer.computeValues(); | 9403 computer.computeValues(); |
| 9404 // As a temporary workaround for issue 21572, run ConstantVerifier now. |
| 9405 // TODO(paulberry): remove this workaround once issue 21572 is fixed. |
| 9406 for (ResolvableLibrary library in _librariesInCycle) { |
| 9407 for (ResolvableCompilationUnit unit in |
| 9408 library.resolvableCompilationUnits) { |
| 9409 CompilationUnit ast = unit.compilationUnit; |
| 9410 ErrorReporter errorReporter = new ErrorReporter( |
| 9411 _errorListener, unit.source); |
| 9412 ConstantVerifier constantVerifier = new ConstantVerifier( |
| 9413 errorReporter, library.libraryElement, _typeProvider); |
| 9414 ast.accept(constantVerifier); |
| 9415 } |
| 9416 } |
9385 } finally { | 9417 } finally { |
9386 timeCounter.stop(); | 9418 timeCounter.stop(); |
9387 } | 9419 } |
9388 } | 9420 } |
9389 | 9421 |
9390 /** | 9422 /** |
9391 * Resolve the identifiers and perform type analysis in the libraries in the c
urrent cycle. | 9423 * Resolve the identifiers and perform type analysis in the libraries in the c
urrent cycle. |
9392 * | 9424 * |
9393 * @throws AnalysisException if any of the identifiers could not be resolved o
r if any of the | 9425 * @throws AnalysisException if any of the identifiers could not be resolved o
r if any of the |
9394 * libraries could not have their types analyzed | 9426 * libraries could not have their types analyzed |
(...skipping 6182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15577 /** | 15609 /** |
15578 * Return the tag that has the given identifier, or {@code null} if there is n
o such tag (the | 15610 * Return the tag that has the given identifier, or {@code null} if there is n
o such tag (the |
15579 * identifier is not defined). | 15611 * identifier is not defined). |
15580 * | 15612 * |
15581 * @return the tag that has the given identifier | 15613 * @return the tag that has the given identifier |
15582 */ | 15614 */ |
15583 String getTagWithId(String identifier) { | 15615 String getTagWithId(String identifier) { |
15584 return idToTagMap[identifier]; | 15616 return idToTagMap[identifier]; |
15585 } | 15617 } |
15586 } | 15618 } |
OLD | NEW |