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

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

Issue 42863002: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
Index: pkg/analyzer_experimental/lib/src/generated/engine.dart
diff --git a/pkg/analyzer_experimental/lib/src/generated/engine.dart b/pkg/analyzer_experimental/lib/src/generated/engine.dart
index 321794001ea58cef803049a67d8f5bd8f860673b..4bf907ea0771c9d623748e748e6d4a49c7913e88 100644
--- a/pkg/analyzer_experimental/lib/src/generated/engine.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/engine.dart
@@ -8,7 +8,7 @@ import 'utilities_general.dart';
import 'instrumentation.dart';
import 'error.dart';
import 'source.dart';
-import 'scanner.dart' show Token, CharBufferScanner, StringScanner;
+import 'scanner.dart' show Token, Scanner, CharSequenceReader;
import 'ast.dart';
import 'parser.dart' show Parser;
import 'sdk.dart' show DartSdk;
@@ -1664,27 +1664,26 @@ class DartEntryImpl extends SourceEntryImpl implements DartEntry {
_parsedUnit = null;
_parsedUnitAccessed = false;
_parsedUnitState = CacheState.INVALID;
- invalidateAllResolutionInformation();
+ discardCachedResolutionInformation();
}
/**
* Invalidate all of the resolution information associated with the compilation unit.
*/
void invalidateAllResolutionInformation() {
- _element = null;
- _elementState = CacheState.INVALID;
- _includedParts = Source.EMPTY_ARRAY;
- _includedPartsState = CacheState.INVALID;
- _exportedLibraries = Source.EMPTY_ARRAY;
- _exportedLibrariesState = CacheState.INVALID;
- _importedLibraries = Source.EMPTY_ARRAY;
- _importedLibrariesState = CacheState.INVALID;
- _bitmask = 0;
- _clientServerState = CacheState.INVALID;
- _launchableState = CacheState.INVALID;
- _publicNamespace = null;
- _publicNamespaceState = CacheState.INVALID;
- _resolutionState.invalidateAllResolutionInformation();
+ if (identical(_parsedUnitState, CacheState.FLUSHED)) {
+ DartEntryImpl_ResolutionState state = _resolutionState;
+ while (state != null) {
+ if (identical(state._resolvedUnitState, CacheState.VALID)) {
+ _parsedUnit = state._resolvedUnit;
+ _parsedUnitAccessed = true;
+ _parsedUnitState = CacheState.VALID;
+ break;
+ }
+ state = state._nextState;
+ }
+ }
+ discardCachedResolutionInformation();
}
bool get isRefactoringSafe {
DartEntryImpl_ResolutionState state = _resolutionState;
@@ -2049,6 +2048,26 @@ class DartEntryImpl extends SourceEntryImpl implements DartEntry {
}
/**
+ * Invalidate all of the resolution information associated with the compilation unit.
+ */
+ void discardCachedResolutionInformation() {
+ _element = null;
+ _elementState = CacheState.INVALID;
+ _includedParts = Source.EMPTY_ARRAY;
+ _includedPartsState = CacheState.INVALID;
+ _exportedLibraries = Source.EMPTY_ARRAY;
+ _exportedLibrariesState = CacheState.INVALID;
+ _importedLibraries = Source.EMPTY_ARRAY;
+ _importedLibrariesState = CacheState.INVALID;
+ _bitmask = 0;
+ _clientServerState = CacheState.INVALID;
+ _launchableState = CacheState.INVALID;
+ _publicNamespace = null;
+ _publicNamespaceState = CacheState.INVALID;
+ _resolutionState.invalidateAllResolutionInformation();
+ }
+
+ /**
* Return a resolution state for the specified library, creating one as necessary.
*
* @param librarySource the library source (not `null`)
@@ -4864,6 +4883,8 @@ class AnalysisContextImpl implements InternalAnalysisContext {
if (thrownException == null) {
htmlCopy.setValue(HtmlEntry.ELEMENT, task.element);
htmlCopy.setValue(HtmlEntry.RESOLUTION_ERRORS, task.resolutionErrors);
+ ChangeNoticeImpl notice = getNotice(source);
+ notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_INFO));
} else {
htmlCopy.recordResolutionError();
}
@@ -5239,6 +5260,9 @@ class ChangeNoticeImpl implements ChangeNotice {
void setErrors(List<AnalysisError> errors, LineInfo lineInfo) {
this._errors = errors;
this._lineInfo = lineInfo;
+ if (lineInfo == null) {
+ AnalysisEngine.instance.logger.logError2("No line info: ${_source}", new JavaException());
+ }
}
String toString() => "Changes for ${_source.fullName}";
}
@@ -6156,7 +6180,7 @@ class RecordingErrorListener implements AnalysisErrorListener {
/**
* A HashMap of lists containing the errors that were collected, keyed by each [Source].
*/
- Map<Source, List<AnalysisError>> _errors = new Map<Source, List<AnalysisError>>();
+ Map<Source, Set<AnalysisError>> _errors = new Map<Source, Set<AnalysisError>>();
/**
* Add all of the errors recorded by the given listener to this listener.
@@ -6175,13 +6199,13 @@ class RecordingErrorListener implements AnalysisErrorListener {
* @return an array of errors (not `null`, contains no `null`s)
*/
List<AnalysisError> get errors {
- Iterable<MapEntry<Source, List<AnalysisError>>> entrySet = getMapEntrySet(_errors);
+ Iterable<MapEntry<Source, Set<AnalysisError>>> entrySet = getMapEntrySet(_errors);
int numEntries = entrySet.length;
if (numEntries == 0) {
return AnalysisError.NO_ERRORS;
}
List<AnalysisError> resultList = new List<AnalysisError>();
- for (MapEntry<Source, List<AnalysisError>> entry in entrySet) {
+ for (MapEntry<Source, Set<AnalysisError>> entry in entrySet) {
resultList.addAll(entry.getValue());
}
return new List.from(resultList);
@@ -6195,21 +6219,21 @@ class RecordingErrorListener implements AnalysisErrorListener {
* @return the errors collected by the listener for the passed [Source]
*/
List<AnalysisError> getErrors2(Source source) {
- List<AnalysisError> errorsForSource = _errors[source];
+ Set<AnalysisError> errorsForSource = _errors[source];
if (errorsForSource == null) {
return AnalysisError.NO_ERRORS;
} else {
return new List.from(errorsForSource);
}
}
- void onError(AnalysisError event) {
- Source source = event.source;
- List<AnalysisError> errorsForSource = _errors[source];
+ void onError(AnalysisError error) {
+ Source source = error.source;
+ Set<AnalysisError> errorsForSource = _errors[source];
if (_errors[source] == null) {
- errorsForSource = new List<AnalysisError>();
+ errorsForSource = new Set<AnalysisError>();
_errors[source] = errorsForSource;
}
- errorsForSource.add(event);
+ javaSetAdd(errorsForSource, error);
}
}
/**
@@ -6768,7 +6792,7 @@ class ParseDartTask extends AnalysisTask {
List<Token> token = [null];
TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.start();
try {
- Source_ContentReceiver receiver = new Source_ContentReceiver_9(this, errorListener, token);
+ Source_ContentReceiver receiver = new Source_ContentReceiver_11(this, errorListener, token);
try {
source.getContents(receiver);
} on JavaException catch (exception) {
@@ -6851,20 +6875,20 @@ class ParseDartTask extends AnalysisTask {
return new List.from(sources);
}
}
-class Source_ContentReceiver_9 implements Source_ContentReceiver {
+class Source_ContentReceiver_11 implements Source_ContentReceiver {
final ParseDartTask ParseDartTask_this;
RecordingErrorListener errorListener;
List<Token> token;
- Source_ContentReceiver_9(this.ParseDartTask_this, this.errorListener, this.token);
+ Source_ContentReceiver_11(this.ParseDartTask_this, this.errorListener, this.token);
void accept(CharBuffer contents, int modificationTime) {
ParseDartTask_this.modificationTime = modificationTime;
- CharBufferScanner scanner = new CharBufferScanner(ParseDartTask_this.source, contents, errorListener);
+ Scanner scanner = new Scanner(ParseDartTask_this.source, new CharSequenceReader(contents), errorListener);
token[0] = scanner.tokenize();
ParseDartTask_this.lineInfo = new LineInfo(scanner.lineStarts);
}
void accept2(String contents, int modificationTime) {
ParseDartTask_this.modificationTime = modificationTime;
- StringScanner scanner = new StringScanner(ParseDartTask_this.source, contents, errorListener);
+ Scanner scanner = new Scanner(ParseDartTask_this.source, new CharSequenceReader(new CharSequence(contents)), errorListener);
token[0] = scanner.tokenize();
ParseDartTask_this.lineInfo = new LineInfo(scanner.lineStarts);
}
@@ -6958,17 +6982,17 @@ class ParseHtmlTask extends AnalysisTask {
*/
List<Source> get librarySources {
List<Source> libraries = new List<Source>();
- htmlUnit.accept(new RecursiveXmlVisitor_10(this, libraries));
+ htmlUnit.accept(new RecursiveXmlVisitor_12(this, libraries));
if (libraries.isEmpty) {
return Source.EMPTY_ARRAY;
}
return new List.from(libraries);
}
}
-class RecursiveXmlVisitor_10 extends RecursiveXmlVisitor<Object> {
+class RecursiveXmlVisitor_12 extends RecursiveXmlVisitor<Object> {
final ParseHtmlTask ParseHtmlTask_this;
List<Source> libraries;
- RecursiveXmlVisitor_10(this.ParseHtmlTask_this, this.libraries) : super();
+ RecursiveXmlVisitor_12(this.ParseHtmlTask_this, this.libraries) : super();
Object visitXmlTagNode(XmlTagNode node) {
if (javaStringEqualsIgnoreCase(node.tag.lexeme, ParseHtmlTask._TAG_SCRIPT)) {
bool isDartScript = false;
« no previous file with comments | « pkg/analyzer_experimental/lib/src/generated/element.dart ('k') | pkg/analyzer_experimental/lib/src/generated/error.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698