diff --git a/pkg/analyzer/lib/src/generated/ast.dart b/pkg/analyzer/lib/src/generated/ast.dart index 15763a74146..324c06bec14 100644 --- a/pkg/analyzer/lib/src/generated/ast.dart +++ b/pkg/analyzer/lib/src/generated/ast.dart @@ -10009,7 +10009,7 @@ class SimpleIdentifier extends Identifier { */ Element validateElement(ASTNode parent, Type expectedClass, Element element) { if (!isInstanceOf(element, expectedClass)) { - AnalysisEngine.instance.logger.logInformation2("Internal error: attempting to set the name of a ${parent.runtimeType.toString()} to a ${element.runtimeType.toString()}", new JavaException()); + AnalysisEngine.instance.logger.logInformation3("Internal error: attempting to set the name of a ${parent.runtimeType.toString()} to a ${element.runtimeType.toString()}", new JavaException()); return null; } return element; @@ -12369,6 +12369,25 @@ class ElementLocator_ElementMapper extends GeneralizingASTVisitor { Element visitIdentifier(Identifier node) { ASTNode parent = node.parent; + // Type name in InstanceCreationExpression + { + ASTNode typeNameCandidate = parent; + // new prefix.node[.constructorName]() + if (typeNameCandidate is PrefixedIdentifier) { + PrefixedIdentifier prefixedIdentifier = typeNameCandidate as PrefixedIdentifier; + if (identical(prefixedIdentifier.identifier, node)) { + typeNameCandidate = prefixedIdentifier.parent; + } + } + // new typeName[.constructorName]() + if (typeNameCandidate is TypeName) { + TypeName typeName = typeNameCandidate as TypeName; + if (typeName.parent is ConstructorName) { + ConstructorName constructorName = typeName.parent as ConstructorName; + return constructorName.staticElement; + } + } + } // Extra work to map Constructor Declarations to their associated Constructor Elements if (parent is ConstructorDeclaration) { ConstructorDeclaration decl = parent; @@ -12771,7 +12790,7 @@ class NodeLocator extends UnifyingASTVisitor { node.accept(this); } on NodeLocator_NodeFoundException catch (exception) { } on JavaException catch (exception) { - AnalysisEngine.instance.logger.logInformation2("Unable to locate element at offset (${_startOffset} - ${_endOffset})", exception); + AnalysisEngine.instance.logger.logInformation3("Unable to locate element at offset (${_startOffset} - ${_endOffset})", exception); return null; } return _foundNode; @@ -12792,7 +12811,7 @@ class NodeLocator extends UnifyingASTVisitor { throw exception; } on JavaException catch (exception) { // Ignore the exception and proceed in order to visit the rest of the structure. - AnalysisEngine.instance.logger.logInformation2("Exception caught while traversing an AST structure.", exception); + AnalysisEngine.instance.logger.logInformation3("Exception caught while traversing an AST structure.", exception); } if (start <= _startOffset && _endOffset <= end) { _foundNode = node; diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart index 1e1c3b437b7..a63861f16b7 100644 --- a/pkg/analyzer/lib/src/generated/engine.dart +++ b/pkg/analyzer/lib/src/generated/engine.dart @@ -1739,11 +1739,8 @@ class DartEntryImpl extends SourceEntryImpl implements DartEntry { } } - /** - * Invalidate all of the information associated with the compilation unit. - */ void invalidateAllInformation() { - setState(SourceEntry.LINE_INFO, CacheState.INVALID); + super.invalidateAllInformation(); _sourceKind = SourceKind.UNKNOWN; _sourceKindState = CacheState.INVALID; _parseErrors = AnalysisError.NO_ERRORS; @@ -2579,11 +2576,8 @@ class HtmlEntryImpl extends SourceEntryImpl implements HtmlEntry { return copy; } - /** - * Invalidate all of the information associated with the HTML file. - */ void invalidateAllInformation() { - setState(SourceEntry.LINE_INFO, CacheState.INVALID); + super.invalidateAllInformation(); _parseErrors = AnalysisError.NO_ERRORS; _parseErrorsState = CacheState.INVALID; _parsedUnit = null; @@ -2848,6 +2842,14 @@ abstract class SourceEntryImpl implements SourceEntry { } } + /** + * Invalidate all of the information associated with this source. + */ + void invalidateAllInformation() { + _lineInfo = null; + _lineInfoState = CacheState.INVALID; + } + /** * Set the most recent time at which the state of the source matched the state represented by this * entry to the given time. @@ -3068,6 +3070,12 @@ class AnalysisContextImpl implements InternalAnalysisContext { */ Map _pendingNotices = new Map(); + /** + * A set containing information about the tasks that have been performed since the last change + * notification. Used to detect infinite loops in [performAnalysisTask]. + */ + Set _recentTasks = new Set(); + /** * The object used to synchronize access to all of the caches. The rules related to the use of * this lock object are @@ -3110,6 +3118,7 @@ class AnalysisContextImpl implements InternalAnalysisContext { return; } { + _recentTasks.clear(); // // First, compute the list of sources that have been removed. // @@ -3137,6 +3146,7 @@ class AnalysisContextImpl implements InternalAnalysisContext { // that might have been referencing the not-yet-existing source that was just added. Longer // term we need to keep track of which libraries are referencing non-existing sources and // only re-analyze those libraries. + logInformation("Added Dart sources, invalidating all resolution information"); for (MapEntry mapEntry in _cache.entrySet()) { SourceEntry sourceEntry = mapEntry.getValue(); if (!mapEntry.getKey().isInSystemLibrary && sourceEntry is DartEntry) { @@ -3714,10 +3724,18 @@ class AnalysisContextImpl implements InternalAnalysisContext { int getStart = JavaSystem.currentTimeMillis(); AnalysisTask task = nextTaskAnalysisTask; int getEnd = JavaSystem.currentTimeMillis(); + if (task == null && validateCacheConsistency()) { + task = nextTaskAnalysisTask; + } if (task == null) { return new AnalysisResult(getChangeNotices(true), getEnd - getStart, null, -1); } - //System.out.println(task); + String taskDescriptor = task.toString(); + if (_recentTasks.add(taskDescriptor)) { + logInformation("Performing task: ${taskDescriptor}"); + } else { + logInformation("*** Performing repeated task: ${taskDescriptor}"); + } int performStart = JavaSystem.currentTimeMillis(); try { task.perform(_resultRecorder); @@ -3819,6 +3837,7 @@ class AnalysisContextImpl implements InternalAnalysisContext { void setChangedContents(Source source, String contents, int offset, int oldLength, int newLength) { { + _recentTasks.clear(); String originalContents = _sourceFactory.setContents(source, contents); if (contents != null) { if (contents != originalContents) { @@ -3836,6 +3855,7 @@ class AnalysisContextImpl implements InternalAnalysisContext { void setContents(Source source, String contents) { { + _recentTasks.clear(); String originalContents = _sourceFactory.setContents(source, contents); if (contents != null) { if (contents != originalContents) { @@ -3954,11 +3974,14 @@ class AnalysisContextImpl implements InternalAnalysisContext { } } } else { + PrintStringWriter writer = new PrintStringWriter(); + writer.println("Library resolution results discarded for"); for (Library library in resolvedLibraries) { for (Source source in library.compilationUnitSources) { DartEntry dartEntry = getReadableDartEntry(source); if (dartEntry != null) { int resultTime = library.getModificationTime(source); + writer.println(" ${debuggingString(source)}; sourceTime = ${source.modificationStamp}, resultTime = ${resultTime}, cacheTime = ${dartEntry.modificationTime}"); DartEntryImpl dartCopy = dartEntry.writableCopy; if (thrownException == null || resultTime >= 0) { // @@ -3979,9 +4002,12 @@ class AnalysisContextImpl implements InternalAnalysisContext { if (source == unitSource) { unitEntry = dartCopy; } + } else { + writer.println(" ${debuggingString(source)}; sourceTime = ${source.modificationStamp}, no entry"); } } } + logInformation(writer.toString()); } } } @@ -4288,6 +4314,15 @@ class AnalysisContextImpl implements InternalAnalysisContext { } } + /** + * Return a string with debugging information about the given source (the full name and + * modification stamp of the source). + * + * @param source the source for which a debugging string is to be produced + * @return debugging information about the given source + */ + String debuggingString(Source source) => "'${source.fullName}' [${source.modificationStamp}]"; + /** * Return an array containing all of the change notices that are waiting to be returned. If there * are no notices, then return either `null` or an empty array, depending on the value of @@ -4845,8 +4880,9 @@ class AnalysisContextImpl implements InternalAnalysisContext { * Note: This method must only be invoked while we are synchronized on [cacheLock]. * * @param librarySource the source of the library being invalidated + * @param writer the writer to which debugging information should be written */ - void invalidateLibraryResolution(Source librarySource) { + void invalidateLibraryResolution(Source librarySource, PrintStringWriter writer) { // TODO(brianwilkerson) This could be optimized. There's no need to flush all of these caches if // the public namespace hasn't changed, which will be a fairly common case. The question is // whether we can afford the time to compute the namespace to look for differences. @@ -4854,15 +4890,23 @@ class AnalysisContextImpl implements InternalAnalysisContext { if (libraryEntry != null) { List includedParts = libraryEntry.getValue(DartEntry.INCLUDED_PARTS); DartEntryImpl libraryCopy = libraryEntry.writableCopy; + int oldTime = libraryCopy.modificationTime; libraryCopy.invalidateAllResolutionInformation(); libraryCopy.setState(DartEntry.INCLUDED_PARTS, CacheState.INVALID); _cache.put(librarySource, libraryCopy); + if (writer != null) { + writer.println(" Invalidated library source: ${debuggingString(librarySource)} (previously modified at ${oldTime})"); + } for (Source partSource in includedParts) { SourceEntry partEntry = _cache.get(partSource); if (partEntry is DartEntry) { DartEntryImpl partCopy = partEntry.writableCopy; + oldTime = partCopy.modificationTime; partCopy.invalidateAllResolutionInformation(); _cache.put(partSource, partCopy); + if (writer != null) { + writer.println(" Invalidated part source: ${debuggingString(partSource)} (previously modified at ${oldTime})"); + } } } } @@ -4897,6 +4941,29 @@ class AnalysisContextImpl implements InternalAnalysisContext { return false; } + /** + * Log the given debugging information. + * + * @param message the message to be added to the log + */ + void logInformation(String message) { + AnalysisEngine.instance.logger.logInformation(message); + } + + /** + * Log the given debugging information. + * + * @param message the message to be added to the log + * @param exception the exception to be included in the log entry + */ + void logInformation2(String message, Exception exception) { + if (exception == null) { + AnalysisEngine.instance.logger.logInformation(message); + } else { + AnalysisEngine.instance.logger.logInformation3(message, exception); + } + } + /** * Given a cache entry and a library element, record the library element and other information * gleaned from the element in the cache entry. @@ -4963,6 +5030,7 @@ class AnalysisContextImpl implements InternalAnalysisContext { _cache.put(source, dartCopy); dartEntry = dartCopy; } else { + logInformation2("Generated errors discarded for ${debuggingString(source)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${dartEntry.modificationTime}", thrownException); DartEntryImpl dartCopy = dartEntry.writableCopy; if (thrownException == null || resultTime >= 0) { // @@ -5060,6 +5128,7 @@ class AnalysisContextImpl implements InternalAnalysisContext { _cache.put(unitSource, dartCopy); dartEntry = dartCopy; } else { + logInformation2("Generated hints discarded for ${debuggingString(unitSource)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${dartEntry.modificationTime}", thrownException); if (identical(dartEntry.getState2(DartEntry.HINTS, librarySource), CacheState.IN_PROCESS)) { DartEntryImpl dartCopy = dartEntry.writableCopy; if (thrownException == null || resultTime >= 0) { @@ -5166,6 +5235,7 @@ class AnalysisContextImpl implements InternalAnalysisContext { _cache.put(source, dartCopy); dartEntry = dartCopy; } else { + logInformation2("Parse results discarded for ${debuggingString(source)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${dartEntry.modificationTime}", thrownException); DartEntryImpl dartCopy = dartEntry.writableCopy; if (thrownException == null || resultTime >= 0) { // @@ -5241,6 +5311,7 @@ class AnalysisContextImpl implements InternalAnalysisContext { _cache.put(source, htmlCopy); htmlEntry = htmlCopy; } else { + logInformation2("Parse results discarded for ${debuggingString(source)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${htmlEntry.modificationTime}", thrownException); HtmlEntryImpl htmlCopy = (sourceEntry as HtmlEntry).writableCopy; if (thrownException == null || resultTime >= 0) { // @@ -5320,6 +5391,7 @@ class AnalysisContextImpl implements InternalAnalysisContext { _cache.put(unitSource, dartCopy); dartEntry = dartCopy; } else { + logInformation2("Resolution results discarded for ${debuggingString(unitSource)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${dartEntry.modificationTime}", thrownException); DartEntryImpl dartCopy = dartEntry.writableCopy; if (thrownException == null || resultTime >= 0) { // @@ -5394,6 +5466,7 @@ class AnalysisContextImpl implements InternalAnalysisContext { _cache.put(source, htmlCopy); htmlEntry = htmlCopy; } else { + logInformation2("Resolution results discarded for ${debuggingString(source)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${htmlEntry.modificationTime}", thrownException); HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; if (thrownException == null || resultTime >= 0) { // @@ -5438,10 +5511,14 @@ class AnalysisContextImpl implements InternalAnalysisContext { SourceEntry sourceEntry = _cache.get(source); if (sourceEntry == null) { sourceEntry = createSourceEntry(source); + logInformation("Added new source: ${debuggingString(source)}"); } else { SourceEntryImpl sourceCopy = sourceEntry.writableCopy; + int oldTime = sourceCopy.modificationTime; sourceCopy.modificationTime = source.modificationStamp; + // TODO(brianwilkerson) Understand why we're not invalidating the cache. _cache.put(source, sourceCopy); + logInformation("Added new source: ${debuggingString(source)} (previously modified at ${oldTime})"); } return sourceEntry is DartEntry; } @@ -5456,13 +5533,20 @@ class AnalysisContextImpl implements InternalAnalysisContext { if (sourceEntry == null || sourceEntry.modificationTime == source.modificationStamp) { // Either we have removed this source, in which case we don't care that it is changed, or we // have already invalidated the cache and don't need to invalidate it again. + if (sourceEntry == null) { + logInformation("Modified source, but there is no entry: ${debuggingString(source)}"); + } else { + logInformation("Modified source, but modification time matches: ${debuggingString(source)}"); + } return; } if (sourceEntry is HtmlEntry) { HtmlEntryImpl htmlCopy = sourceEntry.writableCopy; + int oldTime = htmlCopy.modificationTime; htmlCopy.modificationTime = source.modificationStamp; htmlCopy.invalidateAllInformation(); _cache.put(source, htmlCopy); + logInformation("Modified HTML source: ${debuggingString(source)} (previously modified at ${oldTime})"); } else if (sourceEntry is DartEntry) { List containingLibraries = getLibrariesContaining(source); Set librariesToInvalidate = new Set(); @@ -5472,14 +5556,18 @@ class AnalysisContextImpl implements InternalAnalysisContext { librariesToInvalidate.add(dependentLibrary); } } + PrintStringWriter writer = new PrintStringWriter(); + int oldTime = sourceEntry.modificationTime; + writer.println("Modified Dart source: ${debuggingString(source)} (previously modified at ${oldTime})"); for (Source library in librariesToInvalidate) { // for (Source library : containingLibraries) { - invalidateLibraryResolution(library); + invalidateLibraryResolution(library, writer); } DartEntryImpl dartCopy = sourceEntry.writableCopy; dartCopy.modificationTime = source.modificationStamp; dartCopy.invalidateAllInformation(); _cache.put(source, dartCopy); + logInformation(writer.toString()); } } @@ -5489,6 +5577,8 @@ class AnalysisContextImpl implements InternalAnalysisContext { * @param source the source that has been deleted */ void sourceRemoved(Source source) { + PrintStringWriter writer = new PrintStringWriter(); + writer.println("Removed source: ${debuggingString(source)}"); SourceEntry sourceEntry = _cache.get(source); if (sourceEntry is DartEntry) { Set libraries = new Set(); @@ -5499,10 +5589,39 @@ class AnalysisContextImpl implements InternalAnalysisContext { } } for (Source librarySource in libraries) { - invalidateLibraryResolution(librarySource); + invalidateLibraryResolution(librarySource, writer); } } _cache.remove(source); + logInformation(writer.toString()); + } + + /** + * 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. + * + * Note: This method must only be invoked while we are synchronized on [cacheLock]. + * + * @return `true` if at least one entry was invalid + */ + bool validateCacheConsistency() { + int consistencyCheckStart = JavaSystem.nanoTime(); + int inconsistentCount = 0; + { + for (MapEntry entry in _cache.entrySet()) { + Source source = entry.getKey(); + SourceEntry sourceEntry = entry.getValue(); + int sourceTime = source.modificationStamp; + if (sourceTime != sourceEntry.modificationTime) { + sourceChanged(source); + inconsistentCount++; + } + } + } + int consistencyCheckEnd = JavaSystem.nanoTime(); + logInformation("Consistency check found ${inconsistentCount} inconsistent entries in ${((consistencyCheckEnd - consistencyCheckStart) / 1000000.0)} ms"); + return inconsistentCount > 0; } } @@ -7185,7 +7304,7 @@ abstract class AnalysisTask { safelyPerform(); } on AnalysisException catch (exception) { _thrownException = exception; - AnalysisEngine.instance.logger.logInformation2("Task failed: ${taskDescription}", exception); + AnalysisEngine.instance.logger.logInformation3("Task failed: ${taskDescription}", exception); } return accept(visitor); } @@ -8330,7 +8449,7 @@ abstract class Logger { * @param message an explanation of why the error occurred or what it means * @param exception the exception being logged */ - void logInformation2(String message, Exception exception); + void logInformation3(String message, Exception exception); } /** @@ -8349,6 +8468,6 @@ class Logger_NullLogger implements Logger { void logInformation(String message) { } - void logInformation2(String message, Exception exception) { + void logInformation3(String message, Exception exception) { } } \ No newline at end of file diff --git a/pkg/analyzer/lib/src/generated/java_core.dart b/pkg/analyzer/lib/src/generated/java_core.dart index 574cba4ba33..255ea312dc1 100644 --- a/pkg/analyzer/lib/src/generated/java_core.dart +++ b/pkg/analyzer/lib/src/generated/java_core.dart @@ -2,11 +2,20 @@ library java.core; import "dart:math" as math; +final Stopwatch nanoTimeStopwatch = new Stopwatch(); + class JavaSystem { static int currentTimeMillis() { return (new DateTime.now()).millisecondsSinceEpoch; } + static int nanoTime() { + if (!nanoTimeStopwatch.isRunning) { + nanoTimeStopwatch.start(); + } + return nanoTimeStopwatch.elapsedMicroseconds * 1000; + } + static void arraycopy(List src, int srcPos, List dest, int destPos, int length) { for (int i = 0; i < length; i++) { dest[destPos + i] = src[srcPos + i]; diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart index f8b90e975fe..b6edb953910 100644 --- a/pkg/analyzer/lib/src/generated/resolver.dart +++ b/pkg/analyzer/lib/src/generated/resolver.dart @@ -264,6 +264,10 @@ class AngularCompilationUnitBuilder { // process annotations NodeList annotations = _classDeclaration.metadata; for (Annotation annotation in annotations) { + // verify annotation + if (annotation.arguments == null) { + continue; + } this._annotation = annotation; // @NgFilter if (isAngularAnnotation2(_NG_FILTER)) { diff --git a/pkg/analyzer/lib/src/generated/sdk.dart b/pkg/analyzer/lib/src/generated/sdk.dart index 9697515f483..82d89fb0c00 100644 --- a/pkg/analyzer/lib/src/generated/sdk.dart +++ b/pkg/analyzer/lib/src/generated/sdk.dart @@ -8,6 +8,7 @@ library engine.sdk; import 'source.dart' show ContentCache, Source, UriKind; +import 'ast.dart'; import 'engine.dart' show AnalysisContext; /** @@ -194,6 +195,87 @@ class SdkLibraryImpl implements SdkLibrary { } } +class SdkLibrariesReader_LibraryBuilder extends RecursiveASTVisitor { + /** + * The prefix added to the name of a library to form the URI used in code to reference the + * library. + */ + static String _LIBRARY_PREFIX = "dart:"; + + /** + * The name of the optional parameter used to indicate whether the library is an implementation + * library. + */ + static String _IMPLEMENTATION = "implementation"; + + /** + * The name of the optional parameter used to indicate whether the library is documented. + */ + static String _DOCUMENTED = "documented"; + + /** + * The name of the optional parameter used to specify the category of the library. + */ + static String _CATEGORY = "category"; + + /** + * The name of the optional parameter used to specify the platforms on which the library can be + * used. + */ + static String _PLATFORMS = "platforms"; + + /** + * The value of the [PLATFORMS] parameter used to specify that the library can + * be used on the VM. + */ + static String _VM_PLATFORM = "VM_PLATFORM"; + + /** + * The library map that is populated by visiting the AST structure parsed from the contents of + * the libraries file. + */ + final LibraryMap librariesMap = new LibraryMap(); + + Object visitMapLiteralEntry(MapLiteralEntry node) { + String libraryName = null; + Expression key = node.key; + if (key is SimpleStringLiteral) { + libraryName = "${_LIBRARY_PREFIX}${key.value}"; + } + Expression value = node.value; + if (value is InstanceCreationExpression) { + SdkLibraryImpl library = new SdkLibraryImpl(libraryName); + List arguments = value.argumentList.arguments; + for (Expression argument in arguments) { + if (argument is SimpleStringLiteral) { + library.path = argument.value; + } else if (argument is NamedExpression) { + String name = argument.name.label.name; + Expression expression = argument.expression; + if (name == _CATEGORY) { + library.category = (expression as SimpleStringLiteral).value; + } else if (name == _IMPLEMENTATION) { + library.implementation = (expression as BooleanLiteral).value; + } else if (name == _DOCUMENTED) { + library.documented = (expression as BooleanLiteral).value; + } else if (name == _PLATFORMS) { + if (expression is SimpleIdentifier) { + String identifier = expression.name; + if (identifier == _VM_PLATFORM) { + library.setVmLibrary(); + } else { + library.setDart2JsLibrary(); + } + } + } + } + } + librariesMap.setLibrary(libraryName, library); + } + return null; + } +} + /** * Instances of the class `LibraryMap` map Dart library URI's to the [SdkLibraryImpl ]. diff --git a/pkg/analyzer/lib/src/generated/sdk_io.dart b/pkg/analyzer/lib/src/generated/sdk_io.dart index eaca50f878c..c0839500fb0 100644 --- a/pkg/analyzer/lib/src/generated/sdk_io.dart +++ b/pkg/analyzer/lib/src/generated/sdk_io.dart @@ -190,27 +190,6 @@ class DirectoryBasedDartSdk implements DartSdk { _analysisContext.applyChanges(changeSet); } - /** - * Initialize a newly created SDK to represent the Dart SDK installed in the given directory. - * - * Added in order to test AnalysisContextImpl2. - * - * @param sdkDirectory the directory containing the SDK - */ - DirectoryBasedDartSdk.con1(JavaFile sdkDirectory, bool ignored) { - this._sdkDirectory = sdkDirectory.getAbsoluteFile(); - initializeSdk(); - initializeLibraryMap(); - _analysisContext = new AnalysisContextImpl(); - _analysisContext.sourceFactory = new SourceFactory.con2([new DartUriResolver(this)]); - List uris = this.uris; - ChangeSet changeSet = new ChangeSet(); - for (String uri in uris) { - changeSet.added(_analysisContext.sourceFactory.forUri(uri)); - } - _analysisContext.applyChanges(changeSet); - } - Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) => new FileBasedSource.con2(contentCache, new JavaFile.fromUri(uri), kind); AnalysisContext get context => _analysisContext; @@ -479,85 +458,4 @@ class SdkLibrariesReader { } return libraryBuilder.librariesMap; } -} - -class SdkLibrariesReader_LibraryBuilder extends RecursiveASTVisitor { - /** - * The prefix added to the name of a library to form the URI used in code to reference the - * library. - */ - static String _LIBRARY_PREFIX = "dart:"; - - /** - * The name of the optional parameter used to indicate whether the library is an implementation - * library. - */ - static String _IMPLEMENTATION = "implementation"; - - /** - * The name of the optional parameter used to indicate whether the library is documented. - */ - static String _DOCUMENTED = "documented"; - - /** - * The name of the optional parameter used to specify the category of the library. - */ - static String _CATEGORY = "category"; - - /** - * The name of the optional parameter used to specify the platforms on which the library can be - * used. - */ - static String _PLATFORMS = "platforms"; - - /** - * The value of the [PLATFORMS] parameter used to specify that the library can - * be used on the VM. - */ - static String _VM_PLATFORM = "VM_PLATFORM"; - - /** - * The library map that is populated by visiting the AST structure parsed from the contents of - * the libraries file. - */ - final LibraryMap librariesMap = new LibraryMap(); - - Object visitMapLiteralEntry(MapLiteralEntry node) { - String libraryName = null; - Expression key = node.key; - if (key is SimpleStringLiteral) { - libraryName = "${_LIBRARY_PREFIX}${key.value}"; - } - Expression value = node.value; - if (value is InstanceCreationExpression) { - SdkLibraryImpl library = new SdkLibraryImpl(libraryName); - List arguments = value.argumentList.arguments; - for (Expression argument in arguments) { - if (argument is SimpleStringLiteral) { - library.path = argument.value; - } else if (argument is NamedExpression) { - String name = argument.name.label.name; - Expression expression = argument.expression; - if (name == _CATEGORY) { - library.category = (expression as SimpleStringLiteral).value; - } else if (name == _IMPLEMENTATION) { - library.implementation = (expression as BooleanLiteral).value; - } else if (name == _DOCUMENTED) { - library.documented = (expression as BooleanLiteral).value; - } else if (name == _PLATFORMS) { - if (expression is SimpleIdentifier) { - String identifier = expression.name; - if (identifier == _VM_PLATFORM) { - library.setVmLibrary(); - } else { - library.setDart2JsLibrary(); - } - } - } - } - } - librariesMap.setLibrary(libraryName, library); - } - return null; - } } \ No newline at end of file diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml index 5c2b129ab6d..5bc18ae5fd4 100644 --- a/pkg/analyzer/pubspec.yaml +++ b/pkg/analyzer/pubspec.yaml @@ -1,5 +1,5 @@ name: analyzer -version: 0.11.7 +version: 0.11.8 author: Dart Team description: Static analyzer for Dart. homepage: http://www.dartlang.org diff --git a/tests/co19/co19-analyzer2.status b/tests/co19/co19-analyzer2.status index 464640f6346..53a5aea9c8c 100644 --- a/tests/co19/co19-analyzer2.status +++ b/tests/co19/co19-analyzer2.status @@ -4,6 +4,8 @@ [ $compiler == dart2analyzer ] +LibTest/core/RegExp/firstMatch_A01_t01: Fail + # invalid argument for constant constructor Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t02: fail diff --git a/tests/language/language_analyzer.status b/tests/language/language_analyzer.status index c4886a9ccb4..11f4106eef4 100644 --- a/tests/language/language_analyzer.status +++ b/tests/language/language_analyzer.status @@ -2,7 +2,7 @@ # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. -[ $compiler == dartanalyzer ] +[ $compiler == dart2analyzer ] # Runtime negative test. No static errors or warnings. closure_call_wrong_argument_count_negative_test: skip diff --git a/tests/language/language_analyzer2.status b/tests/language/language_analyzer2.status index 0cdd781d706..c4886a9ccb4 100644 --- a/tests/language/language_analyzer2.status +++ b/tests/language/language_analyzer2.status @@ -2,7 +2,7 @@ # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. -[ $compiler == dart2analyzer ] +[ $compiler == dartanalyzer ] # Runtime negative test. No static errors or warnings. closure_call_wrong_argument_count_negative_test: skip @@ -336,6 +336,9 @@ mixin_type_parameters_mixin_test: StaticWarning mixin_type_parameters_super_extends_test: StaticWarning mixin_type_parameters_super_test: StaticWarning mixin_with_two_implicit_constructors_test: StaticWarning +mixin_bound_test: StaticWarning +mixin_invalid_bound_test/none: StaticWarning # legitimate StaticWarning, cannot be annotated +mixin_invalid_bound2_test/none: StaticWarning # legitimate StaticWarning, cannot be annotated named_constructor_test/01: StaticWarning named_constructor_test/03: StaticWarning named_parameters2_test: StaticWarning