Workaround for ConstantVisitor dependency issues.

This restores proper test functionality on the buildbots.  I plan to
follow up with a more permanent fix.

BUG=dartbug.com/21572
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//701583003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41676 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
paulberry@google.com 2014-11-11 22:55:58 +00:00
parent 250eda4a94
commit 9bc06fbf41
4 changed files with 49 additions and 9 deletions

View file

@ -288,16 +288,16 @@ main() {
test_const_inList_inConditionalExpression() {
indexTestUnit('''
main(bool b) {
const [b ? 1 : 2, 3];
main() {
const [true ? 1 : 2, 3];
}
''');
_createRefactoringForString('1');
// apply refactoring
return _assertSuccessfulRefactoring('''
main(bool b) {
main() {
const res = 1;
const [b ? res : 2, 3];
const [true ? res : 2, 3];
}
''');
}

View file

@ -8812,8 +8812,12 @@ class GenerateDartErrorsTask extends AnalysisTask {
// Use the ConstantVerifier to verify the use of constants. This needs to happen before using
// the ErrorVerifier because some error codes need the computed constant values.
//
ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, libraryElement, typeProvider);
_unit.accept(constantVerifier);
// TODO(paulberry): as a temporary workaround for issue 21572,
// ConstantVerifier is being run right after ConstantValueComputer, so we
// don't need to run it here. Once issue 21572 is fixed, re-enable the
// call to ConstantVerifier.
// ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, libraryElement, typeProvider);
// _unit.accept(constantVerifier);
//
// Use the ErrorVerifier to compute the rest of the errors.
//
@ -12632,8 +12636,12 @@ class ResolveDartUnitTask extends AnalysisTask {
ErrorReporter errorReporter = new ErrorReporter(errorListener, source);
ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, _libraryElement, typeProvider, inheritanceManager);
unit.accept(errorVerifier);
ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, _libraryElement, typeProvider);
unit.accept(constantVerifier);
// TODO(paulberry): as a temporary workaround for issue 21572,
// ConstantVerifier is being run right after ConstantValueComputer, so we
// don't need to run it here. Once issue 21572 is fixed, re-enable the
// call to ConstantVerifier.
// ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, _libraryElement, typeProvider);
// unit.accept(constantVerifier);
} finally {
counterHandleErrors.stop();
}

View file

@ -8857,6 +8857,25 @@ class LibraryResolver {
}
}
computer.computeValues();
// As a temporary workaround for issue 21572, run ConstantVerifier now.
// TODO(paulberry): remove this workaround once issue 21572 is fixed.
for (Library library in _librariesInCycles) {
for (Source source in library.compilationUnitSources) {
try {
CompilationUnit unit = library.getAST(source);
ErrorReporter errorReporter = new ErrorReporter(
_errorListener, source);
ConstantVerifier constantVerifier = new ConstantVerifier(
errorReporter, library.libraryElement, _typeProvider);
unit.accept(constantVerifier);
} on AnalysisException catch (exception, stackTrace) {
AnalysisEngine.instance.logger.logError(
"Internal Error: Could not access AST for ${source.fullName} "
"during constant verification",
new CaughtException(exception, stackTrace));
}
}
}
} finally {
timeCounter.stop();
}
@ -9382,6 +9401,19 @@ class LibraryResolver2 {
}
}
computer.computeValues();
// As a temporary workaround for issue 21572, run ConstantVerifier now.
// TODO(paulberry): remove this workaround once issue 21572 is fixed.
for (ResolvableLibrary library in _librariesInCycle) {
for (ResolvableCompilationUnit unit in
library.resolvableCompilationUnits) {
CompilationUnit ast = unit.compilationUnit;
ErrorReporter errorReporter = new ErrorReporter(
_errorListener, unit.source);
ConstantVerifier constantVerifier = new ConstantVerifier(
errorReporter, library.libraryElement, _typeProvider);
ast.accept(constantVerifier);
}
}
} finally {
timeCounter.stop();
}

View file

@ -83,7 +83,7 @@ class ResolvedNodeMirrorFinder extends Unparser {
recursionLevel--;
}
unparseNodeListFrom(NodeList node, var from, {spaces}) {
unparseNodeListFrom(NodeList node, var from, {bool spaces: true}) {
if (from.isEmpty) return;
visit(from.head);