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

Unified Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 725473005: During resolution, record the target of break/continue statements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
Index: pkg/analyzer/lib/src/generated/engine.dart
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 89ac390ba9cce6bd73bb6cd16741a9e5994e53f1..f83645a76e99423062f5afb216201b645bd3755b 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -19,9 +19,9 @@ import 'element.dart';
import 'error.dart';
import 'error_verifier.dart';
import 'html.dart' as ht;
-import 'incremental_scanner.dart';
import 'incremental_resolver.dart' show IncrementalResolver,
poorMansIncrementalResolution;
+import 'incremental_scanner.dart';
import 'instrumentation.dart';
import 'java_core.dart';
import 'java_engine.dart';
@@ -4921,31 +4921,6 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
/**
- * TODO(scheglov) A hackish, limited incremental resolution implementation.
- */
- bool _tryPoorMansIncrementalResolution(Source unitSource, String newCode) {
- List<Source> librarySources = getLibrariesContaining(unitSource);
- if (librarySources.length != 1) {
- return false;
- }
- CompilationUnit oldUnit =
- getResolvedCompilationUnit2(unitSource, librarySources[0]);
- bool success = poorMansIncrementalResolution(typeProvider, oldUnit, newCode);
- if (!success) {
- return false;
- }
- ChangeNoticeImpl notice = _getNotice(unitSource);
- notice.compilationUnit = oldUnit;
- // TODO(scheglov) apply updated errors
- {
- LineInfo lineInfo = getLineInfo(unitSource);
- DartEntry dartEntry = _cache.get(unitSource);
- notice.setErrors(dartEntry.allErrors, lineInfo);
- }
- return true;
- }
-
- /**
* <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
*
* @param source the source that has been removed
@@ -4973,6 +4948,32 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
/**
+ * TODO(scheglov) A hackish, limited incremental resolution implementation.
+ */
+ bool _tryPoorMansIncrementalResolution(Source unitSource, String newCode) {
+ List<Source> librarySources = getLibrariesContaining(unitSource);
+ if (librarySources.length != 1) {
+ return false;
+ }
+ CompilationUnit oldUnit =
+ getResolvedCompilationUnit2(unitSource, librarySources[0]);
+ bool success =
+ poorMansIncrementalResolution(typeProvider, oldUnit, newCode);
+ if (!success) {
+ return false;
+ }
+ ChangeNoticeImpl notice = _getNotice(unitSource);
+ notice.compilationUnit = oldUnit;
+ // TODO(scheglov) apply updated errors
+ {
+ LineInfo lineInfo = getLineInfo(unitSource);
+ DartEntry dartEntry = _cache.get(unitSource);
+ notice.setErrors(dartEntry.allErrors, lineInfo);
+ }
+ return true;
+ }
+
+ /**
* Check the cache for any invalid entries (entries whose modification time does not match the
* modification time of the source associated with the entry). Invalid entries will be marked as
* invalid so that the source will be re-analyzed.
@@ -12986,6 +12987,12 @@ class ResolutionEraser extends GeneralizingAstVisitor<Object> {
}
@override
+ Object visitBreakStatement(BreakStatement node) {
+ node.target = null;
+ return super.visitBreakStatement(node);
+ }
+
+ @override
Object visitCompilationUnit(CompilationUnit node) {
node.element = null;
return super.visitCompilationUnit(node);
@@ -13004,6 +13011,12 @@ class ResolutionEraser extends GeneralizingAstVisitor<Object> {
}
@override
+ Object visitContinueStatement(ContinueStatement node) {
+ node.target = null;
+ return super.visitContinueStatement(node);
+ }
+
+ @override
Object visitDirective(Directive node) {
node.element = null;
return super.visitDirective(node);

Powered by Google App Engine
This is Rietveld 408576698