Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2313)

Unified Diff: pkg/analyzer/test/generated/incremental_resolver_test.dart

Issue 1262453007: Update LineInfo during incremental resolution. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/incremental_resolver_test.dart
diff --git a/pkg/analyzer/test/generated/incremental_resolver_test.dart b/pkg/analyzer/test/generated/incremental_resolver_test.dart
index ed41b59a77f1224f3c8284dfc857f203feae9cfc..7af5e3ab20b3dfa8eb8ad1b8297704addbc5887d 100644
--- a/pkg/analyzer/test/generated/incremental_resolver_test.dart
+++ b/pkg/analyzer/test/generated/incremental_resolver_test.dart
@@ -3872,6 +3872,20 @@ f3() {
''');
}
+ void _assertEqualLineInfo(LineInfo incrLineInfo, LineInfo fullLineInfo) {
+ for (int offset = 0; offset < 1000; offset++) {
+ LineInfo_Location incrLocation = incrLineInfo.getLocation(offset);
+ LineInfo_Location fullLocation = fullLineInfo.getLocation(offset);
+ if (incrLocation.lineNumber != fullLocation.lineNumber ||
+ incrLocation.columnNumber != fullLocation.columnNumber) {
+ fail('At offset $offset ' +
+ '(${incrLocation.lineNumber}, ${incrLocation.columnNumber})' +
+ ' != ' +
+ '(${fullLocation.lineNumber}, ${fullLocation.columnNumber})');
+ }
+ }
+ }
+
/**
* Reset the analysis context to have the 'incremental' option set to the
* given value.
@@ -3910,6 +3924,7 @@ f3() {
analysisContext2.setContents(source, newCode);
CompilationUnit newUnit = resolveCompilationUnit(source, oldLibrary);
List<AnalysisError> newErrors = analysisContext.computeErrors(source);
+ LineInfo newLineInfo = analysisContext.getLineInfo(source);
// check for expected failure
if (!expectedSuccess) {
expect(newUnit.element, isNot(same(oldUnitElement)));
@@ -3932,6 +3947,8 @@ f3() {
CompilationUnit fullNewUnit = resolveCompilationUnit(source, library);
// Validate tokens.
_assertEqualTokens(newUnit, fullNewUnit);
+ // Validate LineInfo
+ _assertEqualLineInfo(newLineInfo, analysisContext.getLineInfo(source));
// Validate that "incremental" and "full" units have the same resolution.
try {
assertSameResolution(newUnit, fullNewUnit, validateTypes: true);
@@ -3941,7 +3958,6 @@ f3() {
List<AnalysisError> newFullErrors =
analysisContext.getErrors(source).errors;
_assertEqualErrors(newErrors, newFullErrors);
- // TODO(scheglov) check line info
}
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698