Version 1.8.0-dev.2.0
svn merge -r 41254:41388 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
git-svn-id: http://dart.googlecode.com/svn/trunk@41389 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/LICENSE b/LICENSE
index 7af3211..fa95f12 100644
--- a/LICENSE
+++ b/LICENSE
@@ -17,8 +17,11 @@
Httplib2 - in samples/third_party/httplib2
JSON - in third_party/json
JUnit - in third_party/junit
+NSS - in third_party/nss and third_party/net_nss
Oauth - in samples/third_party/oauth2client
+SQLite - in third_party/sqlite
weberknecht - in third_party/weberknecht
+zlib - in third_party/zlib
fest - in third_party/fest
mockito - in third_party/mockito
diff --git a/pkg/analysis_server/bin/dartdeps.dart b/pkg/analysis_server/bin/dartdeps.dart
index 6fdcb8b..c0eaad4 100644
--- a/pkg/analysis_server/bin/dartdeps.dart
+++ b/pkg/analysis_server/bin/dartdeps.dart
@@ -28,7 +28,7 @@
*/
class _DartDependencyAnalyzer {
/**
- * The name of the application that is used to start the analyzer.
+ * The name of the application that is used to start the dependency analyzer.
*/
static const BINARY_NAME = 'dartdeps';
@@ -180,6 +180,6 @@
print('Usage: $BINARY_NAME [flags] <application_directory>');
print('');
print('Supported flags are:');
- print(parser.getUsage());
+ print(parser.usage);
}
}
diff --git a/pkg/analysis_server/bin/fuzz.dart b/pkg/analysis_server/bin/fuzz.dart
index 8fc71d9..2ca29c2 100644
--- a/pkg/analysis_server/bin/fuzz.dart
+++ b/pkg/analysis_server/bin/fuzz.dart
@@ -25,6 +25,10 @@
* containing sources to be analyzed.
*/
class _FuzzTest {
+ /**
+ * The name of the application that is used to start the fuzz tester.
+ */
+ static const BINARY_NAME = 'fuzz';
//TODO (danrubel) extract common behavior for use in multiple test scenarios
//TODO (danrubel) cleanup test to use async/await for better readability
@@ -158,9 +162,9 @@
/// Print information about how to use the server.
void _printUsage(ArgParser parser) {
- print('Usage: analyzer [flags] <application_directory>');
+ print('Usage: $BINARY_NAME [flags] <application_directory>');
print('');
print('Supported flags are:');
- print(parser.getUsage());
+ print(parser.usage);
}
}
diff --git a/pkg/analysis_server/doc/api.html b/pkg/analysis_server/doc/api.html
index 12552c5..4b0c556 100644
--- a/pkg/analysis_server/doc/api.html
+++ b/pkg/analysis_server/doc/api.html
@@ -804,8 +804,9 @@
</dd><dt class="field"><b><i>regions ( List<<a href="#type_NavigationRegion">NavigationRegion</a>> )</i></b></dt><dd>
<p>
- The navigation regions contained in the file. Each
- navigation region represents a list of targets
+ The navigation regions contained in the file.
+ The regions are sorted by their offsets.
+ Each navigation region represents a list of targets
associated with some range. The lists will usually
contain a single target, but can contain more in the
case of a part that is included in multiple libraries
@@ -2250,7 +2251,7 @@
applied to files.
</p>
- <dl><dt class="value">ANNOTATION</dt><dt class="value">BUILT_IN</dt><dt class="value">CLASS</dt><dt class="value">COMMENT_BLOCK</dt><dt class="value">COMMENT_DOCUMENTATION</dt><dt class="value">COMMENT_END_OF_LINE</dt><dt class="value">CONSTRUCTOR</dt><dt class="value">DIRECTIVE</dt><dt class="value">DYNAMIC_TYPE</dt><dt class="value">FIELD</dt><dt class="value">FIELD_STATIC</dt><dt class="value">FUNCTION</dt><dt class="value">FUNCTION_DECLARATION</dt><dt class="value">FUNCTION_TYPE_ALIAS</dt><dt class="value">GETTER_DECLARATION</dt><dt class="value">IDENTIFIER_DEFAULT</dt><dt class="value">IMPORT_PREFIX</dt><dt class="value">KEYWORD</dt><dt class="value">LABEL</dt><dt class="value">LITERAL_BOOLEAN</dt><dt class="value">LITERAL_DOUBLE</dt><dt class="value">LITERAL_INTEGER</dt><dt class="value">LITERAL_LIST</dt><dt class="value">LITERAL_MAP</dt><dt class="value">LITERAL_STRING</dt><dt class="value">LOCAL_VARIABLE</dt><dt class="value">LOCAL_VARIABLE_DECLARATION</dt><dt class="value">METHOD</dt><dt class="value">METHOD_DECLARATION</dt><dt class="value">METHOD_DECLARATION_STATIC</dt><dt class="value">METHOD_STATIC</dt><dt class="value">PARAMETER</dt><dt class="value">SETTER_DECLARATION</dt><dt class="value">TOP_LEVEL_VARIABLE</dt><dt class="value">TYPE_NAME_DYNAMIC</dt><dt class="value">TYPE_PARAMETER</dt></dl></dd><dt class="typeDefinition"><a name="type_HoverInformation">HoverInformation: object</a></dt><dd>
+ <dl><dt class="value">ANNOTATION</dt><dt class="value">BUILT_IN</dt><dt class="value">CLASS</dt><dt class="value">COMMENT_BLOCK</dt><dt class="value">COMMENT_DOCUMENTATION</dt><dt class="value">COMMENT_END_OF_LINE</dt><dt class="value">CONSTRUCTOR</dt><dt class="value">DIRECTIVE</dt><dt class="value">DYNAMIC_TYPE</dt><dt class="value">ENUM</dt><dt class="value">ENUM_CONSTANT</dt><dt class="value">FIELD</dt><dt class="value">FIELD_STATIC</dt><dt class="value">FUNCTION</dt><dt class="value">FUNCTION_DECLARATION</dt><dt class="value">FUNCTION_TYPE_ALIAS</dt><dt class="value">GETTER_DECLARATION</dt><dt class="value">IDENTIFIER_DEFAULT</dt><dt class="value">IMPORT_PREFIX</dt><dt class="value">KEYWORD</dt><dt class="value">LABEL</dt><dt class="value">LITERAL_BOOLEAN</dt><dt class="value">LITERAL_DOUBLE</dt><dt class="value">LITERAL_INTEGER</dt><dt class="value">LITERAL_LIST</dt><dt class="value">LITERAL_MAP</dt><dt class="value">LITERAL_STRING</dt><dt class="value">LOCAL_VARIABLE</dt><dt class="value">LOCAL_VARIABLE_DECLARATION</dt><dt class="value">METHOD</dt><dt class="value">METHOD_DECLARATION</dt><dt class="value">METHOD_DECLARATION_STATIC</dt><dt class="value">METHOD_STATIC</dt><dt class="value">PARAMETER</dt><dt class="value">SETTER_DECLARATION</dt><dt class="value">TOP_LEVEL_VARIABLE</dt><dt class="value">TYPE_NAME_DYNAMIC</dt><dt class="value">TYPE_PARAMETER</dt></dl></dd><dt class="typeDefinition"><a name="type_HoverInformation">HoverInformation: object</a></dt><dd>
<p>
The hover information associated with a specific location.
</p>
diff --git a/pkg/analysis_server/lib/driver.dart b/pkg/analysis_server/lib/driver.dart
index 284cf60..597dc19 100644
--- a/pkg/analysis_server/lib/driver.dart
+++ b/pkg/analysis_server/lib/driver.dart
@@ -4,6 +4,7 @@
library driver;
+import 'dart:async';
import 'dart:io';
import 'package:analysis_server/http_server.dart';
@@ -125,12 +126,28 @@
if (serve_http) {
httpServer.serveHttp(port);
}
- stdioServer.serveStdio().then((_) {
- if (serve_http) {
- httpServer.close();
- }
- exit(0);
+ _capturePrints(() {
+ stdioServer.serveStdio().then((_) {
+ if (serve_http) {
+ httpServer.close();
+ }
+ exit(0);
+ });
+ }, httpServer.recordPrint);
+ }
+
+ /**
+ * Execute [callback], capturing any data it prints out and redirecting it to
+ * the function [printHandler].
+ */
+ dynamic _capturePrints(dynamic callback(), void printHandler(String line)) {
+ ZoneSpecification zoneSpecification = new ZoneSpecification(print:
+ (Zone self, ZoneDelegate parent, Zone zone, String line) {
+ printHandler(line);
+ // Note: we don't pass the line on to stdout, because that is reserved
+ // for communication to the client.
});
+ return runZoned(callback, zoneSpecification: zoneSpecification);
}
/**
@@ -140,6 +157,6 @@
print('Usage: $BINARY_NAME [flags]');
print('');
print('Supported flags are:');
- print(parser.getUsage());
+ print(parser.usage);
}
}
diff --git a/pkg/analysis_server/lib/http_server.dart b/pkg/analysis_server/lib/http_server.dart
index 1fbd0af..ef22a81 100644
--- a/pkg/analysis_server/lib/http_server.dart
+++ b/pkg/analysis_server/lib/http_server.dart
@@ -18,6 +18,11 @@
*/
class HttpAnalysisServer {
/**
+ * Number of lines of print output to capture.
+ */
+ static const int MAX_PRINT_BUFFER_LENGTH = 1000;
+
+ /**
* An object that can handle either a WebSocket connection or a connection
* to the client over stdio.
*/
@@ -39,6 +44,11 @@
Future<HttpServer> _server;
/**
+ * Last PRINT_BUFFER_LENGTH lines printed.
+ */
+ List<String> _printBuffer = <String>[];
+
+ /**
* Attach a listener to a newly created HTTP server.
*/
void _handleServer(HttpServer httServer) {
@@ -61,7 +71,7 @@
*/
void _handleGetRequest(HttpRequest request) {
if (getHandler == null) {
- getHandler = new GetHandler(socketServer);
+ getHandler = new GetHandler(socketServer, _printBuffer);
}
getHandler.handleGetRequest(request);
}
@@ -99,4 +109,15 @@
server.close();
});
}
+
+ /**
+ * Record that the given line was printed out by the analysis server.
+ */
+ void recordPrint(String line) {
+ _printBuffer.add(line);
+ if (_printBuffer.length > MAX_PRINT_BUFFER_LENGTH) {
+ _printBuffer.removeRange(0,
+ _printBuffer.length - MAX_PRINT_BUFFER_LENGTH);
+ }
+ }
}
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 6daf3e1..2ad03fd 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -16,7 +16,6 @@
import 'package:analysis_server/src/operation/operation_queue.dart';
import 'package:analysis_server/src/protocol.dart' hide Element;
import 'package:analyzer/source/package_map_provider.dart';
-import 'package:analyzer/source/package_map_resolver.dart';
import 'package:analyzer/src/generated/ast.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/source.dart';
@@ -42,10 +41,10 @@
: super(resourceProvider, packageMapProvider);
@override
- void addContext(Folder folder, Map<String, List<Folder>> packageMap) {
+ void addContext(Folder folder, UriResolver packageUriResolver) {
AnalysisContext context = AnalysisEngine.instance.createAnalysisContext();
analysisServer.folderMap[folder] = context;
- context.sourceFactory = _createSourceFactory(packageMap);
+ context.sourceFactory = _createSourceFactory(packageUriResolver);
context.analysisOptions = new AnalysisOptionsImpl.con1(defaultOptions);
analysisServer.schedulePerformAnalysisOperation(context);
}
@@ -71,22 +70,22 @@
}
@override
- void updateContextPackageMap(Folder contextFolder, Map<String,
- List<Folder>> packageMap) {
+ void updateContextPackageUriResolver(Folder contextFolder,
+ UriResolver packageUriResolver) {
AnalysisContext context = analysisServer.folderMap[contextFolder];
- context.sourceFactory = _createSourceFactory(packageMap);
+ context.sourceFactory = _createSourceFactory(packageUriResolver);
analysisServer.schedulePerformAnalysisOperation(context);
}
/**
* Set up a [SourceFactory] that resolves packages using the given
- * [packageMap].
+ * [packageUriResolver].
*/
- SourceFactory _createSourceFactory(Map<String, List<Folder>> packageMap) {
+ SourceFactory _createSourceFactory(UriResolver packageUriResolver) {
List<UriResolver> resolvers = <UriResolver>[
new DartUriResolver(analysisServer.defaultSdk),
new ResourceUriResolver(resourceProvider),
- new PackageMapUriResolver(resourceProvider, packageMap)];
+ packageUriResolver];
return new SourceFactory(resolvers);
}
}
@@ -181,14 +180,15 @@
/**
* A queue of the operations to perform in this server.
- *
- * Invariant: when this queue is non-empty, there is exactly one pending call
- * to [performOperation] on the event queue. When this list is empty, there are
- * no calls to [performOperation] on the event queue.
*/
ServerOperationQueue operationQueue;
/**
+ * True if there is a pending future which will execute [performOperation].
+ */
+ bool performOperationPending = false;
+
+ /**
* A set of the [ServerService]s to send notifications for.
*/
Set<ServerService> serverServices = new HashSet<ServerService>();
@@ -269,9 +269,8 @@
* Schedules execution of the given [ServerOperation].
*/
void scheduleOperation(ServerOperation operation) {
- bool wasEmpty = operationQueue.isEmpty;
addOperation(operation);
- if (wasEmpty) {
+ if (!performOperationPending) {
_schedulePerformOperation();
}
}
@@ -486,6 +485,8 @@
* Perform the next available [ServerOperation].
*/
void performOperation() {
+ assert(performOperationPending);
+ performOperationPending = false;
if (!running) {
// An error has occurred, or the connection to the client has been
// closed, since this method was scheduled on the event queue. So
@@ -495,6 +496,12 @@
}
// prepare next operation
ServerOperation operation = operationQueue.take();
+ if (operation == null) {
+ // This can happen if the operation queue is cleared while the operation
+ // loop is in progress. No problem; we just need to exit the operation
+ // loop and wait for the next operation to be added.
+ return;
+ }
sendStatusNotification(operation);
// perform the operation
try {
@@ -791,7 +798,7 @@
List<Source> librarySources = context.getLibrariesContaining(unitSource);
for (Source librarySource in librarySources) {
CompilationUnit unit =
- context.getResolvedCompilationUnit2(unitSource, librarySource);
+ context.resolveCompilationUnit2(unitSource, librarySource);
if (unit != null) {
units.add(unit);
}
@@ -801,7 +808,7 @@
}
/**
- * Returns [AstNode]s at the given [offset] of the given [file].
+ * Returns resolved [AstNode]s at the given [offset] of the given [file].
*
* May be empty, but not `null`.
*/
@@ -820,7 +827,7 @@
/**
* Returns [Element]s at the given [offset] of the given [file].
*
- * May be empty if not resolved, but not `null`.
+ * May be empty if cannot be resolved, but not `null`.
*/
List<Element> getElementsAtOffset(String file, int offset) {
List<AstNode> nodes = getNodesAtOffset(file, offset);
@@ -912,7 +919,9 @@
* Schedules [performOperation] exection.
*/
void _schedulePerformOperation() {
+ assert (!performOperationPending);
new Future(performOperation);
+ performOperationPending = true;
}
/**
diff --git a/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart b/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart
index 2ab4441..cc0274d 100644
--- a/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart
+++ b/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart
@@ -103,7 +103,10 @@
if (_closed.isCompleted) {
return;
}
- output.writeln(JSON.encode(notification.toJson()));
+ ServerCommunicationChannel.ToJson.start();
+ String jsonEncoding = JSON.encode(notification.toJson());
+ ServerCommunicationChannel.ToJson.stop();
+ output.writeln(jsonEncoding);
}
@override
@@ -113,7 +116,10 @@
if (_closed.isCompleted) {
return;
}
- output.writeln(JSON.encode(response.toJson()));
+ ServerCommunicationChannel.ToJson.start();
+ String jsonEncoding = JSON.encode(response.toJson());
+ ServerCommunicationChannel.ToJson.stop();
+ output.writeln(jsonEncoding);
}
/**
@@ -127,7 +133,9 @@
}
// Parse the string as a JSON descriptor and process the resulting
// structure as a request.
+ ServerCommunicationChannel.FromJson.start();
Request request = new Request.fromString(data);
+ ServerCommunicationChannel.FromJson.stop();
if (request == null) {
sendResponse(new Response.invalidRequestFormat());
return;
diff --git a/pkg/analysis_server/lib/src/channel/channel.dart b/pkg/analysis_server/lib/src/channel/channel.dart
index 4e4ab2a..107b8b0 100644
--- a/pkg/analysis_server/lib/src/channel/channel.dart
+++ b/pkg/analysis_server/lib/src/channel/channel.dart
@@ -8,6 +8,7 @@
import 'dart:convert';
import 'package:analysis_server/src/protocol.dart';
+import 'package:analyzer/src/util/utilities_timing.dart';
/**
* The abstract class [ClientCommunicationChannel] defines the behavior of
@@ -45,6 +46,18 @@
*/
abstract class ServerCommunicationChannel {
/**
+ * A stopwatch used to accumulate the amount of time spent converting
+ * incomming requests from Json to objects.
+ */
+ static final CountedStopwatch FromJson = new CountedStopwatch();
+
+ /**
+ * A stopwatch used to accumulate the amount of time spent converting outgoing
+ * responses and notifications from objects to Json.
+ */
+ static final CountedStopwatch ToJson = new CountedStopwatch();
+
+ /**
* Listen to the channel for requests. If a request is received, invoke the
* [onRequest] function. If an error is encountered while trying to read from
* the socket, invoke the [onError] function. If the socket is closed by the
diff --git a/pkg/analysis_server/lib/src/channel/web_socket_channel.dart b/pkg/analysis_server/lib/src/channel/web_socket_channel.dart
index 21835da..c661bfb 100644
--- a/pkg/analysis_server/lib/src/channel/web_socket_channel.dart
+++ b/pkg/analysis_server/lib/src/channel/web_socket_channel.dart
@@ -85,12 +85,18 @@
@override
void sendNotification(Notification notification) {
- socket.add(JSON.encode(notification.toJson()));
+ ServerCommunicationChannel.ToJson.start();
+ String jsonEncoding = JSON.encode(notification.toJson());
+ ServerCommunicationChannel.ToJson.stop();
+ socket.add(jsonEncoding);
}
@override
void sendResponse(Response response) {
- socket.add(JSON.encode(response.toJson()));
+ ServerCommunicationChannel.ToJson.start();
+ String jsonEncoding = JSON.encode(response.toJson());
+ ServerCommunicationChannel.ToJson.stop();
+ socket.add(jsonEncoding);
}
/**
@@ -101,7 +107,9 @@
if (data is String) {
// Parse the string as a JSON descriptor and process the resulting
// structure as a request.
+ ServerCommunicationChannel.FromJson.start();
Request request = new Request.fromString(data);
+ ServerCommunicationChannel.FromJson.stop();
if (request == null) {
sendResponse(new Response.invalidRequestFormat());
return;
diff --git a/pkg/analysis_server/lib/src/computer/computer_highlights.dart b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
index 20f618f..50c5171 100644
--- a/pkg/analysis_server/lib/src/computer/computer_highlights.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
@@ -118,7 +118,16 @@
if (element is! ClassElement) {
return false;
}
- return _addRegion_node(node, HighlightRegionType.CLASS);
+ ClassElement classElement = element;
+ // prepare type
+ HighlightRegionType type;
+ if (classElement.isEnum) {
+ type = HighlightRegionType.ENUM;
+ } else {
+ type = HighlightRegionType.CLASS;
+ }
+ // add region
+ return _addRegion_node(node, type);
}
bool _addIdentifierRegion_constructor(SimpleIdentifier node) {
@@ -156,15 +165,23 @@
if (element is PropertyAccessorElement) {
element = (element as PropertyAccessorElement).variable;
}
+ // prepare type
+ HighlightRegionType type;
if (element is FieldElement) {
- if ((element as FieldElement).isStatic) {
- return _addRegion_node(node, HighlightRegionType.FIELD_STATIC);
+ Element enclosingElement = element.enclosingElement;
+ if (enclosingElement is ClassElement && enclosingElement.isEnum) {
+ type = HighlightRegionType.ENUM_CONSTANT;
+ } else if ((element as FieldElement).isStatic) {
+ type = HighlightRegionType.FIELD_STATIC;
} else {
- return _addRegion_node(node, HighlightRegionType.FIELD);
+ type = HighlightRegionType.FIELD;
}
+ } else if (element is TopLevelVariableElement) {
+ type = HighlightRegionType.TOP_LEVEL_VARIABLE;
}
- if (element is TopLevelVariableElement) {
- return _addRegion_node(node, HighlightRegionType.TOP_LEVEL_VARIABLE);
+ // add region
+ if (type != null) {
+ return _addRegion_node(node, type);
}
return false;
}
@@ -354,6 +371,18 @@
}
@override
+ Object visitAwaitExpression(AwaitExpression node) {
+ computer._addRegion_token(node.awaitKeyword, HighlightRegionType.BUILT_IN);
+ return super.visitAwaitExpression(node);
+ }
+
+ @override
+ Object visitBlockFunctionBody(BlockFunctionBody node) {
+ _addRegions_functionBody(node);
+ return super.visitBlockFunctionBody(node);
+ }
+
+ @override
Object visitBooleanLiteral(BooleanLiteral node) {
computer._addRegion_node(node, HighlightRegionType.KEYWORD);
computer._addRegion_node(node, HighlightRegionType.LITERAL_BOOLEAN);
@@ -421,6 +450,12 @@
}
@override
+ Object visitEnumDeclaration(EnumDeclaration node) {
+ computer._addRegion_token(node.keyword, HighlightRegionType.KEYWORD);
+ return super.visitEnumDeclaration(node);
+ }
+
+ @override
Object visitExportDirective(ExportDirective node) {
computer._addRegion_node(node, HighlightRegionType.DIRECTIVE);
computer._addRegion_token(node.keyword, HighlightRegionType.BUILT_IN);
@@ -428,6 +463,12 @@
}
@override
+ Object visitExpressionFunctionBody(ExpressionFunctionBody node) {
+ _addRegions_functionBody(node);
+ return super.visitExpressionFunctionBody(node);
+ }
+
+ @override
Object visitFieldDeclaration(FieldDeclaration node) {
computer._addRegion_token(node.staticKeyword, HighlightRegionType.BUILT_IN);
return super.visitFieldDeclaration(node);
@@ -671,4 +712,24 @@
computer._addRegion_token(node.withKeyword, HighlightRegionType.KEYWORD);
return super.visitWithClause(node);
}
+
+ @override
+ Object visitYieldStatement(YieldStatement node) {
+ Token keyword = node.yieldKeyword;
+ Token star = node.star;
+ int offset = keyword.offset;
+ int end = star != null ? star.end : keyword.end;
+ computer._addRegion(offset, end - offset, HighlightRegionType.BUILT_IN);
+ return super.visitYieldStatement(node);
+ }
+
+ void _addRegions_functionBody(FunctionBody node) {
+ Token keyword = node.keyword;
+ if (keyword != null) {
+ Token star = node.star;
+ int offset = keyword.offset;
+ int end = star != null ? star.end : keyword.end;
+ computer._addRegion(offset, end - offset, HighlightRegionType.BUILT_IN);
+ }
+ }
}
diff --git a/pkg/analysis_server/lib/src/computer/computer_navigation.dart b/pkg/analysis_server/lib/src/computer/computer_navigation.dart
index 17f9af5..a21ec59 100644
--- a/pkg/analysis_server/lib/src/computer/computer_navigation.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_navigation.dart
@@ -36,10 +36,35 @@
if (element == null || element == DynamicElementImpl.instance) {
return;
}
+ if (element.location == null) {
+ return;
+ }
protocol.Element target = protocol.newElement_fromEngine(element);
_regions.add(new protocol.NavigationRegion(offset, length, [target]));
}
+ void _addRegion_nodeStart_nodeEnd(AstNode a, AstNode b, Element element) {
+ int offset = a.offset;
+ int length = b.end - offset;
+ _addRegion(offset, length, element);
+ }
+
+ void _addRegion_nodeStart_nodeStart(AstNode a, AstNode b, Element element,
+ {bool excludeLastChar: false}) {
+ int offset = a.offset;
+ int length = b.offset - offset;
+ if (excludeLastChar) {
+ length--;
+ }
+ _addRegion(offset, length, element);
+ }
+
+ void _addRegion_tokenStart_nodeEnd(Token a, AstNode b, Element element) {
+ int offset = a.offset;
+ int length = b.end - offset;
+ _addRegion(offset, length, element);
+ }
+
void _addRegionForNode(AstNode node, Element element) {
int offset = node.offset;
int length = node.length;
@@ -51,24 +76,6 @@
int length = token.length;
_addRegion(offset, length, element);
}
-
- void _addRegion_nodeStart_nodeEnd(AstNode a, AstNode b, Element element) {
- int offset = a.offset;
- int length = b.end - offset;
- _addRegion(offset, length, element);
- }
-
- void _addRegion_nodeStart_nodeStart(AstNode a, AstNode b, Element element) {
- int offset = a.offset;
- int length = b.offset - offset;
- _addRegion(offset, length, element);
- }
-
- void _addRegion_tokenStart_nodeEnd(Token a, AstNode b, Element element) {
- int offset = a.offset;
- int length = b.end - offset;
- _addRegion(offset, length, element);
- }
}
@@ -79,14 +86,31 @@
@override
visitAssignmentExpression(AssignmentExpression node) {
+ _safelyVisit(node.leftHandSide);
computer._addRegionForToken(node.operator, node.bestElement);
- return super.visitAssignmentExpression(node);
+ _safelyVisit(node.rightHandSide);
}
@override
visitBinaryExpression(BinaryExpression node) {
+ _safelyVisit(node.leftOperand);
computer._addRegionForToken(node.operator, node.bestElement);
- return super.visitBinaryExpression(node);
+ _safelyVisit(node.rightOperand);
+ }
+
+ @override
+ visitCompilationUnit(CompilationUnit unit) {
+ // prepare top-level nodes sorted by their offsets
+ List<AstNode> nodes = <AstNode>[];
+ nodes.addAll(unit.directives);
+ nodes.addAll(unit.declarations);
+ nodes.sort((a, b) {
+ return a.offset - b.offset;
+ });
+ // visit sorted nodes
+ for (AstNode node in nodes) {
+ node.accept(this);
+ }
}
@override
@@ -105,7 +129,7 @@
node.element);
}
}
- return super.visitConstructorDeclaration(node);
+ super.visitConstructorDeclaration(node);
}
@override
@@ -115,7 +139,7 @@
Element element = exportElement.exportedLibrary;
computer._addRegion_tokenStart_nodeEnd(node.keyword, node.uri, element);
}
- return super.visitExportDirective(node);
+ super.visitExportDirective(node);
}
@override
@@ -125,13 +149,13 @@
Element element = importElement.importedLibrary;
computer._addRegion_tokenStart_nodeEnd(node.keyword, node.uri, element);
}
- return super.visitImportDirective(node);
+ super.visitImportDirective(node);
}
@override
visitIndexExpression(IndexExpression node) {
+ super.visitIndexExpression(node);
computer._addRegionForToken(node.rightBracket, node.bestElement);
- return super.visitIndexExpression(node);
}
@override
@@ -147,13 +171,14 @@
node.argumentList,
element);
} else {
- // add region for "type" first, so that it is found before "new "
- computer._addRegionForNode(constructorName.type, classElement);
- // "new "
+ // "new ", excluding last character
computer._addRegion_nodeStart_nodeStart(
node,
constructorName.type,
- element);
+ element,
+ excludeLastChar: true);
+ // "ClassName"
+ computer._addRegionForNode(constructorName.type, classElement);
// optional ".name"
if (constructorName.period != null) {
computer._addRegion_tokenStart_nodeEnd(
@@ -163,7 +188,7 @@
}
}
}
- return super.visitInstanceCreationExpression(node);
+ _safelyVisit(node.argumentList);
}
@override
@@ -172,7 +197,7 @@
node.keyword,
node.uri,
node.element);
- return super.visitPartDirective(node);
+ super.visitPartDirective(node);
}
@override
@@ -181,27 +206,33 @@
node.keyword,
node.libraryName,
node.element);
- return super.visitPartOfDirective(node);
+ super.visitPartOfDirective(node);
}
@override
visitPostfixExpression(PostfixExpression node) {
+ super.visitPostfixExpression(node);
computer._addRegionForToken(node.operator, node.bestElement);
- return super.visitPostfixExpression(node);
}
@override
visitPrefixExpression(PrefixExpression node) {
computer._addRegionForToken(node.operator, node.bestElement);
- return super.visitPrefixExpression(node);
+ super.visitPrefixExpression(node);
}
@override
visitSimpleIdentifier(SimpleIdentifier node) {
if (node.parent is ConstructorDeclaration) {
- } else {
- computer._addRegionForNode(node, node.bestElement);
+ return;
}
- return super.visitSimpleIdentifier(node);
+ Element element = node.bestElement;
+ computer._addRegionForNode(node, element);
+ }
+
+ void _safelyVisit(AstNode node) {
+ if (node != null) {
+ node.accept(this);
+ }
}
}
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 7b9b4e1..2447fcd 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -9,8 +9,11 @@
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/source/package_map_provider.dart';
+import 'package:analyzer/source/package_map_resolver.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/generated/source_io.dart';
+import 'package:analyzer/src/generated/java_io.dart';
import 'package:path/path.dart' as pathos;
import 'package:watcher/watcher.dart';
@@ -66,19 +69,25 @@
Map<String, String> packageRoots = <String, String>{};
/**
+ * Same as [packageRoots], except that source folders have been normalized
+ * and non-folders have been removed.
+ */
+ Map<String, String> normalizedPackageRoots = <String, String>{};
+
+ /**
* Provider which is used to determine the mapping from package name to
* package folder.
*/
- final PackageMapProvider packageMapProvider;
+ final PackageMapProvider _packageMapProvider;
- ContextManager(this.resourceProvider, this.packageMapProvider) {
+ ContextManager(this.resourceProvider, this._packageMapProvider) {
pathContext = resourceProvider.pathContext;
}
/**
* Called when a new context needs to be created.
*/
- void addContext(Folder folder, Map<String, List<Folder>> packageMap);
+ void addContext(Folder folder, UriResolver packageUriResolver);
/**
* Called when the set of files associated with a context have changed (or
@@ -130,8 +139,18 @@
*/
void setRoots(List<String> includedPaths, List<String> excludedPaths,
Map<String, String> packageRoots) {
- // TODO(paulberry): process package roots.
this.packageRoots = packageRoots;
+
+ // Normalize all package root sources by mapping them to folders on the
+ // filesystem. Ignore any package root sources that aren't folders.
+ normalizedPackageRoots = <String, String>{};
+ packageRoots.forEach((String sourcePath, String targetPath) {
+ Resource resource = resourceProvider.getResource(sourcePath);
+ if (resource is Folder) {
+ normalizedPackageRoots[resource.path] = targetPath;
+ }
+ });
+
List<Folder> contextFolders = _contexts.keys.toList();
// included
Set<Folder> includedFolders = new HashSet<Folder>();
@@ -160,6 +179,14 @@
_destroyContext(contextFolder);
}
}
+ // Update package roots for existing contexts
+ _contexts.forEach((Folder folder, _ContextInfo info) {
+ String newPackageRoot = normalizedPackageRoots[folder.path];
+ if (info.packageRoot != newPackageRoot) {
+ info.packageRoot = newPackageRoot;
+ _recomputePackageUriResolver(info);
+ }
+ });
// create new contexts
for (Folder includedFolder in includedFolders) {
bool wasIncluded = contextFolders.any((folder) {
@@ -198,8 +225,8 @@
/**
* Called when the package map for a context has changed.
*/
- void updateContextPackageMap(Folder contextFolder, Map<String,
- List<Folder>> packageMap);
+ void updateContextPackageUriResolver(Folder contextFolder,
+ UriResolver packageUriResolver);
/**
* Resursively adds all Dart and HTML files to the [changeSet].
@@ -266,20 +293,39 @@
}
/**
+ * Compute the appropriate package URI resolver for [folder], and store
+ * dependency information in [info].
+ */
+ UriResolver _computePackageUriResolver(Folder folder, _ContextInfo info) {
+ UriResolver packageUriResolver;
+ if (info.packageRoot != null) {
+ info.packageMapDependencies = new Set<String>();
+ packageUriResolver = new PackageUriResolver(
+ [new JavaFile(info.packageRoot)]);
+ } else {
+ PackageMapInfo packageMapInfo =
+ _packageMapProvider.computePackageMap(folder);
+ info.packageMapDependencies = packageMapInfo.dependencies;
+ packageUriResolver = new PackageMapUriResolver(
+ resourceProvider, packageMapInfo.packageMap);
+ // TODO(paulberry): if any of the dependencies is outside of [folder],
+ // we'll need to watch their parent folders as well.
+ }
+ return packageUriResolver;
+ }
+
+ /**
* Create a new empty context associated with [folder].
*/
_ContextInfo _createContext(Folder folder, List<_ContextInfo> children) {
- _ContextInfo info = new _ContextInfo(folder, children);
+ _ContextInfo info = new _ContextInfo(folder, children,
+ normalizedPackageRoots[folder.path]);
_contexts[folder] = info;
info.changeSubscription = folder.changes.listen((WatchEvent event) {
_handleWatchEvent(folder, info, event);
});
- PackageMapInfo packageMapInfo =
- packageMapProvider.computePackageMap(folder);
- info.packageMapDependencies = packageMapInfo.dependencies;
- // TODO(paulberry): if any of the dependencies is outside of [folder],
- // we'll need to watch their parent folders as well.
- addContext(folder, packageMapInfo.packageMap);
+ UriResolver packageUriResolver = _computePackageUriResolver(folder, info);
+ addContext(folder, packageUriResolver);
return info;
}
@@ -439,14 +485,7 @@
}
if (info.packageMapDependencies.contains(path)) {
- // TODO(paulberry): when computePackageMap is changed into an
- // asynchronous API call, we'll want to suspend analysis for this context
- // while we're rerunning "pub list", since any analysis we complete while
- // "pub list" is in progress is just going to get thrown away anyhow.
- PackageMapInfo packageMapInfo =
- packageMapProvider.computePackageMap(folder);
- info.packageMapDependencies = packageMapInfo.dependencies;
- updateContextPackageMap(folder, packageMapInfo.packageMap);
+ _recomputePackageUriResolver(info);
}
}
@@ -505,6 +544,20 @@
}
}
+ /**
+ * Recompute the package URI resolver for the context described by [info],
+ * and update the client appropriately.
+ */
+ void _recomputePackageUriResolver(_ContextInfo info) {
+ // TODO(paulberry): when computePackageMap is changed into an
+ // asynchronous API call, we'll want to suspend analysis for this context
+ // while we're rerunning "pub list", since any analysis we complete while
+ // "pub list" is in progress is just going to get thrown away anyhow.
+ UriResolver packageUriResolver =
+ _computePackageUriResolver(info.folder, info);
+ updateContextPackageUriResolver(info.folder, packageUriResolver);
+ }
+
static bool _shouldFileBeAnalyzed(File file) {
if (!(AnalysisEngine.isDartFileName(file.path) ||
AnalysisEngine.isHtmlFileName(file.path))) {
@@ -534,6 +587,11 @@
final List<_ContextInfo> children;
/**
+ * The package root for this context, or null if there is no package root.
+ */
+ String packageRoot;
+
+ /**
* The [_ContextInfo] that encloses this one.
*/
_ContextInfo parent;
@@ -561,7 +619,7 @@
*/
Set<String> packageMapDependencies;
- _ContextInfo(this.folder, this.children) {
+ _ContextInfo(this.folder, this.children, this.packageRoot) {
pubspecPath = folder.getChild(PUBSPEC_NAME).path;
for (_ContextInfo child in children) {
child.parent = this;
diff --git a/pkg/analysis_server/lib/src/generated_protocol.dart b/pkg/analysis_server/lib/src/generated_protocol.dart
index 11aaca3..ccc138d 100644
--- a/pkg/analysis_server/lib/src/generated_protocol.dart
+++ b/pkg/analysis_server/lib/src/generated_protocol.dart
@@ -1542,12 +1542,13 @@
String file;
/**
- * The navigation regions contained in the file. Each navigation region
- * represents a list of targets associated with some range. The lists will
- * usually contain a single target, but can contain more in the case of a
- * part that is included in multiple libraries or in Dart code that is
- * compiled against multiple versions of a package. Note that the navigation
- * regions that are returned do not overlap other navigation regions.
+ * The navigation regions contained in the file. The regions are sorted by
+ * their offsets. Each navigation region represents a list of targets
+ * associated with some range. The lists will usually contain a single
+ * target, but can contain more in the case of a part that is included in
+ * multiple libraries or in Dart code that is compiled against multiple
+ * versions of a package. Note that the navigation regions that are returned
+ * do not overlap other navigation regions.
*/
List<NavigationRegion> regions;
@@ -6409,6 +6410,8 @@
* CONSTRUCTOR
* DIRECTIVE
* DYNAMIC_TYPE
+ * ENUM
+ * ENUM_CONSTANT
* FIELD
* FIELD_STATIC
* FUNCTION
@@ -6457,6 +6460,10 @@
static const DYNAMIC_TYPE = const HighlightRegionType._("DYNAMIC_TYPE");
+ static const ENUM = const HighlightRegionType._("ENUM");
+
+ static const ENUM_CONSTANT = const HighlightRegionType._("ENUM_CONSTANT");
+
static const FIELD = const HighlightRegionType._("FIELD");
static const FIELD_STATIC = const HighlightRegionType._("FIELD_STATIC");
@@ -6535,6 +6542,10 @@
return DIRECTIVE;
case "DYNAMIC_TYPE":
return DYNAMIC_TYPE;
+ case "ENUM":
+ return ENUM;
+ case "ENUM_CONSTANT":
+ return ENUM_CONSTANT;
case "FIELD":
return FIELD;
case "FIELD_STATIC":
diff --git a/pkg/analysis_server/lib/src/get_handler.dart b/pkg/analysis_server/lib/src/get_handler.dart
index f0f577f..91fe13b 100644
--- a/pkg/analysis_server/lib/src/get_handler.dart
+++ b/pkg/analysis_server/lib/src/get_handler.dart
@@ -4,9 +4,13 @@
library get.handler;
+import 'dart:convert';
import 'dart:io';
import 'package:analysis_server/src/socket_server.dart';
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/java_engine.dart';
/**
* Instances of the class [GetHandler] handle GET requests.
@@ -23,9 +27,14 @@
SocketServer _server;
/**
+ * Buffer containing strings printed by the analysis server.
+ */
+ List<String> _printBuffer;
+
+ /**
* Initialize a newly created handler for GET requests.
*/
- GetHandler(SocketServer this._server);
+ GetHandler(this._server, this._printBuffer);
/**
* Handle a GET request received by the HTTP server.
@@ -63,59 +72,63 @@
response,
['Context', 'ERROR', 'FLUSHED', 'IN_PROCESS', 'INVALID', 'VALID'],
true);
- // TODO(scheglov) replace with using folder based contexts
-// _server.analysisServer.contextMap.forEach((String key, AnalysisContext context) {
-// AnalysisContentStatistics statistics =
-// (context as AnalysisContextImpl).statistics;
-// int errorCount = 0;
-// int flushedCount = 0;
-// int inProcessCount = 0;
-// int invalidCount = 0;
-// int validCount = 0;
-// statistics.cacheRows.forEach((AnalysisContentStatistics_CacheRow row) {
-// errorCount += row.errorCount;
-// flushedCount += row.flushedCount;
-// inProcessCount += row.inProcessCount;
-// invalidCount += row.invalidCount;
-// validCount += row.validCount;
-// });
-// _writeRow(response, [
-// '<a href="#context_$key">$key</a>',
-// errorCount,
-// flushedCount,
-// inProcessCount,
-// invalidCount,
-// validCount]);
-// });
+ _server.analysisServer.folderMap.forEach((Folder folder, AnalysisContextImpl context) {
+ String key = folder.shortName;
+ AnalysisContextStatistics statistics = context.statistics;
+ int errorCount = 0;
+ int flushedCount = 0;
+ int inProcessCount = 0;
+ int invalidCount = 0;
+ int validCount = 0;
+ statistics.cacheRows.forEach((AnalysisContextStatistics_CacheRow row) {
+ errorCount += row.errorCount;
+ flushedCount += row.flushedCount;
+ inProcessCount += row.inProcessCount;
+ invalidCount += row.invalidCount;
+ validCount += row.validCount;
+ });
+ _writeRow(response, [
+ '<a href="#context_${HTML_ESCAPE.convert(key)}">$key</a>',
+ errorCount,
+ flushedCount,
+ inProcessCount,
+ invalidCount,
+ validCount]);
+ });
response.write('</table>');
-// _server.analysisServer.contextMap.forEach((String key, AnalysisContext context) {
-// response.write('<h2><a name="context_$key">Analysis Context: $key</a></h2>');
-// AnalysisContentStatistics statistics = (context as AnalysisContextImpl).statistics;
-// response.write('<table>');
-// _writeRow(
-// response,
-// ['Item', 'ERROR', 'FLUSHED', 'IN_PROCESS', 'INVALID', 'VALID'],
-// true);
-// statistics.cacheRows.forEach((AnalysisContentStatistics_CacheRow row) {
-// _writeRow(
-// response,
-// [row.name,
-// row.errorCount,
-// row.flushedCount,
-// row.inProcessCount,
-// row.invalidCount,
-// row.validCount]);
-// });
-// response.write('</table>');
-// List<CaughtException> exceptions = statistics.exceptions;
-// if (!exceptions.isEmpty) {
-// response.write('<h2>Exceptions</h2>');
-// exceptions.forEach((CaughtException exception) {
-// response.write('<p>${exception.exception}</p>');
-// });
-// }
-// });
+ _server.analysisServer.folderMap.forEach((Folder folder, AnalysisContextImpl context) {
+ String key = folder.shortName;
+ response.write('<h2><a name="context_${HTML_ESCAPE.convert(key)}">Analysis Context: $key</a></h2>');
+ AnalysisContextStatistics statistics = context.statistics;
+ response.write('<table>');
+ _writeRow(
+ response,
+ ['Item', 'ERROR', 'FLUSHED', 'IN_PROCESS', 'INVALID', 'VALID'],
+ true);
+ statistics.cacheRows.forEach((AnalysisContextStatistics_CacheRow row) {
+ _writeRow(
+ response,
+ [row.name,
+ row.errorCount,
+ row.flushedCount,
+ row.inProcessCount,
+ row.invalidCount,
+ row.validCount]);
+ });
+ response.write('</table>');
+ List<CaughtException> exceptions = statistics.exceptions;
+ if (!exceptions.isEmpty) {
+ response.write('<h2>Exceptions</h2>');
+ exceptions.forEach((CaughtException exception) {
+ response.write('<p>${exception.exception}</p>');
+ });
+ }
+ });
}
+ response.write('<h1>Most recent strings printed by analysis server</h2>');
+ response.write('<pre>');
+ response.write(HTML_ESCAPE.convert(_printBuffer.join('\n')));
+ response.write('</pre>');
response.write('</body>');
response.write('</html>');
response.close();
@@ -139,20 +152,20 @@
* [header] is `true`.
*/
void _writeRow(HttpResponse response, List<Object> columns, [bool header = false]) {
- if (header) {
- response.write('<th>');
- } else {
- response.write('<tr>');
- }
+ response.write('<tr>');
columns.forEach((Object value) {
- response.write('<td>');
+ if (header) {
+ response.write('<th>');
+ } else {
+ response.write('<td>');
+ }
response.write(value);
- response.write('</td>');
+ if (header) {
+ response.write('</th>');
+ } else {
+ response.write('</td>');
+ }
});
- if (header) {
- response.write('</th>');
- } else {
- response.write('</tr>');
- }
+ response.write('</tr>');
}
}
\ No newline at end of file
diff --git a/pkg/analysis_server/lib/src/services/completion/imported_computer.dart b/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
index d16b80d..2cfbc81 100644
--- a/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
@@ -48,6 +48,11 @@
_ImportedVisitor(this.request);
@override
+ Future<bool> visitArgumentList(ArgumentList node) {
+ return _addImportedElementSuggestions(node, excludeVoidReturn: true);
+ }
+
+ @override
Future<bool> visitBlock(Block node) {
return _addImportedElementSuggestions(node);
}
diff --git a/pkg/analysis_server/lib/src/services/completion/invocation_computer.dart b/pkg/analysis_server/lib/src/services/completion/invocation_computer.dart
index 798e69d..3669bd4 100644
--- a/pkg/analysis_server/lib/src/services/completion/invocation_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/invocation_computer.dart
@@ -136,6 +136,17 @@
_InvocationElementVisitor(this.request);
@override
+ Future<bool> visitClassElement(ClassElement element) {
+ if (element != null) {
+ InterfaceType type = element.type;
+ if (type != null) {
+ ClassElementSuggestionBuilder.staticSuggestionsFor(request, type.element);
+ }
+ }
+ return new Future.value(false);
+ }
+
+ @override
Future<bool> visitElement(Element element) {
return new Future.value(false);
}
@@ -162,6 +173,21 @@
}
@override
+ Future<bool> visitPropertyAccessorElement(PropertyAccessorElement element) {
+ if (element != null) {
+ PropertyInducingElement elemVar = element.variable;
+ if (elemVar != null) {
+ DartType type = elemVar.type;
+ if (type != null) {
+ ClassElementSuggestionBuilder.suggestionsFor(request, type.element);
+ }
+ }
+ return new Future.value(true);
+ }
+ return new Future.value(false);
+ }
+
+ @override
Future<bool> visitVariableElement(VariableElement element) {
DartType type = element.type;
if (type != null) {
diff --git a/pkg/analysis_server/lib/src/services/completion/local_computer.dart b/pkg/analysis_server/lib/src/services/completion/local_computer.dart
index 19e28f4..8e0ba88 100644
--- a/pkg/analysis_server/lib/src/services/completion/local_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/local_computer.dart
@@ -133,17 +133,35 @@
} else if (declaration is TopLevelVariableDeclaration) {
_addTopLevelVarSuggestions(declaration.variables);
} else if (declaration is ClassTypeAlias) {
- _addSuggestion(
+ CompletionSuggestion suggestion = _addSuggestion(
declaration.name,
CompletionSuggestionKind.CLASS_ALIAS,
null,
null);
+ if (suggestion != null) {
+ suggestion.element = _createElement(
+ protocol.ElementKind.CLASS_TYPE_ALIAS,
+ declaration.name,
+ null,
+ NO_RETURN_TYPE,
+ true,
+ _isDeprecated(declaration.metadata));
+ }
} else if (declaration is FunctionTypeAlias) {
- _addSuggestion(
+ CompletionSuggestion suggestion = _addSuggestion(
declaration.name,
CompletionSuggestionKind.FUNCTION_TYPE_ALIAS,
declaration.returnType,
null);
+ if (suggestion != null) {
+ suggestion.element = _createElement(
+ protocol.ElementKind.FUNCTION_TYPE_ALIAS,
+ declaration.name,
+ null, // TODO (danrubel) determine parameters
+ NO_RETURN_TYPE, // TODO (danrubel) determine return type
+ true,
+ _isDeprecated(declaration.metadata));
+ }
}
});
}
diff --git a/pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart
index 31f6a65..391ac2a 100644
--- a/pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart
+++ b/pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart
@@ -94,8 +94,12 @@
* [ClassElementSuggestionBuilder.suggestionsFor].
*/
class ClassElementSuggestionBuilder extends _AbstractSuggestionBuilder {
+ final bool staticOnly;
- ClassElementSuggestionBuilder(DartCompletionRequest request) : super(request);
+ ClassElementSuggestionBuilder(DartCompletionRequest request, {bool staticOnly:
+ false})
+ : super(request),
+ this.staticOnly = staticOnly;
@override
visitClassElement(ClassElement element) {
@@ -112,6 +116,9 @@
@override
visitFieldElement(FieldElement element) {
+ if (staticOnly && !element.isStatic) {
+ return;
+ }
_addElementSuggestion(
element,
CompletionSuggestionKind.GETTER,
@@ -121,6 +128,9 @@
@override
visitMethodElement(MethodElement element) {
+ if (staticOnly && !element.isStatic) {
+ return;
+ }
if (element.isOperator) {
return;
}
@@ -133,6 +143,9 @@
@override
visitPropertyAccessorElement(PropertyAccessorElement element) {
+ if (staticOnly && !element.isStatic) {
+ return;
+ }
if (element.isGetter) {
_addElementSuggestion(
element,
@@ -156,6 +169,15 @@
return element.accept(new ClassElementSuggestionBuilder(request));
}
}
+
+ /**
+ * Add suggestions for the visible static members in the given class
+ */
+ static void staticSuggestionsFor(DartCompletionRequest request,
+ ClassElement element) {
+ return element.accept(
+ new ClassElementSuggestionBuilder(request, staticOnly: true));
+ }
}
/**
diff --git a/pkg/analysis_server/lib/src/services/correction/fix.dart b/pkg/analysis_server/lib/src/services/correction/fix.dart
index 5812b10..22c25e8 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix.dart
@@ -68,6 +68,8 @@
const FixKind('CREATE_FILE', 50, "Create file '{0}'");
static const CREATE_FUNCTION =
const FixKind('CREATE_FUNCTION', 49, "Create function '{0}'");
+ static const CREATE_LOCAL_VARIABLE =
+ const FixKind('CREATE_LOCAL_VARIABLE', 50, "Create local variable '{0}'");
static const CREATE_METHOD =
const FixKind('CREATE_METHOD', 50, "Create method '{0}'");
static const CREATE_MISSING_OVERRIDES = const FixKind(
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index 3b57b9e..84c5890 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -202,6 +202,7 @@
_addFix_createFunction_forFunctionType();
_addFix_importLibrary_withType();
_addFix_importLibrary_withTopLevelVariable();
+ _addFix_createLocalVariable();
}
if (errorCode == StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER) {
_addFix_useStaticAccess_method();
@@ -722,6 +723,54 @@
}
}
+ void _addFix_createLocalVariable() {
+ SimpleIdentifier nameNode = node;
+ String name = nameNode.name;
+ // if variable is assigned, convert assignment into declaration
+ if (node.parent is AssignmentExpression) {
+ AssignmentExpression assignment = node.parent;
+ if (assignment.leftHandSide == node &&
+ assignment.operator.type == TokenType.EQ &&
+ assignment.parent is ExpressionStatement) {
+ _addInsertEdit(node.offset, 'var ');
+ _addFix(FixKind.CREATE_LOCAL_VARIABLE, [name]);
+ return;
+ }
+ }
+ // prepare target Statement
+ Statement target = node.getAncestor((x) => x is Statement);
+ if (target == null) {
+ return;
+ }
+ String prefix = utils.getNodePrefix(target);
+ // build variable declaration source
+ SourceBuilder sb = new SourceBuilder(file, target.offset);
+ {
+ // append type
+ DartType fieldType = _inferUndefinedExpressionType(node);
+ if (fieldType != null) {
+ _appendType(sb, fieldType, 'TYPE');
+ } else {
+ sb.append('var ');
+ }
+ // append name
+ {
+ sb.startPosition('NAME');
+ sb.append(name);
+ sb.endPosition();
+ }
+ sb.append(';');
+ sb.append(eol);
+ sb.append(prefix);
+ }
+ // insert source
+ _insertBuilder(sb);
+ // add linked positions
+ _addLinkedPosition3('NAME', sb, rf.rangeNode(node));
+ // add proposal
+ _addFix(FixKind.CREATE_LOCAL_VARIABLE, [name]);
+ }
+
void _addFix_createMissingOverrides(List<ExecutableElement> elements) {
elements = elements.toList();
int numElements = elements.length;
diff --git a/pkg/analysis_server/lib/src/services/correction/util.dart b/pkg/analysis_server/lib/src/services/correction/util.dart
index 3bf24eb..767e399 100644
--- a/pkg/analysis_server/lib/src/services/correction/util.dart
+++ b/pkg/analysis_server/lib/src/services/correction/util.dart
@@ -765,20 +765,6 @@
}
/**
- * Returns the start index of the line which contains given index.
- */
- int getLineThis(int index) {
- while (index > 0) {
- int c = _buffer.codeUnitAt(index - 1);
- if (c == 0xD || c == 0xA) {
- break;
- }
- index--;
- }
- return index;
- }
-
- /**
* Returns a [SourceRange] that covers [range] and extends (if possible) to
* cover whole lines.
*/
@@ -802,6 +788,20 @@
}
/**
+ * Returns the start index of the line which contains given index.
+ */
+ int getLineThis(int index) {
+ while (index > 0) {
+ int c = _buffer.codeUnitAt(index - 1);
+ if (c == 0xD || c == 0xA) {
+ break;
+ }
+ index--;
+ }
+ return index;
+ }
+
+ /**
* Returns the line prefix consisting of spaces and tabs on the left from the given
* [AstNode].
*/
diff --git a/pkg/analysis_server/lib/src/services/generated/completion.dart b/pkg/analysis_server/lib/src/services/generated/completion.dart
index bad6d0d..fad936f 100644
--- a/pkg/analysis_server/lib/src/services/generated/completion.dart
+++ b/pkg/analysis_server/lib/src/services/generated/completion.dart
@@ -8,8 +8,10 @@
library services.completion;
import 'dart:collection';
-import 'package:analysis_server/src/protocol.dart' show
- CompletionSuggestionKind;
+import "dart:math" as math;
+
+import 'package:analysis_server/src/protocol.dart'
+ show CompletionSuggestionKind;
import 'package:analyzer/src/generated/java_core.dart' hide StringUtils;
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/java_io.dart';
@@ -22,15 +24,16 @@
import 'package:analyzer/src/generated/sdk.dart';
import 'package:analyzer/src/generated/source_io.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
+
import 'stubs.dart';
import 'util.dart';
class AstNodeClassifier_CompletionEngine_typeOf extends CompletionEngine_AstNodeClassifier {
final CompletionEngine CompletionEngine_this;
- List<DartType> result;
+ DartType result = null;
- AstNodeClassifier_CompletionEngine_typeOf(this.CompletionEngine_this, this.result) : super();
+ AstNodeClassifier_CompletionEngine_typeOf(this.CompletionEngine_this);
@override
Object visitPrefixedIdentifier(PrefixedIdentifier node) => visitSimpleIdentifier(node.identifier);
@@ -42,7 +45,7 @@
PropertyAccessorElement accessor = elem as PropertyAccessorElement;
if (accessor.isSynthetic) {
PropertyInducingElement var2 = accessor.variable;
- result[0] = CompletionEngine_this._typeSearch(var2);
+ result = CompletionEngine_this._typeSearch(var2);
}
}
return null;
@@ -603,7 +606,7 @@
void _namespaceReference(NamespaceDirective node, SimpleStringLiteral literal) {
String lit = literal.literal.lexeme;
if (!lit.isEmpty) {
- lit = lit.substring(1, Math.max(lit.length - 1, 0));
+ lit = lit.substring(1, math.max(lit.length - 1, 0));
}
_filter = _createFilter(new Ident.con2(node, lit, literal.offset + 1));
Set<String> packageUris = new Set();
@@ -818,16 +821,13 @@
bool _filterDisallows2(String name) => !_filter._match2(name);
List<Element> _findAllNotTypes(List<Element> elements) {
- elements = [];
- for (JavaIterator<Element> I = new JavaIterator(elements); I.hasNext;) {
- Element element = I.next();
+ return elements.where((Element element) {
ElementKind kind = element.kind;
- if (kind == ElementKind.FUNCTION || kind == ElementKind.TOP_LEVEL_VARIABLE || kind == ElementKind.GETTER || kind == ElementKind.SETTER) {
- continue;
- }
- I.remove();
- }
- return new List.from(elements);
+ return kind == ElementKind.FUNCTION
+ || kind == ElementKind.TOP_LEVEL_VARIABLE
+ || kind == ElementKind.GETTER
+ || kind == ElementKind.SETTER;
+ }).toList();
}
List<Element> _findAllPrefixes() {
@@ -841,16 +841,11 @@
}
List<Element> _findAllTypes2(List<Element> elements) {
- elements = [];
- for (JavaIterator<Element> I = new JavaIterator(elements); I.hasNext;) {
- Element element = I.next();
+ return elements.where((Element element) {
ElementKind kind = element.kind;
- if (kind == ElementKind.CLASS || kind == ElementKind.FUNCTION_TYPE_ALIAS) {
- continue;
- }
- I.remove();
- }
- return new List.from(elements);
+ return kind == ElementKind.CLASS
+ || kind == ElementKind.FUNCTION_TYPE_ALIAS;
+ }).toList();
}
List<Element> _findTopLevelElements(LibraryElement library, TopLevelNamesKind topKind) {
@@ -940,7 +935,7 @@
List<ImportElement> _importsWithName(SimpleIdentifier libName) {
String name = libName.name;
- List<ImportElement> imports = [];
+ List<ImportElement> imports = <ImportElement>[];
for (ImportElement imp in currentLibrary.imports) {
PrefixElement prefix = imp.prefix;
if (prefix != null) {
@@ -950,7 +945,7 @@
}
}
}
- return new List.from(imports);
+ return imports;
}
bool _isCompletingKeyword(Token keyword) {
@@ -1328,8 +1323,8 @@
types.add(param.type.toString());
}
}
- prop.setParameterNames(new List.from(params));
- prop.setParameterTypes(new List.from(types));
+ prop.setParameterNames(params);
+ prop.setParameterTypes(types);
prop.setParameterStyle(posCount, named, positional);
}
@@ -1412,11 +1407,12 @@
DartType _typeOf2(Expression expr) {
DartType type = expr.bestType;
if (type.isDynamic) {
- List<DartType> result = new List<DartType>(1);
- CompletionEngine_AstNodeClassifier visitor = new AstNodeClassifier_CompletionEngine_typeOf(this, result);
+ AstNodeClassifier_CompletionEngine_typeOf visitor
+ = new AstNodeClassifier_CompletionEngine_typeOf(this);
expr.accept(visitor);
- if (result[0] != null) {
- return result[0];
+ DartType result = visitor.result;
+ if (result != null) {
+ return result;
}
}
return type;
@@ -1914,7 +1910,7 @@
void _addNamesDefinedByHierarchy2(InterfaceType type, bool forSuper) {
List<InterfaceType> superTypes = type.element.allSupertypes;
if (!forSuper) {
- superTypes = ArrayUtils.addAt(superTypes, 0, type);
+ superTypes.insert(0, type);
}
_addNamesDefinedByTypes(superTypes);
// Collect names defined by subtypes separately so they can be identified later.
@@ -3583,10 +3579,9 @@
}
void _removeNotMatching(List<Element> elements) {
- for (JavaIterator<Element> I = new JavaIterator(elements); I.hasNext;) {
- Element element = I.next();
- if (!_match(element)) {
- I.remove();
+ for (int i = elements.length - 1; i >= 0; i--) {
+ if (!_match(elements[i])) {
+ elements.removeAt(i);
}
}
}
diff --git a/pkg/analysis_server/lib/src/services/generated/util.dart b/pkg/analysis_server/lib/src/services/generated/util.dart
index c969c96..2c89137 100644
--- a/pkg/analysis_server/lib/src/services/generated/util.dart
+++ b/pkg/analysis_server/lib/src/services/generated/util.dart
@@ -8,6 +8,8 @@
library services.util;
import 'dart:collection';
+import "dart:math" as math;
+
import 'package:analyzer/src/generated/java_core.dart' hide StringUtils;
import 'package:analyzer/src/generated/ast.dart';
import 'package:analyzer/src/generated/element.dart';
@@ -16,6 +18,7 @@
import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/scanner.dart';
+
import 'stubs.dart';
/**
@@ -376,7 +379,7 @@
// find min length
int minLength = 2147483647;
for (List<AstNode> parentList in parents) {
- minLength = Math.min(minLength, parentList.length);
+ minLength = math.min(minLength, parentList.length);
}
// find deepest parent
int i = 0;
@@ -454,7 +457,7 @@
parents[--index] = current;
current = current.parent;
}
- return JavaArrays.asList(parents);
+ return parents;
}
/**
@@ -516,7 +519,7 @@
*/
static String getRecommentedFileNameForClass(String className) {
int len = className.length;
- JavaStringBuilder sb = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
bool prevWasUpper = false;
for (int i = 0; i < len; i++) {
int c = className.codeUnitAt(i);
@@ -527,22 +530,22 @@
// HTTPServer
// ^
if (!nextIsUpper) {
- sb.appendChar(0x5F);
+ buffer.writeCharCode(0x5F);
}
} else {
// HttpServer
// ^
- sb.appendChar(0x5F);
+ buffer.writeCharCode(0x5F);
}
prevWasUpper = true;
c = Character.toLowerCase(c);
} else {
prevWasUpper = false;
}
- sb.appendChar(c);
+ buffer.writeCharCode(c);
}
- sb.append(".dart");
- String fileName = sb.toString();
+ buffer.write(".dart");
+ String fileName = buffer.toString();
return fileName;
}
@@ -598,27 +601,27 @@
static List<String> getVariableNameSuggestions(String text, Set<String> excluded) {
// filter out everything except of letters and white spaces
{
- JavaStringBuilder sb = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
for (int i = 0; i < text.length; i++) {
int c = text.codeUnitAt(i);
if (Character.isLetter(c) || Character.isWhitespace(c)) {
- sb.appendChar(c);
+ buffer.writeCharCode(c);
}
}
- text = sb.toString();
+ text = buffer.toString();
}
// make single camel-case text
{
List<String> words = StringUtils.split(text);
- JavaStringBuilder sb = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
for (int i = 0; i < words.length; i++) {
String word = words[i];
if (i > 0) {
word = StringUtils.capitalize(word);
}
- sb.append(word);
+ buffer.write(word);
}
- text = sb.toString();
+ text = buffer.toString();
}
// split camel-case into separate suggested names
Set<String> res = new LinkedHashSet();
@@ -958,7 +961,7 @@
* @return the source with changed indentation.
*/
String getIndentSource2(String source, bool right) {
- JavaStringBuilder sb = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
String indent = getIndent(1);
String eol = endOfLine;
List<String> lines = StringUtils.splitByWholeSeparatorPreserveAllTokens(source, eol);
@@ -975,10 +978,10 @@
line = StringUtils.removeStart(line, indent);
}
// append line
- sb.append(line);
- sb.append(eol);
+ buffer.write(line);
+ buffer.write(eol);
}
- return sb.toString();
+ return buffer.toString();
}
/**
@@ -994,7 +997,7 @@
}
}
// re-indent lines
- JavaStringBuilder sb = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
String eol = endOfLine;
List<String> lines = StringUtils.splitByWholeSeparatorPreserveAllTokens(source, eol);
int lineOffset = 0;
@@ -1007,7 +1010,9 @@
// check if "offset" is in one of the String ranges
bool inString = false;
for (SourceRange lineRange in lineRanges) {
- inString = javaBooleanOr(inString, lineOffset > lineRange.offset && lineOffset < lineRange.end);
+ if (lineOffset > lineRange.offset && lineOffset < lineRange.end) {
+ inString = true;
+ }
if (lineOffset > lineRange.end) {
break;
}
@@ -1018,10 +1023,10 @@
line = "${newIndent}${StringUtils.removeStart(line, oldIndent)}";
}
// append line
- sb.append(line);
- sb.append(eol);
+ buffer.write(line);
+ buffer.write(eol);
}
- return sb.toString();
+ return buffer.toString();
}
/**
@@ -1308,28 +1313,28 @@
// function type
if (type is FunctionType) {
FunctionType functionType = type;
- JavaStringBuilder sb = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
// return type
DartType returnType = functionType.returnType;
if (returnType != null && !returnType.isDynamic) {
- sb.append(getTypeSource2(returnType));
- sb.appendChar(0x20);
+ buffer.write(getTypeSource2(returnType));
+ buffer.writeCharCode(0x20);
}
// parameter name
- sb.append(name);
+ buffer.write(name);
// parameters
- sb.appendChar(0x28);
+ buffer.writeCharCode(0x28);
List<ParameterElement> fParameters = functionType.parameters;
for (int i = 0; i < fParameters.length; i++) {
ParameterElement fParameter = fParameters[i];
if (i != 0) {
- sb.append(", ");
+ buffer.write(", ");
}
- sb.append(getParameterSource(fParameter.type, fParameter.name));
+ buffer.write(getParameterSource(fParameter.type, fParameter.name));
}
- sb.appendChar(0x29);
+ buffer.writeCharCode(0x29);
// done
- return sb.toString();
+ return buffer.toString();
}
// simple type
return "${getTypeSource2(type)} ${name}";
@@ -1383,7 +1388,7 @@
* @return the source to reference the given [Type] in this [CompilationUnit].
*/
String getTypeSource2(DartType type) {
- JavaStringBuilder sb = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
// prepare element
Element element = type.element;
if (element == null) {
@@ -1396,13 +1401,13 @@
{
ImportElement imp = _getImportElement(element);
if (imp != null && imp.prefix != null) {
- sb.append(imp.prefix.displayName);
- sb.append(".");
+ buffer.write(imp.prefix.displayName);
+ buffer.write(".");
}
}
// append simple name
String name = element.displayName;
- sb.append(name);
+ buffer.write(name);
// may be type arguments
if (type is InterfaceType) {
InterfaceType interfaceType = type;
@@ -1417,19 +1422,19 @@
}
// append type arguments
if (hasArguments) {
- sb.append("<");
+ buffer.write("<");
for (int i = 0; i < arguments.length; i++) {
DartType argument = arguments[i];
if (i != 0) {
- sb.append(", ");
+ buffer.write(", ");
}
- sb.append(getTypeSource2(argument));
+ buffer.write(getTypeSource2(argument));
}
- sb.append(">");
+ buffer.write(">");
}
}
// done
- return sb.toString();
+ return buffer.toString();
}
/**
diff --git a/pkg/analysis_server/lib/src/services/index/index_contributor.dart b/pkg/analysis_server/lib/src/services/index/index_contributor.dart
index 7d94a30..5f39378 100644
--- a/pkg/analysis_server/lib/src/services/index/index_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/index/index_contributor.dart
@@ -421,6 +421,18 @@
}
@override
+ Object visitEnumDeclaration(EnumDeclaration node) {
+ ClassElement element = node.element;
+ enterScope(element);
+ try {
+ _recordElementDefinition(element);
+ return super.visitEnumDeclaration(node);
+ } finally {
+ _exitScope();
+ }
+ }
+
+ @override
Object visitClassTypeAlias(ClassTypeAlias node) {
ClassElement element = node.element;
enterScope(element);
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart
index 8725031..0925b38 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart
@@ -513,13 +513,13 @@
class _HasStatementVisitor extends GeneralizingAstVisitor {
- final List<bool> result;
+ bool result = false;
- _HasStatementVisitor(this.result);
+ _HasStatementVisitor();
@override
visitStatement(Statement node) {
- result[0] = true;
+ result = true;
}
}
@@ -579,9 +579,9 @@
}
bool _hasStatements(AstNode root) {
- List<bool> result = [false];
- root.accept(new _HasStatementVisitor(result));
- return result[0];
+ _HasStatementVisitor visitor = new _HasStatementVisitor();
+ root.accept(visitor);
+ return visitor.result;
}
void _tryToFindOccurrence(Expression node) {
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
index e2ee357..f093266 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
@@ -939,13 +939,10 @@
new _Occurrence(nodeRange, ref.selectionRange.intersects(nodeRange));
ref._occurrences.add(occurrence);
// prepare mapping of parameter names to the occurrence variables
- for (MapEntry<String, String> entry in getMapEntrySet(
- nodePattern.originalToPatternNames)) {
- String patternName = entry.getValue();
- String originalName = entry.getKey();
+ nodePattern.originalToPatternNames.forEach((String originalName, String patternName) {
String selectionName = patternToSelectionName[patternName];
occurrence._parameterOldToOccurrenceName[selectionName] = originalName;
- }
+ });
// update static
if (forceStatic) {
ref._staticContext = true;
diff --git a/pkg/analysis_server/lib/src/services/refactoring/naming_conventions.dart b/pkg/analysis_server/lib/src/services/refactoring/naming_conventions.dart
index 617ced0..51fb74c 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/naming_conventions.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/naming_conventions.dart
@@ -24,40 +24,6 @@
* WARNING if the name is discouraged;
* FATAL if the name is illegal.
*/
-RefactoringStatus validateConstantName(String name) {
- // null
- if (name == null) {
- return new RefactoringStatus.fatal("Constant name must not be null.");
- }
- // is not identifier
- RefactoringStatus status =
- _validateIdentifier(name, "Constant name", 'an uppercase letter or underscore');
- if (!status.isOK) {
- return status;
- }
- // is private, OK
- int startIndex = 0;
- if (name.codeUnitAt(0) == CHAR_UNDERSCORE) {
- startIndex++;
- }
- // does not start with lower case
- for (int i = startIndex; i < name.length; i++) {
- int c = name.codeUnitAt(i);
- if (!isUpperCase(c) && !isDigit(c) && c != CHAR_UNDERSCORE) {
- return new RefactoringStatus.warning(
- "Constant name should be all uppercase with underscores.");
- }
- }
- // OK
- return new RefactoringStatus();
-}
-
-/**
- * Returns the [RefactoringStatus] with severity:
- * OK if the name is valid;
- * WARNING if the name is discouraged;
- * FATAL if the name is illegal.
- */
RefactoringStatus validateConstructorName(String name) {
if (name != null && name.isEmpty) {
return new RefactoringStatus();
diff --git a/pkg/analysis_server/lib/src/services/refactoring/rename_class_member.dart b/pkg/analysis_server/lib/src/services/refactoring/rename_class_member.dart
index 88cf801..321785e 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/rename_class_member.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/rename_class_member.dart
@@ -73,12 +73,7 @@
RefactoringStatus checkNewName() {
RefactoringStatus result = super.checkNewName();
if (element is FieldElement) {
- FieldElement fieldElement = element as FieldElement;
- if (fieldElement.isStatic && fieldElement.isConst) {
- result.addStatus(validateConstantName(newName));
- } else {
- result.addStatus(validateFieldName(newName));
- }
+ result.addStatus(validateFieldName(newName));
}
if (element is MethodElement) {
result.addStatus(validateMethodName(newName));
diff --git a/pkg/analysis_server/lib/src/services/refactoring/rename_local.dart b/pkg/analysis_server/lib/src/services/refactoring/rename_local.dart
index b8a2d21..7effb9d 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/rename_local.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/rename_local.dart
@@ -56,12 +56,7 @@
RefactoringStatus checkNewName() {
RefactoringStatus result = super.checkNewName();
if (element is LocalVariableElement) {
- LocalVariableElement variableElement = element;
- if (variableElement.isConst) {
- result.addStatus(validateConstantName(newName));
- } else {
- result.addStatus(validateVariableName(newName));
- }
+ result.addStatus(validateVariableName(newName));
} else if (element is ParameterElement) {
result.addStatus(validateParameterName(newName));
} else if (element is FunctionElement) {
diff --git a/pkg/analysis_server/lib/src/services/refactoring/rename_unit_member.dart b/pkg/analysis_server/lib/src/services/refactoring/rename_unit_member.dart
index 81a69bd..9a9d65e 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/rename_unit_member.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/rename_unit_member.dart
@@ -76,12 +76,7 @@
RefactoringStatus checkNewName() {
RefactoringStatus result = super.checkNewName();
if (element is TopLevelVariableElement) {
- TopLevelVariableElement variable = element as TopLevelVariableElement;
- if (variable.isConst) {
- result.addStatus(validateConstantName(newName));
- } else {
- result.addStatus(validateVariableName(newName));
- }
+ result.addStatus(validateVariableName(newName));
}
if (element is FunctionElement) {
result.addStatus(validateFunctionName(newName));
diff --git a/pkg/analysis_server/test/abstract_context.dart b/pkg/analysis_server/test/abstract_context.dart
index 99f39c9..30885e8 100644
--- a/pkg/analysis_server/test/abstract_context.dart
+++ b/pkg/analysis_server/test/abstract_context.dart
@@ -80,6 +80,13 @@
resourceResolver = new ResourceUriResolver(provider);
context = AnalysisEngine.instance.createAnalysisContext();
context.sourceFactory = new SourceFactory([SDK_RESOLVER, resourceResolver]);
+ {
+ AnalysisOptionsImpl options =
+ new AnalysisOptionsImpl.con1(context.analysisOptions);
+ options.enableAsync = true;
+ options.enableEnum = true;
+ context.analysisOptions = options;
+ }
}
void tearDown() {
diff --git a/pkg/analysis_server/test/analysis/notification_highlights_test.dart b/pkg/analysis_server/test/analysis/notification_highlights_test.dart
index 773d6f6..a12add9 100644
--- a/pkg/analysis_server/test/analysis/notification_highlights_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_highlights_test.dart
@@ -161,6 +161,32 @@
});
}
+ test_BUILT_IN_async() {
+ addTestFile('''
+fa() async {}
+fb() async* {}
+main() {
+ bool async = false;
+}
+''');
+ return prepareHighlights().then((_) {
+ assertHasStringRegion(HighlightRegionType.BUILT_IN, 'async');
+ assertHasStringRegion(HighlightRegionType.BUILT_IN, 'async*');
+ assertNoRegion(HighlightRegionType.BUILT_IN, 'async = false');
+ });
+ }
+
+ test_BUILT_IN_await() {
+ addTestFile('''
+main() async {
+ await 42;
+}
+''');
+ return prepareHighlights().then((_) {
+ assertHasRegion(HighlightRegionType.BUILT_IN, 'await 42');
+ });
+ }
+
test_BUILT_IN_deferred() {
addTestFile('''
import 'dart:math' deferred as math;
@@ -400,6 +426,21 @@
});
}
+ test_BUILT_IN_sync() {
+ addTestFile('''
+fa() sync {}
+fb() sync* {}
+main() {
+ bool sync = false;
+}
+''');
+ return prepareHighlights().then((_) {
+ assertHasStringRegion(HighlightRegionType.BUILT_IN, 'sync');
+ assertHasStringRegion(HighlightRegionType.BUILT_IN, 'sync*');
+ assertNoRegion(HighlightRegionType.BUILT_IN, 'sync = false');
+ });
+ }
+
test_BUILT_IN_typedef() {
addTestFile('''
typedef A();
@@ -412,6 +453,28 @@
});
}
+ test_BUILT_IN_yield() {
+ addTestFile('''
+main() async* {
+ yield 42;
+}
+''');
+ return prepareHighlights().then((_) {
+ assertHasRegion(HighlightRegionType.BUILT_IN, 'yield 42');
+ });
+ }
+
+ test_BUILT_IN_yieldStar() {
+ addTestFile('''
+main() async* {
+ yield* [];
+}
+''');
+ return prepareHighlights().then((_) {
+ assertHasStringRegion(HighlightRegionType.BUILT_IN, 'yield*');
+ });
+ }
+
test_CLASS() {
addTestFile('''
class AAA {}
@@ -528,6 +591,33 @@
});
}
+ test_ENUM() {
+ addTestFile('''
+enum MyEnum {A, B, C}
+MyEnum value;
+''');
+ return prepareHighlights().then((_) {
+ assertHasRegion(HighlightRegionType.ENUM, 'MyEnum {');
+ assertHasRegion(HighlightRegionType.ENUM, 'MyEnum value;');
+ });
+ }
+
+ test_ENUM_CONSTANT() {
+ addTestFile('''
+enum MyEnum {AAA, BBB}
+main() {
+ print(MyEnum.AAA);
+ print(MyEnum.BBB);
+}
+''');
+ return prepareHighlights().then((_) {
+ assertHasRegion(HighlightRegionType.ENUM_CONSTANT, 'AAA, ');
+ assertHasRegion(HighlightRegionType.ENUM_CONSTANT, 'BBB}');
+ assertHasRegion(HighlightRegionType.ENUM_CONSTANT, 'AAA);');
+ assertHasRegion(HighlightRegionType.ENUM_CONSTANT, 'BBB);');
+ });
+ }
+
test_FIELD() {
addTestFile('''
class A {
diff --git a/pkg/analysis_server/test/analysis/notification_navigation_test.dart b/pkg/analysis_server/test/analysis/notification_navigation_test.dart
index 00ce0c9..42c2d5a 100644
--- a/pkg/analysis_server/test/analysis/notification_navigation_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_navigation_test.dart
@@ -123,6 +123,17 @@
findRegion(offset, length, false);
}
+ void assertRegionsSorted() {
+ int lastEnd = -1;
+ for (NavigationRegion region in regions) {
+ int offset = region.offset;
+ if (offset < lastEnd) {
+ fail('$lastEnd was expected to be > $offset in\n' + regions.join('\n'));
+ }
+ lastEnd = offset + region.length;
+ }
+ }
+
/**
* Finds the navigation region with the given [offset] and [length].
* If [length] is `-1`, then it is ignored.
@@ -156,7 +167,9 @@
Future prepareNavigation() {
addAnalysisSubscription(AnalysisService.NAVIGATION, testFile);
- return waitForTasksFinished();
+ return waitForTasksFinished().then((_) {
+ assertRegionsSorted();
+ });
}
void processNotification(Notification notification) {
@@ -283,6 +296,19 @@
});
}
+ test_identifier_whenStrayImportDirective() {
+ addTestFile('''
+main() {
+ int aaa = 42;
+ print(aaa);
+}
+import 'dart:math';
+''');
+ return prepareNavigation().then((_) {
+ assertHasRegionTarget('aaa);', 'aaa = 42');
+ });
+ }
+
test_instanceCreation_implicit() {
addTestFile('''
class A {
@@ -308,7 +334,7 @@
''');
return prepareNavigation().then((_) {
{
- findRegion(findOffset('new '), 'new '.length, true);
+ findRegion(findOffset('new '), 'new'.length, true);
assertHasTarget('named() {}');
}
{
@@ -333,7 +359,7 @@
''');
return prepareNavigation().then((_) {
{
- findRegion(findOffset('new '), 'new '.length, true);
+ findRegion(findOffset('new '), 'new'.length, true);
assertHasTarget('A() {}', 0);
}
{
@@ -343,6 +369,21 @@
});
}
+ test_multiplyDefinedElement() {
+ addFile('$projectPath/bin/libA.dart', 'library A; int TEST = 1;');
+ addFile('$projectPath/bin/libB.dart', 'library B; int TEST = 2;');
+ addTestFile('''
+import 'libA.dart';
+import 'libB.dart';
+main() {
+ TEST;
+}
+''');
+ return prepareNavigation().then((_) {
+ assertNoRegionAt('TEST');
+ });
+ }
+
test_operator_arithmetic() {
addTestFile('''
class A {
diff --git a/pkg/analysis_server/test/analysis_abstract.dart b/pkg/analysis_server/test/analysis_abstract.dart
index 43703c4..e974dbf 100644
--- a/pkg/analysis_server/test/analysis_abstract.dart
+++ b/pkg/analysis_server/test/analysis_abstract.dart
@@ -232,6 +232,8 @@
server = new AnalysisServer(
serverChannel, resourceProvider, packageMapProvider, index,
new MockSdk());
+ server.contextDirectoryManager.defaultOptions.enableAsync = true;
+ server.contextDirectoryManager.defaultOptions.enableEnum = true;
handler = new AnalysisDomainHandler(server);
// listen for notifications
Stream<Notification> notificationStream = serverChannel.notificationController.stream;
diff --git a/pkg/analysis_server/test/analysis_server_test.dart b/pkg/analysis_server/test/analysis_server_test.dart
index b138eb6..d26041a 100644
--- a/pkg/analysis_server/test/analysis_server_test.dart
+++ b/pkg/analysis_server/test/analysis_server_test.dart
@@ -94,6 +94,7 @@
MockServerOperation operation = new MockServerOperation(
ServerOperationPriority.ANALYSIS, (_) { throw exceptionToThrow; });
helper.server.operationQueue.add(operation);
+ helper.server.performOperationPending = true;
try {
helper.server.performOperation();
fail('exception not rethrown');
diff --git a/pkg/analysis_server/test/context_manager_test.dart b/pkg/analysis_server/test/context_manager_test.dart
index e2ba17c..161c060 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -9,8 +9,10 @@
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/memory_file_system.dart';
import 'package:analyzer/source/package_map_provider.dart';
+import 'package:analyzer/source/package_map_resolver.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/generated/source_io.dart';
import 'package:path/path.dart';
import 'package:unittest/unittest.dart';
@@ -190,14 +192,10 @@
manager.assertContextFiles(subProjectA, [subProjectA_file]);
manager.assertContextFiles(subProjectB, [subProjectB_file]);
// verify package maps
- expect(
- manager.currentContextPackageMaps[root],
- equals(packageMapProvider.packageMaps[root]));
- expect(
- manager.currentContextPackageMaps[subProjectA],
+ _checkPackageMap(root, equals(packageMapProvider.packageMaps[root]));
+ _checkPackageMap(subProjectA,
equals(packageMapProvider.packageMaps[subProjectA]));
- expect(
- manager.currentContextPackageMaps[subProjectB],
+ _checkPackageMap(subProjectB,
equals(packageMapProvider.packageMaps[subProjectB]));
}
@@ -210,6 +208,35 @@
expect(manager.currentContextFilePaths[projPath], hasLength(0));
}
+ void test_setRoots_addPackageRoot() {
+ String packagePathFoo = '/package1/foo';
+ String packageRootPath = '/package2/foo';
+ Folder packageFolder = resourceProvider.newFolder(packagePathFoo);
+ packageMapProvider.packageMap = {
+ 'foo': [packageFolder]
+ };
+ List<String> includedPaths = <String>[projPath];
+ List<String> excludedPaths = <String>[];
+ manager.setRoots(includedPaths, excludedPaths, <String, String>{});
+ _checkPackageMap(projPath, equals(packageMapProvider.packageMap));
+ manager.setRoots(includedPaths, excludedPaths,
+ <String, String>{ projPath: packageRootPath });
+ _checkPackageRoot(projPath, equals(packageRootPath));
+ }
+
+ void test_setRoots_changePackageRoot() {
+ String packageRootPath1 = '/package1';
+ String packageRootPath2 = '/package2';
+ List<String> includedPaths = <String>[projPath];
+ List<String> excludedPaths = <String>[];
+ manager.setRoots(includedPaths, excludedPaths,
+ <String, String>{ projPath: packageRootPath1 });
+ _checkPackageRoot(projPath, equals(packageRootPath1));
+ manager.setRoots(includedPaths, excludedPaths,
+ <String, String>{ projPath: packageRootPath2 });
+ _checkPackageRoot(projPath, equals(packageRootPath2));
+ }
+
void test_setRoots_exclude_newRoot_withExcludedFile() {
// prepare paths
String project = '/project';
@@ -343,9 +370,14 @@
'foo': [packageFolder]
};
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
- expect(
- manager.currentContextPackageMaps[projPath],
- equals(packageMapProvider.packageMap));
+ _checkPackageMap(projPath, equals(packageMapProvider.packageMap));
+ }
+
+ void test_setRoots_newFolderWithPackageRoot() {
+ String packageRootPath = '/package';
+ manager.setRoots(<String>[projPath], <String>[],
+ <String, String>{ projPath: packageRootPath });
+ _checkPackageRoot(projPath, equals(packageRootPath));
}
void test_setRoots_removeFolderWithPubspec() {
@@ -406,6 +438,22 @@
expect(manager.currentContextFilePaths, hasLength(0));
}
+ void test_setRoots_removePackageRoot() {
+ String packagePathFoo = '/package1/foo';
+ String packageRootPath = '/package2/foo';
+ Folder packageFolder = resourceProvider.newFolder(packagePathFoo);
+ packageMapProvider.packageMap = {
+ 'foo': [packageFolder]
+ };
+ List<String> includedPaths = <String>[projPath];
+ List<String> excludedPaths = <String>[];
+ manager.setRoots(includedPaths, excludedPaths,
+ <String, String>{ projPath: packageRootPath });
+ _checkPackageRoot(projPath, equals(packageRootPath));
+ manager.setRoots(includedPaths, excludedPaths, <String, String>{});
+ _checkPackageMap(projPath, equals(packageMapProvider.packageMap));
+ }
+
test_watch_addDummyLink() {
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
// empty folder initially
@@ -630,7 +678,7 @@
resourceProvider.newFile(dartFilePath, 'contents');
// the created context has the expected empty package map
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
- expect(manager.currentContextPackageMaps[projPath], isEmpty);
+ _checkPackageMap(projPath, isEmpty);
// configure package map
String packagePath = '/package/foo';
resourceProvider.newFolder(packagePath);
@@ -641,13 +689,11 @@
// package map to be picked up.
resourceProvider.modifyFile(dartFilePath, 'new contents');
return pumpEventQueue().then((_) {
- expect(manager.currentContextPackageMaps[projPath], isEmpty);
+ _checkPackageMap(projPath, isEmpty);
// However, changing the package map dependency should.
resourceProvider.modifyFile(dependencyPath, 'new contents');
return pumpEventQueue().then((_) {
- expect(
- manager.currentContextPackageMaps[projPath],
- equals(packageMapProvider.packageMap));
+ _checkPackageMap(projPath, equals(packageMapProvider.packageMap));
});
});
}
@@ -662,16 +708,38 @@
resourceProvider.newFile(dartFilePath, 'contents');
// the created context has the expected empty package map
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
- expect(manager.currentContextPackageMaps[projPath], isEmpty);
+ _checkPackageMap(projPath, isEmpty);
// Change the package map dependency so that the packageMapProvider is
// re-run, and arrange for it to return null from computePackageMap().
packageMapProvider.packageMap = null;
resourceProvider.modifyFile(dependencyPath, 'new contents');
return pumpEventQueue().then((_) {
// The package map should have been changed to null.
- expect(manager.currentContextPackageMaps[projPath], isNull);
+ _checkPackageMap(projPath, isNull);
});
}
+
+ /**
+ * Verify that package URI's for source files in [path] will be resolved
+ * using a package map matching [expectation].
+ */
+ void _checkPackageMap(String path, expectation) {
+ UriResolver resolver = manager.currentContextPackageUriResolvers[path];
+ expect(resolver, new isInstanceOf<PackageMapUriResolver>());
+ PackageMapUriResolver packageMapUriResolver = resolver;
+ expect(packageMapUriResolver.packageMap, expectation);
+ }
+
+ /**
+ * Verify that package URI's for source files in [path] will be resolved
+ * using a package root maching [expectation].
+ */
+ void _checkPackageRoot(String path, expectation) {
+ UriResolver resolver = manager.currentContextPackageUriResolvers[path];
+ expect(resolver, new isInstanceOf<PackageUriResolver>());
+ PackageUriResolver packageUriResolver = resolver;
+ expect(packageUriResolver.packagesDirectory_forTesting, expectation);
+ }
}
@@ -698,22 +766,22 @@
Map<String, int>>{};
/**
- * Map from context to package map.
+ * Map from context to package URI resolver.
*/
- final Map<String, Map<String, List<Folder>>> currentContextPackageMaps =
- <String, Map<String, List<Folder>>>{};
+ final Map<String, UriResolver> currentContextPackageUriResolvers =
+ <String, UriResolver>{};
TestContextManager(MemoryResourceProvider resourceProvider,
PackageMapProvider packageMapProvider)
: super(resourceProvider, packageMapProvider);
@override
- void addContext(Folder folder, Map<String, List<Folder>> packageMap) {
+ void addContext(Folder folder, UriResolver packageUriResolver) {
String path = folder.path;
expect(currentContextPaths, isNot(contains(path)));
currentContextTimestamps[path] = now;
currentContextFilePaths[path] = <String, int>{};
- currentContextPackageMaps[path] = packageMap;
+ currentContextPackageUriResolvers[path] = packageUriResolver;
}
@override
@@ -748,12 +816,12 @@
expect(currentContextPaths, contains(path));
currentContextTimestamps.remove(path);
currentContextFilePaths.remove(path);
- currentContextPackageMaps.remove(path);
+ currentContextPackageUriResolvers.remove(path);
}
@override
- void updateContextPackageMap(Folder contextFolder, Map<String,
- List<Folder>> packageMap) {
- currentContextPackageMaps[contextFolder.path] = packageMap;
+ void updateContextPackageUriResolver(Folder contextFolder,
+ UriResolver packageUriResolver) {
+ currentContextPackageUriResolvers[contextFolder.path] = packageUriResolver;
}
}
diff --git a/pkg/analysis_server/test/integration/analysis/package_root_test.dart b/pkg/analysis_server/test/integration/analysis/package_root_test.dart
new file mode 100644
index 0000000..df26ee9
--- /dev/null
+++ b/pkg/analysis_server/test/integration/analysis/package_root_test.dart
@@ -0,0 +1,67 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+library test.integration.analysis.packageRoot;
+
+import 'package:analysis_server/src/protocol.dart';
+import 'package:path/path.dart';
+import 'package:unittest/unittest.dart';
+
+import '../../reflective_tests.dart';
+import '../integration_tests.dart';
+
+@ReflectiveTestCase()
+class Test extends AbstractAnalysisServerIntegrationTest {
+ test_package_root() {
+ String projPath = sourcePath('project');
+ String mainPath = join(projPath, 'main.dart');
+ String packagesPath = sourcePath('packages');
+ String fooBarPath = join(packagesPath, 'foo', 'bar.dart');
+ String mainText = """
+library main;
+
+import 'package:foo/bar.dart'
+
+main() {
+ f();
+}
+""";
+ String fooBarText = """
+library foo.bar;
+
+f() {}
+""";
+ writeFile(mainPath, mainText);
+ String normalizedFooBarPath = writeFile(fooBarPath, fooBarText);
+ sendServerSetSubscriptions([ServerService.STATUS]);
+ sendAnalysisSetSubscriptions({AnalysisService.NAVIGATION: [mainPath]});
+ List<NavigationRegion> navigationRegions;
+ onAnalysisNavigation.listen((AnalysisNavigationParams params) {
+ expect(params.file, equals(mainPath));
+ navigationRegions = params.regions;
+ });
+ sendAnalysisSetAnalysisRoots([projPath], [],
+ packageRoots: {projPath: packagesPath});
+ return analysisFinished.then((_) {
+ // Verify that fooBarPath was properly resolved by checking that f()
+ // refers to it.
+ bool found = false;
+ for (NavigationRegion region in navigationRegions) {
+ String navigationSource =
+ mainText.substring(region.offset, region.offset + region.length);
+ if (navigationSource == 'f') {
+ found = true;
+ expect(region.targets, hasLength(1));
+ Location location = region.targets[0].location;
+ expect(location.file, equals(normalizedFooBarPath));
+ }
+ }
+ expect(found, isTrue);
+ });
+ }
+}
+
+main() {
+ runReflectiveTests(Test);
+}
diff --git a/pkg/analysis_server/test/integration/analysis/reanalyze_concurrent_test.dart b/pkg/analysis_server/test/integration/analysis/reanalyze_concurrent_test.dart
new file mode 100644
index 0000000..e65f60c
--- /dev/null
+++ b/pkg/analysis_server/test/integration/analysis/reanalyze_concurrent_test.dart
@@ -0,0 +1,64 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+/**
+ * This test verifies that if reanalysis is performed while reanalysis is in
+ * progress, no problems occur. See dartbug.com/21448.
+ */
+library test.integration.analysis.reanalyze_concurrent;
+
+import 'dart:async';
+
+import 'package:analysis_server/src/protocol.dart';
+import 'package:unittest/unittest.dart';
+
+import '../../reflective_tests.dart';
+import '../integration_tests.dart';
+
+@ReflectiveTestCase()
+class Test extends AbstractAnalysisServerIntegrationTest {
+ test_reanalyze_concurrent() {
+ String pathname = sourcePath('test.dart');
+ String text = '''
+// Do a bunch of imports so that analysis has some work to do.
+import 'dart:io';
+import 'dart:convert';
+import 'dart:async';
+
+main() {}''';
+ writeFile(pathname, text);
+ standardAnalysisSetup();
+ return analysisFinished.then((_) {
+ sendAnalysisReanalyze();
+ // Wait for reanalysis to start.
+ return onServerStatus.first.then((_) {
+ sendAnalysisReanalyze();
+ return analysisFinished.then((_) {
+ // Now that reanalysis has finished, no further analysis should occur.
+ onServerStatus.listen((ServerStatusParams data) {
+ if (data.analysis != null) {
+ if (data.analysis.isAnalyzing) {
+ // Most likely what happened is that the first reanalyze
+ // completed before the second reanalyze had a chance to start,
+ // and we are just now starting the second reanalyze. If this is
+ // the case, then the test isn't testing what it's meant to test
+ // (because we are trying to test what happens when one reanalyze
+ // starts while another is in progress). In which case we will
+ // need to give the analyzer more work to do.
+ fail('First reanalyze finished before second started.');
+ }
+ }
+ });
+ // Give the server an extra second to make sure it doesn't take any
+ // more actions.
+ return new Future.delayed(new Duration(seconds: 1));
+ });
+ });
+ });
+ }
+}
+
+main() {
+ runReflectiveTests(Test);
+}
diff --git a/pkg/analysis_server/test/integration/analysis/test_all.dart b/pkg/analysis_server/test/integration/analysis/test_all.dart
index e834ba4..e75dbe0 100644
--- a/pkg/analysis_server/test/integration/analysis/test_all.dart
+++ b/pkg/analysis_server/test/integration/analysis/test_all.dart
@@ -15,6 +15,9 @@
import 'occurrences_test.dart' as occurrences_test;
import 'outline_test.dart' as outline_test;
import 'overrides_test.dart' as overrides_test;
+import 'package_root_test.dart' as package_root_test;
+import 'reanalyze_concurrent_test.dart' as reanalyze_concurrent_test;
+import 'reanalyze_test.dart' as reanalyze_test;
import 'update_content_test.dart' as update_content_test;
import 'update_content_list_test.dart' as update_content_list_test;
@@ -33,6 +36,9 @@
occurrences_test.main();
outline_test.main();
overrides_test.main();
+ package_root_test.main();
+ reanalyze_concurrent_test.main();
+ reanalyze_test.main();
update_content_test.main();
update_content_list_test.main();
});
diff --git a/pkg/analysis_server/test/integration/asynchrony_test.dart b/pkg/analysis_server/test/integration/asynchrony_test.dart
index 4ae0e19..79eb1b2 100644
--- a/pkg/analysis_server/test/integration/asynchrony_test.dart
+++ b/pkg/analysis_server/test/integration/asynchrony_test.dart
@@ -51,12 +51,14 @@
// Begin processing responses from the server.
server.listenToOutput((String event, params) {
- // No notifications are expected.
- fail('Unexpected notification: $event');
+ // The only expected notification is server.connected.
+ if (event != 'server.connected') {
+ fail('Unexpected notification: $event');
+ }
});
// Terminate the test when the response to the last message is received.
- lastMessageResult.then((_) {
+ return lastMessageResult.then((_) {
server.send("server.shutdown", null).then((_) {
return server.exitCode;
});
diff --git a/pkg/analysis_server/test/integration/integration_test_methods.dart b/pkg/analysis_server/test/integration/integration_test_methods.dart
index 8bc1a98..7e043dd 100644
--- a/pkg/analysis_server/test/integration/integration_test_methods.dart
+++ b/pkg/analysis_server/test/integration/integration_test_methods.dart
@@ -536,13 +536,13 @@
*
* regions ( List<NavigationRegion> )
*
- * The navigation regions contained in the file. Each navigation region
- * represents a list of targets associated with some range. The lists will
- * usually contain a single target, but can contain more in the case of a
- * part that is included in multiple libraries or in Dart code that is
- * compiled against multiple versions of a package. Note that the
- * navigation regions that are returned do not overlap other navigation
- * regions.
+ * The navigation regions contained in the file. The regions are sorted by
+ * their offsets. Each navigation region represents a list of targets
+ * associated with some range. The lists will usually contain a single
+ * target, but can contain more in the case of a part that is included in
+ * multiple libraries or in Dart code that is compiled against multiple
+ * versions of a package. Note that the navigation regions that are
+ * returned do not overlap other navigation regions.
*/
Stream<AnalysisNavigationParams> onAnalysisNavigation;
diff --git a/pkg/analysis_server/test/integration/integration_tests.dart b/pkg/analysis_server/test/integration/integration_tests.dart
index 372293d..4436253 100644
--- a/pkg/analysis_server/test/integration/integration_tests.dart
+++ b/pkg/analysis_server/test/integration/integration_tests.dart
@@ -67,10 +67,14 @@
* overwritten.
*
* Parent directories are created as necessary.
+ *
+ * Return a normalized path to the file (with symbolic links resolved).
*/
- void writeFile(String pathname, String contents) {
+ String writeFile(String pathname, String contents) {
new Directory(dirname(pathname)).createSync(recursive: true);
- new File(pathname).writeAsStringSync(contents);
+ File file = new File(pathname);
+ file.writeAsStringSync(contents);
+ return file.resolveSymbolicLinksSync();
}
/**
@@ -150,6 +154,10 @@
expect(serverConnected.isCompleted, isFalse);
serverConnected.complete();
});
+ onServerError.listen((ServerErrorParams params) {
+ // A server error should never happen during an integration test.
+ fail(params.message);
+ });
return server.start().then((_) {
server.listenToOutput(dispatchNotification);
server.exitCode.then((_) {
@@ -679,10 +687,12 @@
}
/**
- * Start the server. If [debugServer] is true, the server will be started
- * with "--debug", allowing a debugger to be attached.
+ * Start the server. If [debugServer] is `true`, the server will be started
+ * with "--debug", allowing a debugger to be attached. If [profileServer] is
+ * `true`, the server will be started with "--observe" and
+ * "--pause-isolates-on-exit", allowing the observatory to be used.
*/
- Future start({bool debugServer: false}) {
+ Future start({bool debugServer: false, bool profileServer: false}) {
if (_process != null) {
throw new Exception('Process already started');
}
@@ -695,6 +705,10 @@
if (debugServer) {
arguments.add('--debug');
}
+ if (profileServer) {
+ arguments.add('--observe');
+ arguments.add('--pause-isolates-on-exit');
+ }
if (Platform.packageRoot.isNotEmpty) {
arguments.add('--package-root=${Platform.packageRoot}');
}
diff --git a/pkg/analysis_server/test/integration/protocol_matchers.dart b/pkg/analysis_server/test/integration/protocol_matchers.dart
index adeb2af..691cc81 100644
--- a/pkg/analysis_server/test/integration/protocol_matchers.dart
+++ b/pkg/analysis_server/test/integration/protocol_matchers.dart
@@ -1274,6 +1274,8 @@
* CONSTRUCTOR
* DIRECTIVE
* DYNAMIC_TYPE
+ * ENUM
+ * ENUM_CONSTANT
* FIELD
* FIELD_STATIC
* FUNCTION
@@ -1313,6 +1315,8 @@
"CONSTRUCTOR",
"DIRECTIVE",
"DYNAMIC_TYPE",
+ "ENUM",
+ "ENUM_CONSTANT",
"FIELD",
"FIELD_STATIC",
"FUNCTION",
diff --git a/pkg/analysis_server/test/services/completion/completion_test_util.dart b/pkg/analysis_server/test/services/completion/completion_test_util.dart
index 3c830a5..54929ec 100644
--- a/pkg/analysis_server/test/services/completion/completion_test_util.dart
+++ b/pkg/analysis_server/test/services/completion/completion_test_util.dart
@@ -112,6 +112,19 @@
return cs;
}
+ CompletionSuggestion assertSuggestClassTypeAlias(String name,
+ [CompletionRelevance relevance = CompletionRelevance.DEFAULT]) {
+ CompletionSuggestion cs =
+ assertSuggest(CompletionSuggestionKind.CLASS_ALIAS, name, relevance);
+ protocol.Element element = cs.element;
+ expect(element, isNotNull);
+ expect(element.kind, equals(protocol.ElementKind.CLASS_TYPE_ALIAS));
+ expect(element.name, equals(name));
+ expect(element.parameters, isNull);
+ expect(element.returnType, isNull);
+ return cs;
+ }
+
CompletionSuggestion assertSuggestFunction(String name, String returnType,
bool isDeprecated, [CompletionRelevance relevance =
CompletionRelevance.DEFAULT]) {
@@ -136,6 +149,32 @@
return cs;
}
+ CompletionSuggestion assertSuggestFunctionTypeAlias(String name,
+ String returnType, bool isDeprecated, [CompletionRelevance relevance =
+ CompletionRelevance.DEFAULT]) {
+ CompletionSuggestion cs = assertSuggest(
+ CompletionSuggestionKind.FUNCTION_TYPE_ALIAS,
+ name,
+ relevance,
+ isDeprecated);
+ expect(cs.returnType, equals(returnType));
+ protocol.Element element = cs.element;
+ expect(element, isNotNull);
+ expect(element.kind, equals(protocol.ElementKind.FUNCTION_TYPE_ALIAS));
+ expect(element.name, equals(name));
+ expect(element.isDeprecated, equals(isDeprecated));
+ // TODO (danrubel) Determine why params are null
+// String param = element.parameters;
+// expect(param, isNotNull);
+// expect(param[0], equals('('));
+// expect(param[param.length - 1], equals(')'));
+ // TODO (danrubel) Determine why return type is null
+// expect(
+// element.returnType,
+// equals(returnType != null ? returnType : 'dynamic'));
+ return cs;
+ }
+
CompletionSuggestion assertSuggestGetter(String name, String returnType,
[CompletionRelevance relevance = CompletionRelevance.DEFAULT]) {
CompletionSuggestion cs =
@@ -426,6 +465,20 @@
}
}
+ CompletionSuggestion assertSuggestImportedFunctionTypeAlias(String name,
+ String returnType, [bool isDeprecated = false, CompletionRelevance relevance =
+ CompletionRelevance.DEFAULT]) {
+ if (computer is ImportedComputer) {
+ return assertSuggestFunctionTypeAlias(
+ name,
+ returnType,
+ isDeprecated,
+ relevance);
+ } else {
+ return assertNotSuggested(name);
+ }
+ }
+
CompletionSuggestion assertSuggestImportedGetter(String name,
String returnType, [CompletionRelevance relevance =
CompletionRelevance.DEFAULT]) {
@@ -513,6 +566,15 @@
}
}
+ CompletionSuggestion assertSuggestLocalClassTypeAlias(String name,
+ [CompletionRelevance relevance = CompletionRelevance.DEFAULT]) {
+ if (computer is LocalComputer) {
+ return assertSuggestClassTypeAlias(name, relevance);
+ } else {
+ return assertNotSuggested(name);
+ }
+ }
+
CompletionSuggestion assertSuggestLocalFunction(String name,
String returnType, [bool isDeprecated = false, CompletionRelevance relevance =
CompletionRelevance.DEFAULT]) {
@@ -523,6 +585,20 @@
}
}
+ CompletionSuggestion assertSuggestLocalFunctionTypeAlias(String name,
+ String returnType, [bool isDeprecated = false, CompletionRelevance relevance =
+ CompletionRelevance.DEFAULT]) {
+ if (computer is LocalComputer) {
+ return assertSuggestFunctionTypeAlias(
+ name,
+ returnType,
+ isDeprecated,
+ relevance);
+ } else {
+ return assertNotSuggested(name);
+ }
+ }
+
CompletionSuggestion assertSuggestLocalGetter(String name, String returnType,
[CompletionRelevance relevance = CompletionRelevance.DEFAULT]) {
if (computer is LocalComputer) {
@@ -552,6 +628,21 @@
}
}
+ test_ArgumentList() {
+ // ArgumentList MethodInvocation ExpressionStatement Block
+ addSource('/libA.dart', '''
+ library A;
+ bool hasLength(int expected) { }''');
+ addTestSource('''
+ import '/libA.dart'
+ main() {expect(^)}''');
+ computeFast();
+ return computeFull(true).then((_) {
+ assertSuggestLocalFunction('main', null);
+ assertSuggestImportedFunction('hasLength', 'bool');
+ });
+ }
+
test_AssignmentExpression_name() {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement Block
@@ -912,6 +1003,8 @@
part of libAB;
var T1;
PB F1() => new PB();
+ typedef PB2 F2(int blat);
+ class Clz = Object with Object;
class PB { }''');
addSource('/testCD.dart', '''
class C { }
@@ -927,6 +1020,8 @@
assertSuggestImportedClass('PB');
assertSuggestImportedTopLevelVar('T1', null);
assertSuggestImportedFunction('F1', 'PB');
+ assertSuggestImportedClass('Clz');
+ assertSuggestImportedFunctionTypeAlias('F2', null);
assertNotSuggested('C');
assertNotSuggested('D');
assertNotSuggested('X');
@@ -984,6 +1079,8 @@
class _B { }''');
addTestSource('''
import "/testA.dart";
+ typedef int F2(int blat);
+ class Clz = Object with Object;
class C {foo(){O^} void bar() {}}''');
computeFast();
return computeFull(true).then((_) {
@@ -992,6 +1089,8 @@
assertSuggestLocalClass('C');
assertSuggestLocalMethod('foo', 'C', null);
assertSuggestLocalMethod('bar', 'C', 'void');
+ assertSuggestLocalFunctionTypeAlias('F2', 'int');
+ assertSuggestLocalClassTypeAlias('Clz');
assertSuggestLocalClass('C');
assertNotSuggested('x');
assertNotSuggested('_B');
@@ -1399,12 +1498,58 @@
});
}
+ test_PrefixedIdentifier_class_const() {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
+ addSource('/testB.dart', '''
+ lib B;
+ class I {
+ static const scI = 'boo';
+ X get f => new A();
+ get _g => new A();}
+ class B implements I {
+ static const int scB = 12;
+ var b; X _c;
+ X get d => new A();get _e => new A();
+ set s1(I x) {} set _s2(I x) {}
+ m(X x) {} I _n(X x) {}}
+ class X{}''');
+ addTestSource('''
+ import "/testB.dart";
+ class A extends B {
+ static const String scA = 'foo';
+ w() { }}
+ main() {A.^}''');
+ computeFast();
+ return computeFull(true).then((_) {
+ assertSuggestInvocationGetter('scA', 'String');
+ assertSuggestInvocationGetter('scB', 'int');
+ assertSuggestInvocationGetter('scI', null);
+ assertNotSuggested('b');
+ assertNotSuggested('_c');
+ assertNotSuggested('d');
+ assertNotSuggested('_e');
+ assertNotSuggested('f');
+ assertNotSuggested('_g');
+ assertNotSuggested('s1');
+ assertNotSuggested('_s2');
+ assertNotSuggested('m');
+ assertNotSuggested('_n');
+ assertNotSuggested('a');
+ assertNotSuggested('A');
+ assertNotSuggested('X');
+ assertNotSuggested('w');
+ assertNotSuggested('Object');
+ assertNotSuggested('==');
+ });
+ }
+
test_PrefixedIdentifier_class_imported() {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('/testB.dart', '''
lib B;
class I {X get f => new A();get _g => new A();}
class A implements I {
+ static const int sc = 12;
var b; X _c;
X get d => new A();get _e => new A();
set s1(I x) {} set _s2(I x) {}
@@ -1415,6 +1560,7 @@
main() {A a; a.^}''');
computeFast();
return computeFull(true).then((_) {
+ assertSuggestInvocationGetter('sc', 'int');
assertSuggestInvocationGetter('b', null);
assertNotSuggested('_c');
assertSuggestInvocationGetter('d', 'X');
@@ -1439,6 +1585,7 @@
main() {A a; a.^}
class I {X get f => new A();get _g => new A();}
class A implements I {
+ static const int sc = 12;
var b; X _c;
X get d => new A();get _e => new A();
set s1(I x) {} set _s2(I x) {}
@@ -1446,6 +1593,7 @@
class X{}''');
computeFast();
return computeFull(true).then((_) {
+ assertSuggestInvocationGetter('sc', 'int');
assertSuggestInvocationGetter('b', null);
assertSuggestInvocationGetter('_c', 'X');
assertSuggestInvocationGetter('d', 'X');
@@ -1525,6 +1673,16 @@
});
}
+ test_PrefixedIdentifier_propertyAccess() {
+ // PrefixedIdentifier ExpressionStatement Block BlockFunctionBody
+ addTestSource('class A {String x; int get foo {x.^}');
+ computeFast();
+ return computeFull(true).then((_) {
+ assertSuggestInvocationGetter('isEmpty', 'bool');
+ assertSuggestInvocationMethod('compareTo', 'Comparable', 'int');
+ });
+ }
+
test_PropertyAccess_expression() {
// SimpleIdentifier MethodInvocation PropertyAccess ExpressionStatement
addTestSource('class A {a() {"hello".to^String().length}}');
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart
index 9af602c..6060c94 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -37,6 +37,24 @@
SourceChange change;
String resultCode;
+ void assert_undefinedFunction_create_returnType_bool(String lineWithTest) {
+ _indexTestUnit('''
+main() {
+ bool b = true;
+ $lineWithTest
+}
+''');
+ assertHasFix(FixKind.CREATE_FUNCTION, '''
+main() {
+ bool b = true;
+ $lineWithTest
+}
+
+bool test() {
+}
+''');
+ }
+
void assertHasFix(FixKind kind, String expected) {
AnalysisError error = _findErrorToFix();
fix = _assertHasFix(kind, error);
@@ -59,24 +77,6 @@
}
}
- void assert_undefinedFunction_create_returnType_bool(String lineWithTest) {
- _indexTestUnit('''
-main() {
- bool b = true;
- $lineWithTest
-}
-''');
- assertHasFix(FixKind.CREATE_FUNCTION, '''
-main() {
- bool b = true;
- $lineWithTest
-}
-
-bool test() {
-}
-''');
- }
-
Position expectedPosition(String search) {
int offset = resultCode.indexOf(search);
int length = getLeadingIdentifierLength(search);
@@ -188,6 +188,54 @@
_assertLinkedGroup(change.linkedEditGroups[0], ['Test v =', 'Test {']);
}
+ void test_createConstructor_insteadOfSyntheticDefault() {
+ _indexTestUnit('''
+class A {
+ int field;
+
+ method() {}
+}
+main() {
+ new A(1, 2.0);
+}
+''');
+ assertHasFix(FixKind.CREATE_CONSTRUCTOR, '''
+class A {
+ int field;
+
+ A(int i, double d) {
+ }
+
+ method() {}
+}
+main() {
+ new A(1, 2.0);
+}
+''');
+ }
+
+ void test_createConstructor_named() {
+ _indexTestUnit('''
+class A {
+ method() {}
+}
+main() {
+ new A.named(1, 2.0);
+}
+''');
+ assertHasFix(FixKind.CREATE_CONSTRUCTOR, '''
+class A {
+ A.named(int i, double d) {
+ }
+
+ method() {}
+}
+main() {
+ new A.named(1, 2.0);
+}
+''');
+ }
+
void test_createConstructorSuperExplicit() {
_indexTestUnit('''
class A {
@@ -347,54 +395,6 @@
assertNoFix(FixKind.CREATE_CONSTRUCTOR_SUPER);
}
- void test_createConstructor_insteadOfSyntheticDefault() {
- _indexTestUnit('''
-class A {
- int field;
-
- method() {}
-}
-main() {
- new A(1, 2.0);
-}
-''');
- assertHasFix(FixKind.CREATE_CONSTRUCTOR, '''
-class A {
- int field;
-
- A(int i, double d) {
- }
-
- method() {}
-}
-main() {
- new A(1, 2.0);
-}
-''');
- }
-
- void test_createConstructor_named() {
- _indexTestUnit('''
-class A {
- method() {}
-}
-main() {
- new A.named(1, 2.0);
-}
-''');
- assertHasFix(FixKind.CREATE_CONSTRUCTOR, '''
-class A {
- A.named(int i, double d) {
- }
-
- method() {}
-}
-main() {
- new A.named(1, 2.0);
-}
-''');
- }
-
void test_createField_getter_multiLevel() {
_indexTestUnit('''
class A {
@@ -464,25 +464,6 @@
''');
}
- void test_createField_getter_unqualified_instance_asStatement() {
- _indexTestUnit('''
-class A {
- main() {
- test;
- }
-}
-''');
- assertHasFix(FixKind.CREATE_FIELD, '''
-class A {
- var test;
-
- main() {
- test;
- }
-}
-''');
- }
-
void test_createField_getter_unqualified_instance_assignmentLhs() {
_indexTestUnit('''
class A {
@@ -502,6 +483,25 @@
''');
}
+ void test_createField_getter_unqualified_instance_asStatement() {
+ _indexTestUnit('''
+class A {
+ main() {
+ test;
+ }
+}
+''');
+ assertHasFix(FixKind.CREATE_FIELD, '''
+class A {
+ var test;
+
+ main() {
+ test;
+ }
+}
+''');
+ }
+
void test_createField_setter_qualified_instance_hasField() {
_indexTestUnit('''
class A {
@@ -623,6 +623,81 @@
expect(fileEdit.edits[0].replacement, contains('library my.file;'));
}
+ void test_createLocalVariable_read_typeAssignment() {
+ _indexTestUnit('''
+main() {
+ int a = test;
+}
+''');
+ assertHasFix(FixKind.CREATE_LOCAL_VARIABLE, '''
+main() {
+ int test;
+ int a = test;
+}
+''');
+ }
+
+ void test_createLocalVariable_read_typeCondition() {
+ _indexTestUnit('''
+main() {
+ if (!test) {
+ print(42);
+ }
+}
+''');
+ assertHasFix(FixKind.CREATE_LOCAL_VARIABLE, '''
+main() {
+ bool test;
+ if (!test) {
+ print(42);
+ }
+}
+''');
+ }
+
+ void test_createLocalVariable_read_typeInvocationArgument() {
+ _indexTestUnit('''
+main() {
+ f(test);
+}
+f(String p) {}
+''');
+ assertHasFix(FixKind.CREATE_LOCAL_VARIABLE, '''
+main() {
+ String test;
+ f(test);
+}
+f(String p) {}
+''');
+ }
+
+ void test_createLocalVariable_write_assignment() {
+ _indexTestUnit('''
+main() {
+ test = 42;
+}
+''');
+ assertHasFix(FixKind.CREATE_LOCAL_VARIABLE, '''
+main() {
+ var test = 42;
+}
+''');
+ }
+
+ void test_createLocalVariable_write_assignment_compound() {
+ _indexTestUnit('''
+main() {
+ test += 42;
+}
+''');
+ assertHasFix(FixKind.CREATE_LOCAL_VARIABLE, '''
+main() {
+ int test;
+ test += 42;
+}
+''');
+ }
+
void test_createMissingOverrides_functionType() {
_indexTestUnit('''
abstract class A {
diff --git a/pkg/analysis_server/test/services/index/dart_index_contributor_test.dart b/pkg/analysis_server/test/services/index/dart_index_contributor_test.dart
index f0b2694..0f7d336 100644
--- a/pkg/analysis_server/test/services/index/dart_index_contributor_test.dart
+++ b/pkg/analysis_server/test/services/index/dart_index_contributor_test.dart
@@ -298,6 +298,16 @@
_expectedLocation(classElement, 'A {}'));
}
+ void test_definesClassEnum() {
+ _indexTestUnit('enum MyEnum {A, B, c}');
+ // prepare elements
+ ClassElement classElement = findElement("MyEnum");
+ // verify
+ _assertDefinesTopLevelElement(
+ IndexConstants.DEFINES,
+ _expectedLocation(classElement, 'MyEnum {'));
+ }
+
void test_definesClassAlias() {
_indexTestUnit('''
class Mix {}
diff --git a/pkg/analysis_server/test/services/refactoring/naming_conventions_test.dart b/pkg/analysis_server/test/services/refactoring/naming_conventions_test.dart
index 0971db2..6a1b53f 100644
--- a/pkg/analysis_server/test/services/refactoring/naming_conventions_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/naming_conventions_test.dart
@@ -90,71 +90,6 @@
RefactoringProblemSeverity.FATAL,
expectedMessage: "Class name must not start or end with a blank.");
}
- void test_validateConstantName_OK() {
- assertRefactoringStatusOK(validateConstantName("NAME"));
- }
-
- void test_validateConstantName_OK_digit() {
- assertRefactoringStatusOK(validateConstantName("NAME2"));
- }
-
- void test_validateConstantName_OK_underscoreLeading() {
- assertRefactoringStatusOK(validateConstantName("_NAME"));
- }
-
- void test_validateConstantName_OK_underscoreMiddle() {
- assertRefactoringStatusOK(validateConstantName("MY_NEW_NAME"));
- }
-
- void test_validateConstantName_empty() {
- assertRefactoringStatus(
- validateConstantName(""),
- RefactoringProblemSeverity.FATAL,
- expectedMessage: "Constant name must not be empty.");
- }
-
- void test_validateConstantName_leadingBlanks() {
- assertRefactoringStatus(
- validateConstantName(" NewName"),
- RefactoringProblemSeverity.FATAL,
- expectedMessage: "Constant name must not start or end with a blank.");
- }
-
- void test_validateConstantName_notAllCaps() {
- assertRefactoringStatus(
- validateConstantName("NewName"),
- RefactoringProblemSeverity.WARNING,
- expectedMessage: "Constant name should be all uppercase with underscores.");
- }
-
- void test_validateConstantName_notIdentifierMiddle() {
- assertRefactoringStatus(
- validateConstantName("NA-ME"),
- RefactoringProblemSeverity.FATAL,
- expectedMessage: "Constant name must not contain '-'.");
- }
-
- void test_validateConstantName_notIdentifierStart() {
- assertRefactoringStatus(
- validateConstantName("99_RED_BALLOONS"),
- RefactoringProblemSeverity.FATAL,
- expectedMessage:
- "Constant name must begin with an uppercase letter or underscore.");
- }
-
- void test_validateConstantName_null() {
- assertRefactoringStatus(
- validateConstantName(null),
- RefactoringProblemSeverity.FATAL,
- expectedMessage: "Constant name must not be null.");
- }
-
- void test_validateConstantName_trailingBlanks() {
- assertRefactoringStatus(
- validateConstantName("NewName "),
- RefactoringProblemSeverity.FATAL,
- expectedMessage: "Constant name must not start or end with a blank.");
- }
void test_validateConstructorName_OK() {
assertRefactoringStatusOK(validateConstructorName("newName"));
diff --git a/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart b/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart
index d45a37d..d7b1626 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart
@@ -271,29 +271,6 @@
assertRefactoringStatusOK(refactoring.checkNewName());
}
- test_checkNewName_FieldElement_const() {
- indexTestUnit('''
-class A {
- static const int TEST = 0;
-}
-''');
- createRenameRefactoringAtString('TEST =');
- // null
- refactoring.newName = null;
- assertRefactoringStatus(
- refactoring.checkNewName(),
- RefactoringProblemSeverity.FATAL,
- expectedMessage: "Constant name must not be null.");
- // not upper case
- refactoring.newName = 'newName';
- assertRefactoringStatus(
- refactoring.checkNewName(),
- RefactoringProblemSeverity.WARNING);
- // OK
- refactoring.newName = 'NEW_NAME';
- assertRefactoringStatusOK(refactoring.checkNewName());
- }
-
test_checkNewName_MethodElement() {
indexTestUnit('''
class A {
diff --git a/pkg/analysis_server/test/services/refactoring/rename_local_test.dart b/pkg/analysis_server/test/services/refactoring/rename_local_test.dart
index 3c795b1..9fad28e 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_local_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_local_test.dart
@@ -242,36 +242,6 @@
assertRefactoringStatusOK(refactoring.checkNewName());
}
- test_checkNewName_LocalVariableElement_const() {
- indexTestUnit('''
-main() {
- const int TEST = 0;
-}
-''');
- createRenameRefactoringAtString('TEST = 0;');
- // null
- refactoring.newName = null;
- assertRefactoringStatus(
- refactoring.checkNewName(),
- RefactoringProblemSeverity.FATAL,
- expectedMessage: "Constant name must not be null.");
- // empty
- refactoring.newName = '';
- assertRefactoringStatus(
- refactoring.checkNewName(),
- RefactoringProblemSeverity.FATAL,
- expectedMessage: "Constant name must not be empty.");
- // same
- refactoring.newName = 'TEST';
- assertRefactoringStatus(
- refactoring.checkNewName(),
- RefactoringProblemSeverity.FATAL,
- expectedMessage: "The new name must be different than the current name.");
- // OK
- refactoring.newName = 'NEW_NAME';
- assertRefactoringStatusOK(refactoring.checkNewName());
- }
-
test_checkNewName_ParameterElement() {
indexTestUnit('''
main(test) {
diff --git a/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart b/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart
index 7e4ec51..84a34fe 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart
@@ -303,28 +303,6 @@
assertRefactoringStatusOK(refactoring.checkNewName());
}
- test_checkNewName_TopLevelVariableElement_const() {
- indexTestUnit('''
-const TEST = 0;
-''');
- createRenameRefactoringAtString('TEST =');
- // null
- refactoring.newName = null;
- assertRefactoringStatus(
- refactoring.checkNewName(),
- RefactoringProblemSeverity.FATAL,
- expectedMessage: "Constant name must not be null.");
- // empty
- refactoring.newName = '';
- assertRefactoringStatus(
- refactoring.checkNewName(),
- RefactoringProblemSeverity.FATAL,
- expectedMessage: "Constant name must not be empty.");
- // OK
- refactoring.newName = 'NEW_NAME';
- assertRefactoringStatusOK(refactoring.checkNewName());
- }
-
test_createChange_ClassElement() {
indexTestUnit('''
class Test implements Other {
diff --git a/pkg/analysis_server/test/timing/completion/completion_simple.dart b/pkg/analysis_server/test/timing/completion/completion_simple.dart
index 4b98eb9..aa833bb 100644
--- a/pkg/analysis_server/test/timing/completion/completion_simple.dart
+++ b/pkg/analysis_server/test/timing/completion/completion_simple.dart
@@ -5,6 +5,7 @@
library test.timing.simple;
import 'dart:async';
+import 'dart:io';
import 'package:analysis_server/src/protocol.dart';
import 'package:path/path.dart';
@@ -22,6 +23,9 @@
print('averageTime = ${result.averageTime}');
print('maxTime = ${result.maxTime}');
print('standardDeviation = ${result.standardDeviation}');
+ print('');
+ print('Press return to exit');
+ return stdin.first;
});
}
diff --git a/pkg/analysis_server/test/timing/timing_framework.dart b/pkg/analysis_server/test/timing/timing_framework.dart
index cf10ee4..273bef8 100644
--- a/pkg/analysis_server/test/timing/timing_framework.dart
+++ b/pkg/analysis_server/test/timing/timing_framework.dart
@@ -89,7 +89,8 @@
onServerConnected.listen((_) {
serverConnected.complete();
});
- return server.start().then((params) {
+ skipShutdown = true;
+ return server.start(profileServer: true).then((params) {
server.listenToOutput(dispatchNotification);
server.exitCode.then((_) {
skipShutdown = true;
diff --git a/pkg/analysis_server/tool/spec/spec_input.html b/pkg/analysis_server/tool/spec/spec_input.html
index 16bd463..da50b3c 100644
--- a/pkg/analysis_server/tool/spec/spec_input.html
+++ b/pkg/analysis_server/tool/spec/spec_input.html
@@ -677,8 +677,9 @@
<field name="regions">
<list><ref>NavigationRegion</ref></list>
<p>
- The navigation regions contained in the file. Each
- navigation region represents a list of targets
+ The navigation regions contained in the file.
+ The regions are sorted by their offsets.
+ Each navigation region represents a list of targets
associated with some range. The lists will usually
contain a single target, but can contain more in the
case of a part that is included in multiple libraries
@@ -2116,6 +2117,8 @@
<value><code>CONSTRUCTOR</code></value>
<value><code>DIRECTIVE</code></value>
<value><code>DYNAMIC_TYPE</code></value>
+ <value><code>ENUM</code></value>
+ <value><code>ENUM_CONSTANT</code></value>
<value><code>FIELD</code></value>
<value><code>FIELD_STATIC</code></value>
<value><code>FUNCTION</code></value>
diff --git a/pkg/analyzer/example/parser_driver.dart b/pkg/analyzer/example/parser_driver.dart
index cae05c6..2bbd669 100644
--- a/pkg/analyzer/example/parser_driver.dart
+++ b/pkg/analyzer/example/parser_driver.dart
@@ -52,7 +52,7 @@
class _ASTVisitor extends GeneralizingAstVisitor {
visitNode(AstNode node) {
- print('${node.runtimeType} : <"${node.toString()}">');
+ print('${node.runtimeType} : <"$node">');
return super.visitNode(node);
}
}
diff --git a/pkg/analyzer/example/resolver_driver.dart b/pkg/analyzer/example/resolver_driver.dart
index 679f16a..08e4065 100644
--- a/pkg/analyzer/example/resolver_driver.dart
+++ b/pkg/analyzer/example/resolver_driver.dart
@@ -42,7 +42,7 @@
class _ASTVisitor extends GeneralizingAstVisitor {
visitNode(AstNode node) {
- String text = '${node.runtimeType} : <"${node.toString()}">';
+ String text = '${node.runtimeType} : <"$node">';
if (node is SimpleIdentifier) {
Element element = node.staticElement;
if (element != null) {
diff --git a/pkg/analyzer/lib/source/package_map_resolver.dart b/pkg/analyzer/lib/source/package_map_resolver.dart
index 1f2f101..de2c673 100644
--- a/pkg/analyzer/lib/source/package_map_resolver.dart
+++ b/pkg/analyzer/lib/source/package_map_resolver.dart
@@ -82,7 +82,7 @@
String pkgFolderPath = pkgFolder.path;
if (sourcePath.startsWith(pkgFolderPath)) {
String relPath = sourcePath.substring(pkgFolderPath.length);
- return new Uri(path: '${PACKAGE_SCHEME}:$pkgName$relPath');
+ return new Uri(path: '$PACKAGE_SCHEME:$pkgName$relPath');
}
}
}
diff --git a/pkg/analyzer/lib/source/pub_package_map_provider.dart b/pkg/analyzer/lib/source/pub_package_map_provider.dart
index cb949eaf..bb49716 100644
--- a/pkg/analyzer/lib/source/pub_package_map_provider.dart
+++ b/pkg/analyzer/lib/source/pub_package_map_provider.dart
@@ -51,7 +51,7 @@
executable, [PUB_LIST_COMMAND], workingDirectory: folder.path);
} on io.ProcessException catch (exception, stackTrace) {
AnalysisEngine.instance.logger.logInformation(
- "Error running pub $PUB_LIST_COMMAND\n${exception}\n${stackTrace}");
+ "Error running pub $PUB_LIST_COMMAND\n$exception\n$stackTrace");
}
if (result.exitCode != 0) {
AnalysisEngine.instance.logger.logInformation(
@@ -62,7 +62,7 @@
return parsePackageMap(result.stdout, folder);
} catch (exception, stackTrace) {
AnalysisEngine.instance.logger.logError(
- "Malformed output from pub $PUB_LIST_COMMAND\n${exception}\n${stackTrace}");
+ "Malformed output from pub $PUB_LIST_COMMAND\n$exception\n$stackTrace");
}
return _error(folder);
diff --git a/pkg/analyzer/lib/src/analyzer_impl.dart b/pkg/analyzer/lib/src/analyzer_impl.dart
index 79ef6b4..4de0a6a1 100644
--- a/pkg/analyzer/lib/src/analyzer_impl.dart
+++ b/pkg/analyzer/lib/src/analyzer_impl.dart
@@ -172,7 +172,7 @@
}
exitCode = status.ordinal;
}).catchError((ex, st) {
- AnalysisEngine.instance.logger.logError("${ex}\n${st}");
+ AnalysisEngine.instance.logger.logError("$ex\n$st");
});
}
diff --git a/pkg/analyzer/lib/src/generated/ast.dart b/pkg/analyzer/lib/src/generated/ast.dart
index fff8270..f5506fb 100644
--- a/pkg/analyzer/lib/src/generated/ast.dart
+++ b/pkg/analyzer/lib/src/generated/ast.dart
@@ -69,9 +69,9 @@
}
@override
- void appendStringValue(JavaStringBuilder builder) {
+ void appendStringValue(StringBuffer buffer) {
for (StringLiteral stringLiteral in strings) {
- stringLiteral.appendStringValue(builder);
+ stringLiteral.appendStringValue(buffer);
}
}
}
@@ -197,12 +197,10 @@
* appeared in the original source
*/
List<AstNode> get sortedCommentAndAnnotations {
- List<AstNode> childList = new List<AstNode>();
- childList.add(_comment);
- childList.addAll(_metadata);
- List<AstNode> children = new List.from(childList);
- children.sort(AstNode.LEXICAL_ORDER);
- return children;
+ return <AstNode>[]
+ ..add(_comment)
+ ..addAll(_metadata)
+ ..sort(AstNode.LEXICAL_ORDER);
}
}
@@ -995,12 +993,38 @@
}
/**
- * Instances of the class `AstCloner` implement an object that will clone any AST structure
- * that it visits. The cloner will only clone the structure, it will not preserve any resolution
- * results or properties associated with the nodes.
+ * An `AstCloner` is an AST visitor that will clone any AST structure that it
+ * visits. The cloner will only clone the structure, it will not preserve any
+ * resolution results or properties associated with the nodes.
*/
class AstCloner implements AstVisitor<AstNode> {
- List cloneNodeList(NodeList nodes) {
+ /**
+ * A flag indicating whether tokens should be cloned while cloning an AST
+ * structure.
+ */
+ final bool cloneTokens;
+
+ /**
+ * Initialize a newly created AST cloner to optionally clone tokens while
+ * cloning AST nodes if [cloneTokens] is `true`.
+ */
+ AstCloner([this.cloneTokens = false]);
+
+ /**
+ * Return a clone of the given [node].
+ */
+ AstNode cloneNode(AstNode node) {
+ if (node == null) {
+ return null;
+ }
+ return node.accept(this) as AstNode;
+ }
+
+ /**
+ * Return a list containing cloned versions of the nodes in the given list of
+ * [nodes].
+ */
+ List<AstNode> cloneNodeList(NodeList nodes) {
int count = nodes.length;
List clonedNodes = new List();
for (int i = 0; i < count; i++) {
@@ -1009,185 +1033,484 @@
return clonedNodes;
}
- @override
- AdjacentStrings visitAdjacentStrings(AdjacentStrings node) => new AdjacentStrings(cloneNodeList(node.strings));
+ /**
+ * Clone the given [token] if tokens are supposed to be cloned.
+ */
+ Token cloneToken(Token token) {
+ if (cloneTokens) {
+ return (token == null ? null : token.copy());
+ } else {
+ return token;
+ }
+ }
+
+ /**
+ * Clone the given [tokens] if tokens are supposed to be cloned.
+ */
+ List<Token> cloneTokenList(List<Token> tokens) {
+ if (cloneTokens) {
+ return tokens.map((Token token) => token.copy()).toList();
+ }
+ return tokens;
+ }
@override
- Annotation visitAnnotation(Annotation node) => new Annotation(node.atSign, cloneNode(node.name), node.period, cloneNode(node.constructorName), cloneNode(node.arguments));
+ AdjacentStrings visitAdjacentStrings(AdjacentStrings node)
+ => new AdjacentStrings(cloneNodeList(node.strings));
@override
- ArgumentList visitArgumentList(ArgumentList node) => new ArgumentList(node.leftParenthesis, cloneNodeList(node.arguments), node.rightParenthesis);
+ Annotation visitAnnotation(Annotation node)
+ => new Annotation(
+ cloneToken(node.atSign),
+ cloneNode(node.name),
+ cloneToken(node.period),
+ cloneNode(node.constructorName),
+ cloneNode(node.arguments));
@override
- AsExpression visitAsExpression(AsExpression node) => new AsExpression(cloneNode(node.expression), node.asOperator, cloneNode(node.type));
+ ArgumentList visitArgumentList(ArgumentList node)
+ => new ArgumentList(
+ cloneToken(node.leftParenthesis),
+ cloneNodeList(node.arguments),
+ cloneToken(node.rightParenthesis));
@override
- AstNode visitAssertStatement(AssertStatement node) => new AssertStatement(node.keyword, node.leftParenthesis, cloneNode(node.condition), node.rightParenthesis, node.semicolon);
+ AsExpression visitAsExpression(AsExpression node)
+ => new AsExpression(
+ cloneNode(node.expression),
+ cloneToken(node.asOperator),
+ cloneNode(node.type));
@override
- AssignmentExpression visitAssignmentExpression(AssignmentExpression node) => new AssignmentExpression(cloneNode(node.leftHandSide), node.operator, cloneNode(node.rightHandSide));
+ AstNode visitAssertStatement(AssertStatement node)
+ => new AssertStatement(
+ cloneToken(node.keyword),
+ cloneToken(node.leftParenthesis),
+ cloneNode(node.condition),
+ cloneToken(node.rightParenthesis),
+ cloneToken(node.semicolon));
@override
- AwaitExpression visitAwaitExpression(AwaitExpression node) => new AwaitExpression(node.awaitKeyword, node.expression);
+ AssignmentExpression visitAssignmentExpression(AssignmentExpression node)
+ => new AssignmentExpression(
+ cloneNode(node.leftHandSide),
+ cloneToken(node.operator),
+ cloneNode(node.rightHandSide));
@override
- BinaryExpression visitBinaryExpression(BinaryExpression node) => new BinaryExpression(cloneNode(node.leftOperand), node.operator, cloneNode(node.rightOperand));
+ AwaitExpression visitAwaitExpression(AwaitExpression node)
+ => new AwaitExpression(
+ cloneToken(node.awaitKeyword),
+ cloneNode(node.expression));
@override
- Block visitBlock(Block node) => new Block(node.leftBracket, cloneNodeList(node.statements), node.rightBracket);
+ BinaryExpression visitBinaryExpression(BinaryExpression node)
+ => new BinaryExpression(
+ cloneNode(node.leftOperand),
+ cloneToken(node.operator),
+ cloneNode(node.rightOperand));
@override
- BlockFunctionBody visitBlockFunctionBody(BlockFunctionBody node) => new BlockFunctionBody(node.keyword, node.star, cloneNode(node.block));
+ Block visitBlock(Block node)
+ => new Block(
+ cloneToken(node.leftBracket),
+ cloneNodeList(node.statements),
+ cloneToken(node.rightBracket));
@override
- BooleanLiteral visitBooleanLiteral(BooleanLiteral node) => new BooleanLiteral(node.literal, node.value);
+ BlockFunctionBody visitBlockFunctionBody(BlockFunctionBody node)
+ => new BlockFunctionBody(
+ cloneToken(node.keyword),
+ cloneToken(node.star),
+ cloneNode(node.block));
@override
- BreakStatement visitBreakStatement(BreakStatement node) => new BreakStatement(node.keyword, cloneNode(node.label), node.semicolon);
+ BooleanLiteral visitBooleanLiteral(BooleanLiteral node)
+ => new BooleanLiteral(cloneToken(node.literal), node.value);
@override
- CascadeExpression visitCascadeExpression(CascadeExpression node) => new CascadeExpression(cloneNode(node.target), cloneNodeList(node.cascadeSections));
+ BreakStatement visitBreakStatement(BreakStatement node)
+ => new BreakStatement(
+ cloneToken(node.keyword),
+ cloneNode(node.label),
+ cloneToken(node.semicolon));
@override
- CatchClause visitCatchClause(CatchClause node) => new CatchClause(node.onKeyword, cloneNode(node.exceptionType), node.catchKeyword, node.leftParenthesis, cloneNode(node.exceptionParameter), node.comma, cloneNode(node.stackTraceParameter), node.rightParenthesis, cloneNode(node.body));
+ CascadeExpression visitCascadeExpression(CascadeExpression node)
+ => new CascadeExpression(
+ cloneNode(node.target),
+ cloneNodeList(node.cascadeSections));
+
+ @override
+ CatchClause visitCatchClause(CatchClause node)
+ => new CatchClause(
+ cloneToken(node.onKeyword),
+ cloneNode(node.exceptionType),
+ cloneToken(node.catchKeyword),
+ cloneToken(node.leftParenthesis),
+ cloneNode(node.exceptionParameter),
+ cloneToken(node.comma),
+ cloneNode(node.stackTraceParameter),
+ cloneToken(node.rightParenthesis),
+ cloneNode(node.body));
@override
ClassDeclaration visitClassDeclaration(ClassDeclaration node) {
- ClassDeclaration copy = new ClassDeclaration(cloneNode(node.documentationComment), cloneNodeList(node.metadata), node.abstractKeyword, node.classKeyword, cloneNode(node.name), cloneNode(node.typeParameters), cloneNode(node.extendsClause), cloneNode(node.withClause), cloneNode(node.implementsClause), node.leftBracket, cloneNodeList(node.members), node.rightBracket);
+ ClassDeclaration copy = new ClassDeclaration(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneToken(node.abstractKeyword),
+ cloneToken(node.classKeyword),
+ cloneNode(node.name),
+ cloneNode(node.typeParameters),
+ cloneNode(node.extendsClause),
+ cloneNode(node.withClause),
+ cloneNode(node.implementsClause),
+ cloneToken(node.leftBracket),
+ cloneNodeList(node.members),
+ cloneToken(node.rightBracket));
copy.nativeClause = cloneNode(node.nativeClause);
return copy;
}
@override
- ClassTypeAlias visitClassTypeAlias(ClassTypeAlias node) => new ClassTypeAlias(cloneNode(node.documentationComment), cloneNodeList(node.metadata), node.keyword, cloneNode(node.name), cloneNode(node.typeParameters), node.equals, node.abstractKeyword, cloneNode(node.superclass), cloneNode(node.withClause), cloneNode(node.implementsClause), node.semicolon);
+ ClassTypeAlias visitClassTypeAlias(ClassTypeAlias node)
+ => new ClassTypeAlias(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneToken(node.keyword),
+ cloneNode(node.name),
+ cloneNode(node.typeParameters),
+ cloneToken(node.equals),
+ cloneToken(node.abstractKeyword),
+ cloneNode(node.superclass),
+ cloneNode(node.withClause),
+ cloneNode(node.implementsClause),
+ cloneToken(node.semicolon));
@override
Comment visitComment(Comment node) {
if (node.isDocumentation) {
- return Comment.createDocumentationCommentWithReferences(node.tokens, cloneNodeList(node.references));
+ return Comment.createDocumentationCommentWithReferences(
+ cloneTokenList(node.tokens),
+ cloneNodeList(node.references));
} else if (node.isBlock) {
- return Comment.createBlockComment(node.tokens);
+ return Comment.createBlockComment(cloneTokenList(node.tokens));
}
- return Comment.createEndOfLineComment(node.tokens);
+ return Comment.createEndOfLineComment(cloneTokenList(node.tokens));
}
@override
- CommentReference visitCommentReference(CommentReference node) => new CommentReference(node.newKeyword, cloneNode(node.identifier));
+ CommentReference visitCommentReference(CommentReference node)
+ => new CommentReference(
+ cloneToken(node.newKeyword),
+ cloneNode(node.identifier));
@override
CompilationUnit visitCompilationUnit(CompilationUnit node) {
- CompilationUnit clone = new CompilationUnit(node.beginToken, cloneNode(node.scriptTag), cloneNodeList(node.directives), cloneNodeList(node.declarations), node.endToken);
+ CompilationUnit clone = new CompilationUnit(
+ cloneToken(node.beginToken),
+ cloneNode(node.scriptTag),
+ cloneNodeList(node.directives),
+ cloneNodeList(node.declarations),
+ cloneToken(node.endToken));
clone.lineInfo = node.lineInfo;
return clone;
}
@override
- ConditionalExpression visitConditionalExpression(ConditionalExpression node) => new ConditionalExpression(cloneNode(node.condition), node.question, cloneNode(node.thenExpression), node.colon, cloneNode(node.elseExpression));
+ ConditionalExpression visitConditionalExpression(ConditionalExpression node)
+ => new ConditionalExpression(
+ cloneNode(node.condition),
+ cloneToken(node.question),
+ cloneNode(node.thenExpression),
+ cloneToken(node.colon),
+ cloneNode(node.elseExpression));
@override
- ConstructorDeclaration visitConstructorDeclaration(ConstructorDeclaration node) => new ConstructorDeclaration(cloneNode(node.documentationComment), cloneNodeList(node.metadata), node.externalKeyword, node.constKeyword, node.factoryKeyword, cloneNode(node.returnType), node.period, cloneNode(node.name), cloneNode(node.parameters), node.separator, cloneNodeList(node.initializers), cloneNode(node.redirectedConstructor), cloneNode(node.body));
+ ConstructorDeclaration visitConstructorDeclaration(ConstructorDeclaration node)
+ => new ConstructorDeclaration(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneToken(node.externalKeyword),
+ cloneToken(node.constKeyword),
+ cloneToken(node.factoryKeyword),
+ cloneNode(node.returnType),
+ cloneToken(node.period),
+ cloneNode(node.name),
+ cloneNode(node.parameters),
+ cloneToken(node.separator),
+ cloneNodeList(node.initializers),
+ cloneNode(node.redirectedConstructor),
+ cloneNode(node.body));
@override
- ConstructorFieldInitializer visitConstructorFieldInitializer(ConstructorFieldInitializer node) => new ConstructorFieldInitializer(node.keyword, node.period, cloneNode(node.fieldName), node.equals, cloneNode(node.expression));
+ ConstructorFieldInitializer visitConstructorFieldInitializer(ConstructorFieldInitializer node)
+ => new ConstructorFieldInitializer(
+ cloneToken(node.keyword),
+ cloneToken(node.period),
+ cloneNode(node.fieldName),
+ cloneToken(node.equals),
+ cloneNode(node.expression));
@override
- ConstructorName visitConstructorName(ConstructorName node) => new ConstructorName(cloneNode(node.type), node.period, cloneNode(node.name));
+ ConstructorName visitConstructorName(ConstructorName node)
+ => new ConstructorName(
+ cloneNode(node.type),
+ cloneToken(node.period),
+ cloneNode(node.name));
@override
- ContinueStatement visitContinueStatement(ContinueStatement node) => new ContinueStatement(node.keyword, cloneNode(node.label), node.semicolon);
+ ContinueStatement visitContinueStatement(ContinueStatement node)
+ => new ContinueStatement(
+ cloneToken(node.keyword),
+ cloneNode(node.label),
+ cloneToken(node.semicolon));
@override
- DeclaredIdentifier visitDeclaredIdentifier(DeclaredIdentifier node) => new DeclaredIdentifier(cloneNode(node.documentationComment), cloneNodeList(node.metadata), node.keyword, cloneNode(node.type), cloneNode(node.identifier));
+ DeclaredIdentifier visitDeclaredIdentifier(DeclaredIdentifier node)
+ => new DeclaredIdentifier(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneToken(node.keyword),
+ cloneNode(node.type),
+ cloneNode(node.identifier));
@override
- DefaultFormalParameter visitDefaultFormalParameter(DefaultFormalParameter node) => new DefaultFormalParameter(cloneNode(node.parameter), node.kind, node.separator, cloneNode(node.defaultValue));
+ DefaultFormalParameter visitDefaultFormalParameter(DefaultFormalParameter node)
+ => new DefaultFormalParameter(
+ cloneNode(node.parameter),
+ node.kind,
+ cloneToken(node.separator),
+ cloneNode(node.defaultValue));
@override
- DoStatement visitDoStatement(DoStatement node) => new DoStatement(node.doKeyword, cloneNode(node.body), node.whileKeyword, node.leftParenthesis, cloneNode(node.condition), node.rightParenthesis, node.semicolon);
+ DoStatement visitDoStatement(DoStatement node)
+ => new DoStatement(
+ cloneToken(node.doKeyword),
+ cloneNode(node.body),
+ cloneToken(node.whileKeyword),
+ cloneToken(node.leftParenthesis),
+ cloneNode(node.condition),
+ cloneToken(node.rightParenthesis),
+ cloneToken(node.semicolon));
@override
- DoubleLiteral visitDoubleLiteral(DoubleLiteral node) => new DoubleLiteral(node.literal, node.value);
+ DoubleLiteral visitDoubleLiteral(DoubleLiteral node)
+ => new DoubleLiteral(cloneToken(node.literal), node.value);
@override
- EmptyFunctionBody visitEmptyFunctionBody(EmptyFunctionBody node) => new EmptyFunctionBody(node.semicolon);
+ EmptyFunctionBody visitEmptyFunctionBody(EmptyFunctionBody node)
+ => new EmptyFunctionBody(cloneToken(node.semicolon));
@override
- EmptyStatement visitEmptyStatement(EmptyStatement node) => new EmptyStatement(node.semicolon);
+ EmptyStatement visitEmptyStatement(EmptyStatement node)
+ => new EmptyStatement(cloneToken(node.semicolon));
@override
- AstNode visitEnumConstantDeclaration(EnumConstantDeclaration node) => new EnumConstantDeclaration(cloneNode(node.documentationComment), cloneNodeList(node.metadata), cloneNode(node.name));
+ AstNode visitEnumConstantDeclaration(EnumConstantDeclaration node)
+ => new EnumConstantDeclaration(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneNode(node.name));
@override
- EnumDeclaration visitEnumDeclaration(EnumDeclaration node) => new EnumDeclaration(cloneNode(node.documentationComment), cloneNodeList(node.metadata), node.keyword, cloneNode(node.name), node.leftBracket, cloneNodeList(node.constants), node.rightBracket);
+ EnumDeclaration visitEnumDeclaration(EnumDeclaration node)
+ => new EnumDeclaration(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneToken(node.keyword),
+ cloneNode(node.name),
+ cloneToken(node.leftBracket),
+ cloneNodeList(node.constants),
+ cloneToken(node.rightBracket));
@override
ExportDirective visitExportDirective(ExportDirective node) {
- ExportDirective directive = new ExportDirective(cloneNode(node.documentationComment), cloneNodeList(node.metadata), node.keyword, cloneNode(node.uri), cloneNodeList(node.combinators), node.semicolon);
+ ExportDirective directive = new ExportDirective(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneToken(node.keyword),
+ cloneNode(node.uri),
+ cloneNodeList(node.combinators),
+ cloneToken(node.semicolon));
directive.source = node.source;
directive.uriContent = node.uriContent;
return directive;
}
@override
- ExpressionFunctionBody visitExpressionFunctionBody(ExpressionFunctionBody node) => new ExpressionFunctionBody(node.keyword, node.functionDefinition, cloneNode(node.expression), node.semicolon);
+ ExpressionFunctionBody visitExpressionFunctionBody(ExpressionFunctionBody node)
+ => new ExpressionFunctionBody(
+ cloneToken(node.keyword),
+ cloneToken(node.functionDefinition),
+ cloneNode(node.expression),
+ cloneToken(node.semicolon));
@override
- ExpressionStatement visitExpressionStatement(ExpressionStatement node) => new ExpressionStatement(cloneNode(node.expression), node.semicolon);
+ ExpressionStatement visitExpressionStatement(ExpressionStatement node)
+ => new ExpressionStatement(
+ cloneNode(node.expression),
+ cloneToken(node.semicolon));
@override
- ExtendsClause visitExtendsClause(ExtendsClause node) => new ExtendsClause(node.keyword, cloneNode(node.superclass));
+ ExtendsClause visitExtendsClause(ExtendsClause node)
+ => new ExtendsClause(
+ cloneToken(node.keyword),
+ cloneNode(node.superclass));
@override
- FieldDeclaration visitFieldDeclaration(FieldDeclaration node) => new FieldDeclaration(cloneNode(node.documentationComment), cloneNodeList(node.metadata), node.staticKeyword, cloneNode(node.fields), node.semicolon);
+ FieldDeclaration visitFieldDeclaration(FieldDeclaration node)
+ => new FieldDeclaration(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneToken(node.staticKeyword),
+ cloneNode(node.fields),
+ cloneToken(node.semicolon));
@override
- FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) => new FieldFormalParameter(cloneNode(node.documentationComment), cloneNodeList(node.metadata), node.keyword, cloneNode(node.type), node.thisToken, node.period, cloneNode(node.identifier), cloneNode(node.parameters));
+ FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node)
+ => new FieldFormalParameter(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneToken(node.keyword),
+ cloneNode(node.type),
+ cloneToken(node.thisToken),
+ cloneToken(node.period),
+ cloneNode(node.identifier),
+ cloneNode(node.parameters));
@override
ForEachStatement visitForEachStatement(ForEachStatement node) {
DeclaredIdentifier loopVariable = node.loopVariable;
if (loopVariable == null) {
- return new ForEachStatement.con2(node.awaitKeyword, node.forKeyword, node.leftParenthesis, cloneNode(node.identifier), node.inKeyword, cloneNode(node.iterator), node.rightParenthesis, cloneNode(node.body));
+ return new ForEachStatement.con2(
+ cloneToken(node.awaitKeyword),
+ cloneToken(node.forKeyword),
+ cloneToken(node.leftParenthesis),
+ cloneNode(node.identifier),
+ cloneToken(node.inKeyword),
+ cloneNode(node.iterator),
+ cloneToken(node.rightParenthesis),
+ cloneNode(node.body));
}
- return new ForEachStatement.con1(node.awaitKeyword, node.forKeyword, node.leftParenthesis, cloneNode(loopVariable), node.inKeyword, cloneNode(node.iterator), node.rightParenthesis, cloneNode(node.body));
+ return new ForEachStatement.con1(
+ cloneToken(node.awaitKeyword),
+ cloneToken(node.forKeyword),
+ cloneToken(node.leftParenthesis),
+ cloneNode(loopVariable),
+ cloneToken(node.inKeyword),
+ cloneNode(node.iterator),
+ cloneToken(node.rightParenthesis),
+ cloneNode(node.body));
}
@override
- FormalParameterList visitFormalParameterList(FormalParameterList node) => new FormalParameterList(node.leftParenthesis, cloneNodeList(node.parameters), node.leftDelimiter, node.rightDelimiter, node.rightParenthesis);
+ FormalParameterList visitFormalParameterList(FormalParameterList node)
+ => new FormalParameterList(
+ cloneToken(node.leftParenthesis),
+ cloneNodeList(node.parameters),
+ cloneToken(node.leftDelimiter),
+ cloneToken(node.rightDelimiter),
+ cloneToken(node.rightParenthesis));
@override
- ForStatement visitForStatement(ForStatement node) => new ForStatement(node.forKeyword, node.leftParenthesis, cloneNode(node.variables), cloneNode(node.initialization), node.leftSeparator, cloneNode(node.condition), node.rightSeparator, cloneNodeList(node.updaters), node.rightParenthesis, cloneNode(node.body));
+ ForStatement visitForStatement(ForStatement node)
+ => new ForStatement(
+ cloneToken(node.forKeyword),
+ cloneToken(node.leftParenthesis),
+ cloneNode(node.variables),
+ cloneNode(node.initialization),
+ cloneToken(node.leftSeparator),
+ cloneNode(node.condition),
+ cloneToken(node.rightSeparator),
+ cloneNodeList(node.updaters),
+ cloneToken(node.rightParenthesis),
+ cloneNode(node.body));
@override
- FunctionDeclaration visitFunctionDeclaration(FunctionDeclaration node) => new FunctionDeclaration(cloneNode(node.documentationComment), cloneNodeList(node.metadata), node.externalKeyword, cloneNode(node.returnType), node.propertyKeyword, cloneNode(node.name), cloneNode(node.functionExpression));
+ FunctionDeclaration visitFunctionDeclaration(FunctionDeclaration node)
+ => new FunctionDeclaration(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneToken(node.externalKeyword),
+ cloneNode(node.returnType),
+ cloneToken(node.propertyKeyword),
+ cloneNode(node.name),
+ cloneNode(node.functionExpression));
@override
- FunctionDeclarationStatement visitFunctionDeclarationStatement(FunctionDeclarationStatement node) => new FunctionDeclarationStatement(cloneNode(node.functionDeclaration));
+ FunctionDeclarationStatement visitFunctionDeclarationStatement(FunctionDeclarationStatement node)
+ => new FunctionDeclarationStatement(cloneNode(node.functionDeclaration));
@override
- FunctionExpression visitFunctionExpression(FunctionExpression node) => new FunctionExpression(cloneNode(node.parameters), cloneNode(node.body));
+ FunctionExpression visitFunctionExpression(FunctionExpression node)
+ => new FunctionExpression(
+ cloneNode(node.parameters),
+ cloneNode(node.body));
@override
- FunctionExpressionInvocation visitFunctionExpressionInvocation(FunctionExpressionInvocation node) => new FunctionExpressionInvocation(cloneNode(node.function), cloneNode(node.argumentList));
+ FunctionExpressionInvocation visitFunctionExpressionInvocation(FunctionExpressionInvocation node)
+ => new FunctionExpressionInvocation(
+ cloneNode(node.function),
+ cloneNode(node.argumentList));
@override
- FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) => new FunctionTypeAlias(cloneNode(node.documentationComment), cloneNodeList(node.metadata), node.keyword, cloneNode(node.returnType), cloneNode(node.name), cloneNode(node.typeParameters), cloneNode(node.parameters), node.semicolon);
+ FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node)
+ => new FunctionTypeAlias(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneToken(node.keyword),
+ cloneNode(node.returnType),
+ cloneNode(node.name),
+ cloneNode(node.typeParameters),
+ cloneNode(node.parameters),
+ cloneToken(node.semicolon));
@override
- FunctionTypedFormalParameter visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) => new FunctionTypedFormalParameter(cloneNode(node.documentationComment), cloneNodeList(node.metadata), cloneNode(node.returnType), cloneNode(node.identifier), cloneNode(node.parameters));
+ FunctionTypedFormalParameter visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node)
+ => new FunctionTypedFormalParameter(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneNode(node.returnType),
+ cloneNode(node.identifier),
+ cloneNode(node.parameters));
@override
- HideCombinator visitHideCombinator(HideCombinator node) => new HideCombinator(node.keyword, cloneNodeList(node.hiddenNames));
+ HideCombinator visitHideCombinator(HideCombinator node)
+ => new HideCombinator(
+ cloneToken(node.keyword),
+ cloneNodeList(node.hiddenNames));
@override
- IfStatement visitIfStatement(IfStatement node) => new IfStatement(node.ifKeyword, node.leftParenthesis, cloneNode(node.condition), node.rightParenthesis, cloneNode(node.thenStatement), node.elseKeyword, cloneNode(node.elseStatement));
+ IfStatement visitIfStatement(IfStatement node)
+ => new IfStatement(
+ cloneToken(node.ifKeyword),
+ cloneToken(node.leftParenthesis),
+ cloneNode(node.condition),
+ cloneToken(node.rightParenthesis),
+ cloneNode(node.thenStatement),
+ cloneToken(node.elseKeyword),
+ cloneNode(node.elseStatement));
@override
- ImplementsClause visitImplementsClause(ImplementsClause node) => new ImplementsClause(node.keyword, cloneNodeList(node.interfaces));
+ ImplementsClause visitImplementsClause(ImplementsClause node)
+ => new ImplementsClause(
+ cloneToken(node.keyword),
+ cloneNodeList(node.interfaces));
@override
ImportDirective visitImportDirective(ImportDirective node) {
- ImportDirective directive = new ImportDirective(cloneNode(node.documentationComment), cloneNodeList(node.metadata), node.keyword, cloneNode(node.uri), node.deferredToken, node.asToken, cloneNode(node.prefix), cloneNodeList(node.combinators), node.semicolon);
+ ImportDirective directive = new ImportDirective(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneToken(node.keyword),
+ cloneNode(node.uri),
+ cloneToken(node.deferredToken),
+ cloneToken(node.asToken),
+ cloneNode(node.prefix),
+ cloneNodeList(node.combinators),
+ cloneToken(node.semicolon));
directive.source = node.source;
directive.uriContent = node.uriContent;
return directive;
@@ -1197,202 +1520,404 @@
IndexExpression visitIndexExpression(IndexExpression node) {
Token period = node.period;
if (period == null) {
- return new IndexExpression.forTarget(cloneNode(node.target), node.leftBracket, cloneNode(node.index), node.rightBracket);
+ return new IndexExpression.forTarget(
+ cloneNode(node.target),
+ cloneToken(node.leftBracket),
+ cloneNode(node.index),
+ cloneToken(node.rightBracket));
} else {
- return new IndexExpression.forCascade(period, node.leftBracket, cloneNode(node.index), node.rightBracket);
+ return new IndexExpression.forCascade(
+ cloneToken(period),
+ cloneToken(node.leftBracket),
+ cloneNode(node.index),
+ cloneToken(node.rightBracket));
}
}
@override
- InstanceCreationExpression visitInstanceCreationExpression(InstanceCreationExpression node) => new InstanceCreationExpression(node.keyword, cloneNode(node.constructorName), cloneNode(node.argumentList));
+ InstanceCreationExpression visitInstanceCreationExpression(InstanceCreationExpression node)
+ => new InstanceCreationExpression(
+ cloneToken(node.keyword),
+ cloneNode(node.constructorName),
+ cloneNode(node.argumentList));
@override
- IntegerLiteral visitIntegerLiteral(IntegerLiteral node) => new IntegerLiteral(node.literal, node.value);
+ IntegerLiteral visitIntegerLiteral(IntegerLiteral node)
+ => new IntegerLiteral(cloneToken(node.literal), node.value);
@override
- InterpolationExpression visitInterpolationExpression(InterpolationExpression node) => new InterpolationExpression(node.leftBracket, cloneNode(node.expression), node.rightBracket);
+ InterpolationExpression visitInterpolationExpression(InterpolationExpression node)
+ => new InterpolationExpression(
+ cloneToken(node.leftBracket),
+ cloneNode(node.expression),
+ cloneToken(node.rightBracket));
@override
- InterpolationString visitInterpolationString(InterpolationString node) => new InterpolationString(node.contents, node.value);
+ InterpolationString visitInterpolationString(InterpolationString node)
+ => new InterpolationString(cloneToken(node.contents), node.value);
@override
- IsExpression visitIsExpression(IsExpression node) => new IsExpression(cloneNode(node.expression), node.isOperator, node.notOperator, cloneNode(node.type));
+ IsExpression visitIsExpression(IsExpression node)
+ => new IsExpression(
+ cloneNode(node.expression),
+ cloneToken(node.isOperator),
+ cloneToken(node.notOperator),
+ cloneNode(node.type));
@override
- Label visitLabel(Label node) => new Label(cloneNode(node.label), node.colon);
+ Label visitLabel(Label node)
+ => new Label(cloneNode(node.label), cloneToken(node.colon));
@override
- LabeledStatement visitLabeledStatement(LabeledStatement node) => new LabeledStatement(cloneNodeList(node.labels), cloneNode(node.statement));
+ LabeledStatement visitLabeledStatement(LabeledStatement node)
+ => new LabeledStatement(
+ cloneNodeList(node.labels),
+ cloneNode(node.statement));
@override
- LibraryDirective visitLibraryDirective(LibraryDirective node) => new LibraryDirective(cloneNode(node.documentationComment), cloneNodeList(node.metadata), node.libraryToken, cloneNode(node.name), node.semicolon);
+ LibraryDirective visitLibraryDirective(LibraryDirective node)
+ => new LibraryDirective(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneToken(node.libraryToken),
+ cloneNode(node.name),
+ cloneToken(node.semicolon));
@override
- LibraryIdentifier visitLibraryIdentifier(LibraryIdentifier node) => new LibraryIdentifier(cloneNodeList(node.components));
+ LibraryIdentifier visitLibraryIdentifier(LibraryIdentifier node)
+ => new LibraryIdentifier(cloneNodeList(node.components));
@override
- ListLiteral visitListLiteral(ListLiteral node) => new ListLiteral(node.constKeyword, cloneNode(node.typeArguments), node.leftBracket, cloneNodeList(node.elements), node.rightBracket);
+ ListLiteral visitListLiteral(ListLiteral node)
+ => new ListLiteral(
+ cloneToken(node.constKeyword),
+ cloneNode(node.typeArguments),
+ cloneToken(node.leftBracket),
+ cloneNodeList(node.elements),
+ cloneToken(node.rightBracket));
@override
- MapLiteral visitMapLiteral(MapLiteral node) => new MapLiteral(node.constKeyword, cloneNode(node.typeArguments), node.leftBracket, cloneNodeList(node.entries), node.rightBracket);
+ MapLiteral visitMapLiteral(MapLiteral node)
+ => new MapLiteral(
+ cloneToken(node.constKeyword),
+ cloneNode(node.typeArguments),
+ cloneToken(node.leftBracket),
+ cloneNodeList(node.entries),
+ cloneToken(node.rightBracket));
@override
- MapLiteralEntry visitMapLiteralEntry(MapLiteralEntry node) => new MapLiteralEntry(cloneNode(node.key), node.separator, cloneNode(node.value));
+ MapLiteralEntry visitMapLiteralEntry(MapLiteralEntry node)
+ => new MapLiteralEntry(
+ cloneNode(node.key),
+ cloneToken(node.separator),
+ cloneNode(node.value));
@override
- MethodDeclaration visitMethodDeclaration(MethodDeclaration node) => new MethodDeclaration(cloneNode(node.documentationComment), cloneNodeList(node.metadata), node.externalKeyword, node.modifierKeyword, cloneNode(node.returnType), node.propertyKeyword, node.operatorKeyword, cloneNode(node.name), cloneNode(node.parameters), cloneNode(node.body));
+ MethodDeclaration visitMethodDeclaration(MethodDeclaration node)
+ => new MethodDeclaration(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneToken(node.externalKeyword),
+ cloneToken(node.modifierKeyword),
+ cloneNode(node.returnType),
+ cloneToken(node.propertyKeyword),
+ cloneToken(node.operatorKeyword),
+ cloneNode(node.name),
+ cloneNode(node.parameters),
+ cloneNode(node.body));
@override
- MethodInvocation visitMethodInvocation(MethodInvocation node) => new MethodInvocation(cloneNode(node.target), node.period, cloneNode(node.methodName), cloneNode(node.argumentList));
+ MethodInvocation visitMethodInvocation(MethodInvocation node)
+ => new MethodInvocation(
+ cloneNode(node.target),
+ cloneToken(node.period),
+ cloneNode(node.methodName),
+ cloneNode(node.argumentList));
@override
- NamedExpression visitNamedExpression(NamedExpression node) => new NamedExpression(cloneNode(node.name), cloneNode(node.expression));
+ NamedExpression visitNamedExpression(NamedExpression node)
+ => new NamedExpression(cloneNode(node.name), cloneNode(node.expression));
@override
- AstNode visitNativeClause(NativeClause node) => new NativeClause(node.keyword, cloneNode(node.name));
+ AstNode visitNativeClause(NativeClause node)
+ => new NativeClause(cloneToken(node.keyword), cloneNode(node.name));
@override
- NativeFunctionBody visitNativeFunctionBody(NativeFunctionBody node) => new NativeFunctionBody(node.nativeToken, cloneNode(node.stringLiteral), node.semicolon);
+ NativeFunctionBody visitNativeFunctionBody(NativeFunctionBody node)
+ => new NativeFunctionBody(
+ cloneToken(node.nativeToken),
+ cloneNode(node.stringLiteral),
+ cloneToken(node.semicolon));
@override
- NullLiteral visitNullLiteral(NullLiteral node) => new NullLiteral(node.literal);
+ NullLiteral visitNullLiteral(NullLiteral node)
+ => new NullLiteral(cloneToken(node.literal));
@override
- ParenthesizedExpression visitParenthesizedExpression(ParenthesizedExpression node) => new ParenthesizedExpression(node.leftParenthesis, cloneNode(node.expression), node.rightParenthesis);
+ ParenthesizedExpression visitParenthesizedExpression(ParenthesizedExpression node)
+ => new ParenthesizedExpression(
+ cloneToken(node.leftParenthesis),
+ cloneNode(node.expression),
+ cloneToken(node.rightParenthesis));
@override
PartDirective visitPartDirective(PartDirective node) {
- PartDirective directive = new PartDirective(cloneNode(node.documentationComment), cloneNodeList(node.metadata), node.partToken, cloneNode(node.uri), node.semicolon);
+ PartDirective directive = new PartDirective(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneToken(node.partToken),
+ cloneNode(node.uri),
+ cloneToken(node.semicolon));
directive.source = node.source;
directive.uriContent = node.uriContent;
return directive;
}
@override
- PartOfDirective visitPartOfDirective(PartOfDirective node) => new PartOfDirective(cloneNode(node.documentationComment), cloneNodeList(node.metadata), node.partToken, node.ofToken, cloneNode(node.libraryName), node.semicolon);
+ PartOfDirective visitPartOfDirective(PartOfDirective node)
+ => new PartOfDirective(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneToken(node.partToken),
+ cloneToken(node.ofToken),
+ cloneNode(node.libraryName),
+ cloneToken(node.semicolon));
@override
- PostfixExpression visitPostfixExpression(PostfixExpression node) => new PostfixExpression(cloneNode(node.operand), node.operator);
+ PostfixExpression visitPostfixExpression(PostfixExpression node)
+ => new PostfixExpression(
+ cloneNode(node.operand),
+ cloneToken(node.operator));
@override
- PrefixedIdentifier visitPrefixedIdentifier(PrefixedIdentifier node) => new PrefixedIdentifier(cloneNode(node.prefix), node.period, cloneNode(node.identifier));
+ PrefixedIdentifier visitPrefixedIdentifier(PrefixedIdentifier node)
+ => new PrefixedIdentifier(
+ cloneNode(node.prefix),
+ cloneToken(node.period),
+ cloneNode(node.identifier));
@override
- PrefixExpression visitPrefixExpression(PrefixExpression node) => new PrefixExpression(node.operator, cloneNode(node.operand));
+ PrefixExpression visitPrefixExpression(PrefixExpression node)
+ => new PrefixExpression(
+ cloneToken(node.operator),
+ cloneNode(node.operand));
@override
- PropertyAccess visitPropertyAccess(PropertyAccess node) => new PropertyAccess(cloneNode(node.target), node.operator, cloneNode(node.propertyName));
+ PropertyAccess visitPropertyAccess(PropertyAccess node)
+ => new PropertyAccess(
+ cloneNode(node.target),
+ cloneToken(node.operator),
+ cloneNode(node.propertyName));
@override
- RedirectingConstructorInvocation visitRedirectingConstructorInvocation(RedirectingConstructorInvocation node) => new RedirectingConstructorInvocation(node.keyword, node.period, cloneNode(node.constructorName), cloneNode(node.argumentList));
+ RedirectingConstructorInvocation visitRedirectingConstructorInvocation(RedirectingConstructorInvocation node)
+ => new RedirectingConstructorInvocation(
+ cloneToken(node.keyword),
+ cloneToken(node.period),
+ cloneNode(node.constructorName),
+ cloneNode(node.argumentList));
@override
- RethrowExpression visitRethrowExpression(RethrowExpression node) => new RethrowExpression(node.keyword);
+ RethrowExpression visitRethrowExpression(RethrowExpression node)
+ => new RethrowExpression(cloneToken(node.keyword));
@override
- ReturnStatement visitReturnStatement(ReturnStatement node) => new ReturnStatement(node.keyword, cloneNode(node.expression), node.semicolon);
+ ReturnStatement visitReturnStatement(ReturnStatement node)
+ => new ReturnStatement(
+ cloneToken(node.keyword),
+ cloneNode(node.expression),
+ cloneToken(node.semicolon));
@override
- ScriptTag visitScriptTag(ScriptTag node) => new ScriptTag(node.scriptTag);
+ ScriptTag visitScriptTag(ScriptTag node)
+ => new ScriptTag(cloneToken(node.scriptTag));
@override
- ShowCombinator visitShowCombinator(ShowCombinator node) => new ShowCombinator(node.keyword, cloneNodeList(node.shownNames));
+ ShowCombinator visitShowCombinator(ShowCombinator node)
+ => new ShowCombinator(
+ cloneToken(node.keyword),
+ cloneNodeList(node.shownNames));
@override
- SimpleFormalParameter visitSimpleFormalParameter(SimpleFormalParameter node) => new SimpleFormalParameter(cloneNode(node.documentationComment), cloneNodeList(node.metadata), node.keyword, cloneNode(node.type), cloneNode(node.identifier));
+ SimpleFormalParameter visitSimpleFormalParameter(SimpleFormalParameter node)
+ => new SimpleFormalParameter(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneToken(node.keyword),
+ cloneNode(node.type),
+ cloneNode(node.identifier));
@override
- SimpleIdentifier visitSimpleIdentifier(SimpleIdentifier node) => new SimpleIdentifier(node.token);
+ SimpleIdentifier visitSimpleIdentifier(SimpleIdentifier node)
+ => new SimpleIdentifier(cloneToken(node.token));
@override
- SimpleStringLiteral visitSimpleStringLiteral(SimpleStringLiteral node) => new SimpleStringLiteral(node.literal, node.value);
+ SimpleStringLiteral visitSimpleStringLiteral(SimpleStringLiteral node)
+ => new SimpleStringLiteral(cloneToken(node.literal), node.value);
@override
- StringInterpolation visitStringInterpolation(StringInterpolation node) => new StringInterpolation(cloneNodeList(node.elements));
+ StringInterpolation visitStringInterpolation(StringInterpolation node)
+ => new StringInterpolation(cloneNodeList(node.elements));
@override
- SuperConstructorInvocation visitSuperConstructorInvocation(SuperConstructorInvocation node) => new SuperConstructorInvocation(node.keyword, node.period, cloneNode(node.constructorName), cloneNode(node.argumentList));
+ SuperConstructorInvocation visitSuperConstructorInvocation(SuperConstructorInvocation node)
+ => new SuperConstructorInvocation(
+ cloneToken(node.keyword),
+ cloneToken(node.period),
+ cloneNode(node.constructorName),
+ cloneNode(node.argumentList));
@override
- SuperExpression visitSuperExpression(SuperExpression node) => new SuperExpression(node.keyword);
+ SuperExpression visitSuperExpression(SuperExpression node)
+ => new SuperExpression(cloneToken(node.keyword));
@override
- SwitchCase visitSwitchCase(SwitchCase node) => new SwitchCase(cloneNodeList(node.labels), node.keyword, cloneNode(node.expression), node.colon, cloneNodeList(node.statements));
+ SwitchCase visitSwitchCase(SwitchCase node)
+ => new SwitchCase(
+ cloneNodeList(node.labels),
+ cloneToken(node.keyword),
+ cloneNode(node.expression),
+ cloneToken(node.colon),
+ cloneNodeList(node.statements));
@override
- SwitchDefault visitSwitchDefault(SwitchDefault node) => new SwitchDefault(cloneNodeList(node.labels), node.keyword, node.colon, cloneNodeList(node.statements));
+ SwitchDefault visitSwitchDefault(SwitchDefault node)
+ => new SwitchDefault(
+ cloneNodeList(node.labels),
+ cloneToken(node.keyword),
+ cloneToken(node.colon),
+ cloneNodeList(node.statements));
@override
- SwitchStatement visitSwitchStatement(SwitchStatement node) => new SwitchStatement(node.keyword, node.leftParenthesis, cloneNode(node.expression), node.rightParenthesis, node.leftBracket, cloneNodeList(node.members), node.rightBracket);
+ SwitchStatement visitSwitchStatement(SwitchStatement node)
+ => new SwitchStatement(
+ cloneToken(node.keyword),
+ cloneToken(node.leftParenthesis),
+ cloneNode(node.expression),
+ cloneToken(node.rightParenthesis),
+ cloneToken(node.leftBracket),
+ cloneNodeList(node.members),
+ cloneToken(node.rightBracket));
@override
- SymbolLiteral visitSymbolLiteral(SymbolLiteral node) => new SymbolLiteral(node.poundSign, node.components);
+ SymbolLiteral visitSymbolLiteral(SymbolLiteral node)
+ => new SymbolLiteral(
+ cloneToken(node.poundSign),
+ cloneTokenList(node.components));
@override
- ThisExpression visitThisExpression(ThisExpression node) => new ThisExpression(node.keyword);
+ ThisExpression visitThisExpression(ThisExpression node)
+ => new ThisExpression(cloneToken(node.keyword));
@override
- ThrowExpression visitThrowExpression(ThrowExpression node) => new ThrowExpression(node.keyword, cloneNode(node.expression));
+ ThrowExpression visitThrowExpression(ThrowExpression node)
+ => new ThrowExpression(
+ cloneToken(node.keyword),
+ cloneNode(node.expression));
@override
- TopLevelVariableDeclaration visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) => new TopLevelVariableDeclaration(cloneNode(node.documentationComment), cloneNodeList(node.metadata), cloneNode(node.variables), node.semicolon);
+ TopLevelVariableDeclaration visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node)
+ => new TopLevelVariableDeclaration(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneNode(node.variables),
+ cloneToken(node.semicolon));
@override
- TryStatement visitTryStatement(TryStatement node) => new TryStatement(node.tryKeyword, cloneNode(node.body), cloneNodeList(node.catchClauses), node.finallyKeyword, cloneNode(node.finallyBlock));
+ TryStatement visitTryStatement(TryStatement node)
+ => new TryStatement(
+ cloneToken(node.tryKeyword),
+ cloneNode(node.body),
+ cloneNodeList(node.catchClauses),
+ cloneToken(node.finallyKeyword),
+ cloneNode(node.finallyBlock));
@override
- TypeArgumentList visitTypeArgumentList(TypeArgumentList node) => new TypeArgumentList(node.leftBracket, cloneNodeList(node.arguments), node.rightBracket);
+ TypeArgumentList visitTypeArgumentList(TypeArgumentList node)
+ => new TypeArgumentList(
+ cloneToken(node.leftBracket),
+ cloneNodeList(node.arguments),
+ cloneToken(node.rightBracket));
@override
- TypeName visitTypeName(TypeName node) => new TypeName(cloneNode(node.name), cloneNode(node.typeArguments));
+ TypeName visitTypeName(TypeName node)
+ => new TypeName(cloneNode(node.name), cloneNode(node.typeArguments));
@override
- TypeParameter visitTypeParameter(TypeParameter node) => new TypeParameter(cloneNode(node.documentationComment), cloneNodeList(node.metadata), cloneNode(node.name), node.keyword, cloneNode(node.bound));
+ TypeParameter visitTypeParameter(TypeParameter node)
+ => new TypeParameter(
+ cloneNode(node.documentationComment),
+ cloneNodeList(node.metadata),
+ cloneNode(node.name),
+ cloneToken(node.keyword),
+ cloneNode(node.bound));
@override
- TypeParameterList visitTypeParameterList(TypeParameterList node) => new TypeParameterList(node.leftBracket, cloneNodeList(node.typeParameters), node.rightBracket);
+ TypeParameterList visitTypeParameterList(TypeParameterList node)
+ => new TypeParameterList(
+ cloneToken(node.leftBracket),
+ cloneNodeList(node.typeParameters),
+ cloneToken(node.rightBracket));
@override
- VariableDeclaration visitVariableDeclaration(VariableDeclaration node) => new VariableDeclaration(null, cloneNodeList(node.metadata), cloneNode(node.name), node.equals, cloneNode(node.initializer));
+ VariableDeclaration visitVariableDeclaration(VariableDeclaration node)
+ => new VariableDeclaration(
+ null,
+ cloneNodeList(node.metadata),
+ cloneNode(node.name),
+ cloneToken(node.equals),
+ cloneNode(node.initializer));
@override
- VariableDeclarationList visitVariableDeclarationList(VariableDeclarationList node) => new VariableDeclarationList(null, cloneNodeList(node.metadata), node.keyword, cloneNode(node.type), cloneNodeList(node.variables));
+ VariableDeclarationList visitVariableDeclarationList(VariableDeclarationList node)
+ => new VariableDeclarationList(
+ null,
+ cloneNodeList(node.metadata),
+ cloneToken(node.keyword),
+ cloneNode(node.type),
+ cloneNodeList(node.variables));
@override
- VariableDeclarationStatement visitVariableDeclarationStatement(VariableDeclarationStatement node) => new VariableDeclarationStatement(cloneNode(node.variables), node.semicolon);
+ VariableDeclarationStatement visitVariableDeclarationStatement(VariableDeclarationStatement node)
+ => new VariableDeclarationStatement(
+ cloneNode(node.variables),
+ cloneToken(node.semicolon));
@override
- WhileStatement visitWhileStatement(WhileStatement node) => new WhileStatement(node.keyword, node.leftParenthesis, cloneNode(node.condition), node.rightParenthesis, cloneNode(node.body));
+ WhileStatement visitWhileStatement(WhileStatement node)
+ => new WhileStatement(
+ cloneToken(node.keyword),
+ cloneToken(node.leftParenthesis),
+ cloneNode(node.condition),
+ cloneToken(node.rightParenthesis),
+ cloneNode(node.body));
@override
- WithClause visitWithClause(WithClause node) => new WithClause(node.withKeyword, cloneNodeList(node.mixinTypes));
+ WithClause visitWithClause(WithClause node)
+ => new WithClause(
+ cloneToken(node.withKeyword),
+ cloneNodeList(node.mixinTypes));
@override
- YieldStatement visitYieldStatement(YieldStatement node) => new YieldStatement(node.yieldKeyword, node.star, node.expression, node.semicolon);
-
- AstNode cloneNode(AstNode node) {
- if (node == null) {
- return null;
- }
- return node.accept(this) as AstNode;
- }
+ YieldStatement visitYieldStatement(YieldStatement node)
+ => new YieldStatement(
+ cloneToken(node.yieldKeyword),
+ cloneToken(node.star),
+ cloneNode(node.expression),
+ cloneToken(node.semicolon));
}
/**
- * Instances of the class `AstComparator` compare the structure of two ASTNodes to see whether
+ * An `AstComparator` compares the structure of two AstNodes to see whether
* they are equal.
*/
class AstComparator implements AstVisitor<bool> {
/**
- * Return `true` if the two AST nodes are equal.
- *
- * @param first the first node being compared
- * @param second the second node being compared
- * @return `true` if the two AST nodes are equal
+ * Return `true` if the [first] node and the [second] node are equal.
*/
static bool equalNodes(AstNode first, AstNode second) {
AstComparator comparator = new AstComparator();
- return comparator._isEqualNodes(first, second);
+ return comparator.isEqualNodes(first, second);
}
/**
@@ -1410,91 +1935,91 @@
@override
bool visitAnnotation(Annotation node) {
Annotation other = this._other as Annotation;
- return _isEqualTokens(node.atSign, other.atSign) && _isEqualNodes(node.name, other.name) && _isEqualTokens(node.period, other.period) && _isEqualNodes(node.constructorName, other.constructorName) && _isEqualNodes(node.arguments, other.arguments);
+ return isEqualTokens(node.atSign, other.atSign) && isEqualNodes(node.name, other.name) && isEqualTokens(node.period, other.period) && isEqualNodes(node.constructorName, other.constructorName) && isEqualNodes(node.arguments, other.arguments);
}
@override
bool visitArgumentList(ArgumentList node) {
ArgumentList other = this._other as ArgumentList;
- return _isEqualTokens(node.leftParenthesis, other.leftParenthesis) && _isEqualNodeLists(node.arguments, other.arguments) && _isEqualTokens(node.rightParenthesis, other.rightParenthesis);
+ return isEqualTokens(node.leftParenthesis, other.leftParenthesis) && _isEqualNodeLists(node.arguments, other.arguments) && isEqualTokens(node.rightParenthesis, other.rightParenthesis);
}
@override
bool visitAsExpression(AsExpression node) {
AsExpression other = this._other as AsExpression;
- return _isEqualNodes(node.expression, other.expression) && _isEqualTokens(node.asOperator, other.asOperator) && _isEqualNodes(node.type, other.type);
+ return isEqualNodes(node.expression, other.expression) && isEqualTokens(node.asOperator, other.asOperator) && isEqualNodes(node.type, other.type);
}
@override
bool visitAssertStatement(AssertStatement node) {
AssertStatement other = this._other as AssertStatement;
- return _isEqualTokens(node.keyword, other.keyword) && _isEqualTokens(node.leftParenthesis, other.leftParenthesis) && _isEqualNodes(node.condition, other.condition) && _isEqualTokens(node.rightParenthesis, other.rightParenthesis) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualTokens(node.keyword, other.keyword) && isEqualTokens(node.leftParenthesis, other.leftParenthesis) && isEqualNodes(node.condition, other.condition) && isEqualTokens(node.rightParenthesis, other.rightParenthesis) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitAssignmentExpression(AssignmentExpression node) {
AssignmentExpression other = this._other as AssignmentExpression;
- return _isEqualNodes(node.leftHandSide, other.leftHandSide) && _isEqualTokens(node.operator, other.operator) && _isEqualNodes(node.rightHandSide, other.rightHandSide);
+ return isEqualNodes(node.leftHandSide, other.leftHandSide) && isEqualTokens(node.operator, other.operator) && isEqualNodes(node.rightHandSide, other.rightHandSide);
}
@override
bool visitAwaitExpression(AwaitExpression node) {
AwaitExpression other = this._other as AwaitExpression;
- return _isEqualTokens(node.awaitKeyword, other.awaitKeyword) && _isEqualNodes(node.expression, other.expression);
+ return isEqualTokens(node.awaitKeyword, other.awaitKeyword) && isEqualNodes(node.expression, other.expression);
}
@override
bool visitBinaryExpression(BinaryExpression node) {
BinaryExpression other = this._other as BinaryExpression;
- return _isEqualNodes(node.leftOperand, other.leftOperand) && _isEqualTokens(node.operator, other.operator) && _isEqualNodes(node.rightOperand, other.rightOperand);
+ return isEqualNodes(node.leftOperand, other.leftOperand) && isEqualTokens(node.operator, other.operator) && isEqualNodes(node.rightOperand, other.rightOperand);
}
@override
bool visitBlock(Block node) {
Block other = this._other as Block;
- return _isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodeLists(node.statements, other.statements) && _isEqualTokens(node.rightBracket, other.rightBracket);
+ return isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodeLists(node.statements, other.statements) && isEqualTokens(node.rightBracket, other.rightBracket);
}
@override
bool visitBlockFunctionBody(BlockFunctionBody node) {
BlockFunctionBody other = this._other as BlockFunctionBody;
- return _isEqualNodes(node.block, other.block);
+ return isEqualNodes(node.block, other.block);
}
@override
bool visitBooleanLiteral(BooleanLiteral node) {
BooleanLiteral other = this._other as BooleanLiteral;
- return _isEqualTokens(node.literal, other.literal) && node.value == other.value;
+ return isEqualTokens(node.literal, other.literal) && node.value == other.value;
}
@override
bool visitBreakStatement(BreakStatement node) {
BreakStatement other = this._other as BreakStatement;
- return _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.label, other.label) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.label, other.label) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitCascadeExpression(CascadeExpression node) {
CascadeExpression other = this._other as CascadeExpression;
- return _isEqualNodes(node.target, other.target) && _isEqualNodeLists(node.cascadeSections, other.cascadeSections);
+ return isEqualNodes(node.target, other.target) && _isEqualNodeLists(node.cascadeSections, other.cascadeSections);
}
@override
bool visitCatchClause(CatchClause node) {
CatchClause other = this._other as CatchClause;
- return _isEqualTokens(node.onKeyword, other.onKeyword) && _isEqualNodes(node.exceptionType, other.exceptionType) && _isEqualTokens(node.catchKeyword, other.catchKeyword) && _isEqualTokens(node.leftParenthesis, other.leftParenthesis) && _isEqualNodes(node.exceptionParameter, other.exceptionParameter) && _isEqualTokens(node.comma, other.comma) && _isEqualNodes(node.stackTraceParameter, other.stackTraceParameter) && _isEqualTokens(node.rightParenthesis, other.rightParenthesis) && _isEqualNodes(node.body, other.body);
+ return isEqualTokens(node.onKeyword, other.onKeyword) && isEqualNodes(node.exceptionType, other.exceptionType) && isEqualTokens(node.catchKeyword, other.catchKeyword) && isEqualTokens(node.leftParenthesis, other.leftParenthesis) && isEqualNodes(node.exceptionParameter, other.exceptionParameter) && isEqualTokens(node.comma, other.comma) && isEqualNodes(node.stackTraceParameter, other.stackTraceParameter) && isEqualTokens(node.rightParenthesis, other.rightParenthesis) && isEqualNodes(node.body, other.body);
}
@override
bool visitClassDeclaration(ClassDeclaration node) {
ClassDeclaration other = this._other as ClassDeclaration;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.abstractKeyword, other.abstractKeyword) && _isEqualTokens(node.classKeyword, other.classKeyword) && _isEqualNodes(node.name, other.name) && _isEqualNodes(node.typeParameters, other.typeParameters) && _isEqualNodes(node.extendsClause, other.extendsClause) && _isEqualNodes(node.withClause, other.withClause) && _isEqualNodes(node.implementsClause, other.implementsClause) && _isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodeLists(node.members, other.members) && _isEqualTokens(node.rightBracket, other.rightBracket);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.abstractKeyword, other.abstractKeyword) && isEqualTokens(node.classKeyword, other.classKeyword) && isEqualNodes(node.name, other.name) && isEqualNodes(node.typeParameters, other.typeParameters) && isEqualNodes(node.extendsClause, other.extendsClause) && isEqualNodes(node.withClause, other.withClause) && isEqualNodes(node.implementsClause, other.implementsClause) && isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodeLists(node.members, other.members) && isEqualTokens(node.rightBracket, other.rightBracket);
}
@override
bool visitClassTypeAlias(ClassTypeAlias node) {
ClassTypeAlias other = this._other as ClassTypeAlias;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.name, other.name) && _isEqualNodes(node.typeParameters, other.typeParameters) && _isEqualTokens(node.equals, other.equals) && _isEqualTokens(node.abstractKeyword, other.abstractKeyword) && _isEqualNodes(node.superclass, other.superclass) && _isEqualNodes(node.withClause, other.withClause) && _isEqualNodes(node.implementsClause, other.implementsClause) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.name, other.name) && isEqualNodes(node.typeParameters, other.typeParameters) && isEqualTokens(node.equals, other.equals) && isEqualTokens(node.abstractKeyword, other.abstractKeyword) && isEqualNodes(node.superclass, other.superclass) && isEqualNodes(node.withClause, other.withClause) && isEqualNodes(node.implementsClause, other.implementsClause) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
@@ -1506,259 +2031,259 @@
@override
bool visitCommentReference(CommentReference node) {
CommentReference other = this._other as CommentReference;
- return _isEqualTokens(node.newKeyword, other.newKeyword) && _isEqualNodes(node.identifier, other.identifier);
+ return isEqualTokens(node.newKeyword, other.newKeyword) && isEqualNodes(node.identifier, other.identifier);
}
@override
bool visitCompilationUnit(CompilationUnit node) {
CompilationUnit other = this._other as CompilationUnit;
- return _isEqualTokens(node.beginToken, other.beginToken) && _isEqualNodes(node.scriptTag, other.scriptTag) && _isEqualNodeLists(node.directives, other.directives) && _isEqualNodeLists(node.declarations, other.declarations) && _isEqualTokens(node.endToken, other.endToken);
+ return isEqualTokens(node.beginToken, other.beginToken) && isEqualNodes(node.scriptTag, other.scriptTag) && _isEqualNodeLists(node.directives, other.directives) && _isEqualNodeLists(node.declarations, other.declarations) && isEqualTokens(node.endToken, other.endToken);
}
@override
bool visitConditionalExpression(ConditionalExpression node) {
ConditionalExpression other = this._other as ConditionalExpression;
- return _isEqualNodes(node.condition, other.condition) && _isEqualTokens(node.question, other.question) && _isEqualNodes(node.thenExpression, other.thenExpression) && _isEqualTokens(node.colon, other.colon) && _isEqualNodes(node.elseExpression, other.elseExpression);
+ return isEqualNodes(node.condition, other.condition) && isEqualTokens(node.question, other.question) && isEqualNodes(node.thenExpression, other.thenExpression) && isEqualTokens(node.colon, other.colon) && isEqualNodes(node.elseExpression, other.elseExpression);
}
@override
bool visitConstructorDeclaration(ConstructorDeclaration node) {
ConstructorDeclaration other = this._other as ConstructorDeclaration;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.externalKeyword, other.externalKeyword) && _isEqualTokens(node.constKeyword, other.constKeyword) && _isEqualTokens(node.factoryKeyword, other.factoryKeyword) && _isEqualNodes(node.returnType, other.returnType) && _isEqualTokens(node.period, other.period) && _isEqualNodes(node.name, other.name) && _isEqualNodes(node.parameters, other.parameters) && _isEqualTokens(node.separator, other.separator) && _isEqualNodeLists(node.initializers, other.initializers) && _isEqualNodes(node.redirectedConstructor, other.redirectedConstructor) && _isEqualNodes(node.body, other.body);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.externalKeyword, other.externalKeyword) && isEqualTokens(node.constKeyword, other.constKeyword) && isEqualTokens(node.factoryKeyword, other.factoryKeyword) && isEqualNodes(node.returnType, other.returnType) && isEqualTokens(node.period, other.period) && isEqualNodes(node.name, other.name) && isEqualNodes(node.parameters, other.parameters) && isEqualTokens(node.separator, other.separator) && _isEqualNodeLists(node.initializers, other.initializers) && isEqualNodes(node.redirectedConstructor, other.redirectedConstructor) && isEqualNodes(node.body, other.body);
}
@override
bool visitConstructorFieldInitializer(ConstructorFieldInitializer node) {
ConstructorFieldInitializer other = this._other as ConstructorFieldInitializer;
- return _isEqualTokens(node.keyword, other.keyword) && _isEqualTokens(node.period, other.period) && _isEqualNodes(node.fieldName, other.fieldName) && _isEqualTokens(node.equals, other.equals) && _isEqualNodes(node.expression, other.expression);
+ return isEqualTokens(node.keyword, other.keyword) && isEqualTokens(node.period, other.period) && isEqualNodes(node.fieldName, other.fieldName) && isEqualTokens(node.equals, other.equals) && isEqualNodes(node.expression, other.expression);
}
@override
bool visitConstructorName(ConstructorName node) {
ConstructorName other = this._other as ConstructorName;
- return _isEqualNodes(node.type, other.type) && _isEqualTokens(node.period, other.period) && _isEqualNodes(node.name, other.name);
+ return isEqualNodes(node.type, other.type) && isEqualTokens(node.period, other.period) && isEqualNodes(node.name, other.name);
}
@override
bool visitContinueStatement(ContinueStatement node) {
ContinueStatement other = this._other as ContinueStatement;
- return _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.label, other.label) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.label, other.label) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitDeclaredIdentifier(DeclaredIdentifier node) {
DeclaredIdentifier other = this._other as DeclaredIdentifier;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.type, other.type) && _isEqualNodes(node.identifier, other.identifier);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.type, other.type) && isEqualNodes(node.identifier, other.identifier);
}
@override
bool visitDefaultFormalParameter(DefaultFormalParameter node) {
DefaultFormalParameter other = this._other as DefaultFormalParameter;
- return _isEqualNodes(node.parameter, other.parameter) && node.kind == other.kind && _isEqualTokens(node.separator, other.separator) && _isEqualNodes(node.defaultValue, other.defaultValue);
+ return isEqualNodes(node.parameter, other.parameter) && node.kind == other.kind && isEqualTokens(node.separator, other.separator) && isEqualNodes(node.defaultValue, other.defaultValue);
}
@override
bool visitDoStatement(DoStatement node) {
DoStatement other = this._other as DoStatement;
- return _isEqualTokens(node.doKeyword, other.doKeyword) && _isEqualNodes(node.body, other.body) && _isEqualTokens(node.whileKeyword, other.whileKeyword) && _isEqualTokens(node.leftParenthesis, other.leftParenthesis) && _isEqualNodes(node.condition, other.condition) && _isEqualTokens(node.rightParenthesis, other.rightParenthesis) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualTokens(node.doKeyword, other.doKeyword) && isEqualNodes(node.body, other.body) && isEqualTokens(node.whileKeyword, other.whileKeyword) && isEqualTokens(node.leftParenthesis, other.leftParenthesis) && isEqualNodes(node.condition, other.condition) && isEqualTokens(node.rightParenthesis, other.rightParenthesis) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitDoubleLiteral(DoubleLiteral node) {
DoubleLiteral other = this._other as DoubleLiteral;
- return _isEqualTokens(node.literal, other.literal) && node.value == other.value;
+ return isEqualTokens(node.literal, other.literal) && node.value == other.value;
}
@override
bool visitEmptyFunctionBody(EmptyFunctionBody node) {
EmptyFunctionBody other = this._other as EmptyFunctionBody;
- return _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitEmptyStatement(EmptyStatement node) {
EmptyStatement other = this._other as EmptyStatement;
- return _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitEnumConstantDeclaration(EnumConstantDeclaration node) {
EnumConstantDeclaration other = this._other as EnumConstantDeclaration;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualNodes(node.name, other.name);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualNodes(node.name, other.name);
}
@override
bool visitEnumDeclaration(EnumDeclaration node) {
EnumDeclaration other = this._other as EnumDeclaration;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.name, other.name) && _isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodeLists(node.constants, other.constants) && _isEqualTokens(node.rightBracket, other.rightBracket);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.name, other.name) && isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodeLists(node.constants, other.constants) && isEqualTokens(node.rightBracket, other.rightBracket);
}
@override
bool visitExportDirective(ExportDirective node) {
ExportDirective other = this._other as ExportDirective;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.uri, other.uri) && _isEqualNodeLists(node.combinators, other.combinators) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.uri, other.uri) && _isEqualNodeLists(node.combinators, other.combinators) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitExpressionFunctionBody(ExpressionFunctionBody node) {
ExpressionFunctionBody other = this._other as ExpressionFunctionBody;
- return _isEqualTokens(node.functionDefinition, other.functionDefinition) && _isEqualNodes(node.expression, other.expression) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualTokens(node.functionDefinition, other.functionDefinition) && isEqualNodes(node.expression, other.expression) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitExpressionStatement(ExpressionStatement node) {
ExpressionStatement other = this._other as ExpressionStatement;
- return _isEqualNodes(node.expression, other.expression) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualNodes(node.expression, other.expression) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitExtendsClause(ExtendsClause node) {
ExtendsClause other = this._other as ExtendsClause;
- return _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.superclass, other.superclass);
+ return isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.superclass, other.superclass);
}
@override
bool visitFieldDeclaration(FieldDeclaration node) {
FieldDeclaration other = this._other as FieldDeclaration;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.staticKeyword, other.staticKeyword) && _isEqualNodes(node.fields, other.fields) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.staticKeyword, other.staticKeyword) && isEqualNodes(node.fields, other.fields) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitFieldFormalParameter(FieldFormalParameter node) {
FieldFormalParameter other = this._other as FieldFormalParameter;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.type, other.type) && _isEqualTokens(node.thisToken, other.thisToken) && _isEqualTokens(node.period, other.period) && _isEqualNodes(node.identifier, other.identifier);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.type, other.type) && isEqualTokens(node.thisToken, other.thisToken) && isEqualTokens(node.period, other.period) && isEqualNodes(node.identifier, other.identifier);
}
@override
bool visitForEachStatement(ForEachStatement node) {
ForEachStatement other = this._other as ForEachStatement;
- return _isEqualTokens(node.forKeyword, other.forKeyword) && _isEqualTokens(node.leftParenthesis, other.leftParenthesis) && _isEqualNodes(node.loopVariable, other.loopVariable) && _isEqualTokens(node.inKeyword, other.inKeyword) && _isEqualNodes(node.iterator, other.iterator) && _isEqualTokens(node.rightParenthesis, other.rightParenthesis) && _isEqualNodes(node.body, other.body);
+ return isEqualTokens(node.forKeyword, other.forKeyword) && isEqualTokens(node.leftParenthesis, other.leftParenthesis) && isEqualNodes(node.loopVariable, other.loopVariable) && isEqualTokens(node.inKeyword, other.inKeyword) && isEqualNodes(node.iterator, other.iterator) && isEqualTokens(node.rightParenthesis, other.rightParenthesis) && isEqualNodes(node.body, other.body);
}
@override
bool visitFormalParameterList(FormalParameterList node) {
FormalParameterList other = this._other as FormalParameterList;
- return _isEqualTokens(node.leftParenthesis, other.leftParenthesis) && _isEqualNodeLists(node.parameters, other.parameters) && _isEqualTokens(node.leftDelimiter, other.leftDelimiter) && _isEqualTokens(node.rightDelimiter, other.rightDelimiter) && _isEqualTokens(node.rightParenthesis, other.rightParenthesis);
+ return isEqualTokens(node.leftParenthesis, other.leftParenthesis) && _isEqualNodeLists(node.parameters, other.parameters) && isEqualTokens(node.leftDelimiter, other.leftDelimiter) && isEqualTokens(node.rightDelimiter, other.rightDelimiter) && isEqualTokens(node.rightParenthesis, other.rightParenthesis);
}
@override
bool visitForStatement(ForStatement node) {
ForStatement other = this._other as ForStatement;
- return _isEqualTokens(node.forKeyword, other.forKeyword) && _isEqualTokens(node.leftParenthesis, other.leftParenthesis) && _isEqualNodes(node.variables, other.variables) && _isEqualNodes(node.initialization, other.initialization) && _isEqualTokens(node.leftSeparator, other.leftSeparator) && _isEqualNodes(node.condition, other.condition) && _isEqualTokens(node.rightSeparator, other.rightSeparator) && _isEqualNodeLists(node.updaters, other.updaters) && _isEqualTokens(node.rightParenthesis, other.rightParenthesis) && _isEqualNodes(node.body, other.body);
+ return isEqualTokens(node.forKeyword, other.forKeyword) && isEqualTokens(node.leftParenthesis, other.leftParenthesis) && isEqualNodes(node.variables, other.variables) && isEqualNodes(node.initialization, other.initialization) && isEqualTokens(node.leftSeparator, other.leftSeparator) && isEqualNodes(node.condition, other.condition) && isEqualTokens(node.rightSeparator, other.rightSeparator) && _isEqualNodeLists(node.updaters, other.updaters) && isEqualTokens(node.rightParenthesis, other.rightParenthesis) && isEqualNodes(node.body, other.body);
}
@override
bool visitFunctionDeclaration(FunctionDeclaration node) {
FunctionDeclaration other = this._other as FunctionDeclaration;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.externalKeyword, other.externalKeyword) && _isEqualNodes(node.returnType, other.returnType) && _isEqualTokens(node.propertyKeyword, other.propertyKeyword) && _isEqualNodes(node.name, other.name) && _isEqualNodes(node.functionExpression, other.functionExpression);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.externalKeyword, other.externalKeyword) && isEqualNodes(node.returnType, other.returnType) && isEqualTokens(node.propertyKeyword, other.propertyKeyword) && isEqualNodes(node.name, other.name) && isEqualNodes(node.functionExpression, other.functionExpression);
}
@override
bool visitFunctionDeclarationStatement(FunctionDeclarationStatement node) {
FunctionDeclarationStatement other = this._other as FunctionDeclarationStatement;
- return _isEqualNodes(node.functionDeclaration, other.functionDeclaration);
+ return isEqualNodes(node.functionDeclaration, other.functionDeclaration);
}
@override
bool visitFunctionExpression(FunctionExpression node) {
FunctionExpression other = this._other as FunctionExpression;
- return _isEqualNodes(node.parameters, other.parameters) && _isEqualNodes(node.body, other.body);
+ return isEqualNodes(node.parameters, other.parameters) && isEqualNodes(node.body, other.body);
}
@override
bool visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
FunctionExpressionInvocation other = this._other as FunctionExpressionInvocation;
- return _isEqualNodes(node.function, other.function) && _isEqualNodes(node.argumentList, other.argumentList);
+ return isEqualNodes(node.function, other.function) && isEqualNodes(node.argumentList, other.argumentList);
}
@override
bool visitFunctionTypeAlias(FunctionTypeAlias node) {
FunctionTypeAlias other = this._other as FunctionTypeAlias;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.returnType, other.returnType) && _isEqualNodes(node.name, other.name) && _isEqualNodes(node.typeParameters, other.typeParameters) && _isEqualNodes(node.parameters, other.parameters) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.returnType, other.returnType) && isEqualNodes(node.name, other.name) && isEqualNodes(node.typeParameters, other.typeParameters) && isEqualNodes(node.parameters, other.parameters) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
FunctionTypedFormalParameter other = this._other as FunctionTypedFormalParameter;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualNodes(node.returnType, other.returnType) && _isEqualNodes(node.identifier, other.identifier) && _isEqualNodes(node.parameters, other.parameters);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualNodes(node.returnType, other.returnType) && isEqualNodes(node.identifier, other.identifier) && isEqualNodes(node.parameters, other.parameters);
}
@override
bool visitHideCombinator(HideCombinator node) {
HideCombinator other = this._other as HideCombinator;
- return _isEqualTokens(node.keyword, other.keyword) && _isEqualNodeLists(node.hiddenNames, other.hiddenNames);
+ return isEqualTokens(node.keyword, other.keyword) && _isEqualNodeLists(node.hiddenNames, other.hiddenNames);
}
@override
bool visitIfStatement(IfStatement node) {
IfStatement other = this._other as IfStatement;
- return _isEqualTokens(node.ifKeyword, other.ifKeyword) && _isEqualTokens(node.leftParenthesis, other.leftParenthesis) && _isEqualNodes(node.condition, other.condition) && _isEqualTokens(node.rightParenthesis, other.rightParenthesis) && _isEqualNodes(node.thenStatement, other.thenStatement) && _isEqualTokens(node.elseKeyword, other.elseKeyword) && _isEqualNodes(node.elseStatement, other.elseStatement);
+ return isEqualTokens(node.ifKeyword, other.ifKeyword) && isEqualTokens(node.leftParenthesis, other.leftParenthesis) && isEqualNodes(node.condition, other.condition) && isEqualTokens(node.rightParenthesis, other.rightParenthesis) && isEqualNodes(node.thenStatement, other.thenStatement) && isEqualTokens(node.elseKeyword, other.elseKeyword) && isEqualNodes(node.elseStatement, other.elseStatement);
}
@override
bool visitImplementsClause(ImplementsClause node) {
ImplementsClause other = this._other as ImplementsClause;
- return _isEqualTokens(node.keyword, other.keyword) && _isEqualNodeLists(node.interfaces, other.interfaces);
+ return isEqualTokens(node.keyword, other.keyword) && _isEqualNodeLists(node.interfaces, other.interfaces);
}
@override
bool visitImportDirective(ImportDirective node) {
ImportDirective other = this._other as ImportDirective;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.uri, other.uri) && _isEqualTokens(node.asToken, other.asToken) && _isEqualNodes(node.prefix, other.prefix) && _isEqualNodeLists(node.combinators, other.combinators) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.uri, other.uri) && isEqualTokens(node.asToken, other.asToken) && isEqualNodes(node.prefix, other.prefix) && _isEqualNodeLists(node.combinators, other.combinators) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitIndexExpression(IndexExpression node) {
IndexExpression other = this._other as IndexExpression;
- return _isEqualNodes(node.target, other.target) && _isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodes(node.index, other.index) && _isEqualTokens(node.rightBracket, other.rightBracket);
+ return isEqualNodes(node.target, other.target) && isEqualTokens(node.leftBracket, other.leftBracket) && isEqualNodes(node.index, other.index) && isEqualTokens(node.rightBracket, other.rightBracket);
}
@override
bool visitInstanceCreationExpression(InstanceCreationExpression node) {
InstanceCreationExpression other = this._other as InstanceCreationExpression;
- return _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.constructorName, other.constructorName) && _isEqualNodes(node.argumentList, other.argumentList);
+ return isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.constructorName, other.constructorName) && isEqualNodes(node.argumentList, other.argumentList);
}
@override
bool visitIntegerLiteral(IntegerLiteral node) {
IntegerLiteral other = this._other as IntegerLiteral;
- return _isEqualTokens(node.literal, other.literal) && (node.value == other.value);
+ return isEqualTokens(node.literal, other.literal) && (node.value == other.value);
}
@override
bool visitInterpolationExpression(InterpolationExpression node) {
InterpolationExpression other = this._other as InterpolationExpression;
- return _isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodes(node.expression, other.expression) && _isEqualTokens(node.rightBracket, other.rightBracket);
+ return isEqualTokens(node.leftBracket, other.leftBracket) && isEqualNodes(node.expression, other.expression) && isEqualTokens(node.rightBracket, other.rightBracket);
}
@override
bool visitInterpolationString(InterpolationString node) {
InterpolationString other = this._other as InterpolationString;
- return _isEqualTokens(node.contents, other.contents) && node.value == other.value;
+ return isEqualTokens(node.contents, other.contents) && node.value == other.value;
}
@override
bool visitIsExpression(IsExpression node) {
IsExpression other = this._other as IsExpression;
- return _isEqualNodes(node.expression, other.expression) && _isEqualTokens(node.isOperator, other.isOperator) && _isEqualTokens(node.notOperator, other.notOperator) && _isEqualNodes(node.type, other.type);
+ return isEqualNodes(node.expression, other.expression) && isEqualTokens(node.isOperator, other.isOperator) && isEqualTokens(node.notOperator, other.notOperator) && isEqualNodes(node.type, other.type);
}
@override
bool visitLabel(Label node) {
Label other = this._other as Label;
- return _isEqualNodes(node.label, other.label) && _isEqualTokens(node.colon, other.colon);
+ return isEqualNodes(node.label, other.label) && isEqualTokens(node.colon, other.colon);
}
@override
bool visitLabeledStatement(LabeledStatement node) {
LabeledStatement other = this._other as LabeledStatement;
- return _isEqualNodeLists(node.labels, other.labels) && _isEqualNodes(node.statement, other.statement);
+ return _isEqualNodeLists(node.labels, other.labels) && isEqualNodes(node.statement, other.statement);
}
@override
bool visitLibraryDirective(LibraryDirective node) {
LibraryDirective other = this._other as LibraryDirective;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.libraryToken, other.libraryToken) && _isEqualNodes(node.name, other.name) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.libraryToken, other.libraryToken) && isEqualNodes(node.name, other.name) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
@@ -1770,145 +2295,145 @@
@override
bool visitListLiteral(ListLiteral node) {
ListLiteral other = this._other as ListLiteral;
- return _isEqualTokens(node.constKeyword, other.constKeyword) && _isEqualNodes(node.typeArguments, other.typeArguments) && _isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodeLists(node.elements, other.elements) && _isEqualTokens(node.rightBracket, other.rightBracket);
+ return isEqualTokens(node.constKeyword, other.constKeyword) && isEqualNodes(node.typeArguments, other.typeArguments) && isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodeLists(node.elements, other.elements) && isEqualTokens(node.rightBracket, other.rightBracket);
}
@override
bool visitMapLiteral(MapLiteral node) {
MapLiteral other = this._other as MapLiteral;
- return _isEqualTokens(node.constKeyword, other.constKeyword) && _isEqualNodes(node.typeArguments, other.typeArguments) && _isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodeLists(node.entries, other.entries) && _isEqualTokens(node.rightBracket, other.rightBracket);
+ return isEqualTokens(node.constKeyword, other.constKeyword) && isEqualNodes(node.typeArguments, other.typeArguments) && isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodeLists(node.entries, other.entries) && isEqualTokens(node.rightBracket, other.rightBracket);
}
@override
bool visitMapLiteralEntry(MapLiteralEntry node) {
MapLiteralEntry other = this._other as MapLiteralEntry;
- return _isEqualNodes(node.key, other.key) && _isEqualTokens(node.separator, other.separator) && _isEqualNodes(node.value, other.value);
+ return isEqualNodes(node.key, other.key) && isEqualTokens(node.separator, other.separator) && isEqualNodes(node.value, other.value);
}
@override
bool visitMethodDeclaration(MethodDeclaration node) {
MethodDeclaration other = this._other as MethodDeclaration;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.externalKeyword, other.externalKeyword) && _isEqualTokens(node.modifierKeyword, other.modifierKeyword) && _isEqualNodes(node.returnType, other.returnType) && _isEqualTokens(node.propertyKeyword, other.propertyKeyword) && _isEqualTokens(node.propertyKeyword, other.propertyKeyword) && _isEqualNodes(node.name, other.name) && _isEqualNodes(node.parameters, other.parameters) && _isEqualNodes(node.body, other.body);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.externalKeyword, other.externalKeyword) && isEqualTokens(node.modifierKeyword, other.modifierKeyword) && isEqualNodes(node.returnType, other.returnType) && isEqualTokens(node.propertyKeyword, other.propertyKeyword) && isEqualTokens(node.propertyKeyword, other.propertyKeyword) && isEqualNodes(node.name, other.name) && isEqualNodes(node.parameters, other.parameters) && isEqualNodes(node.body, other.body);
}
@override
bool visitMethodInvocation(MethodInvocation node) {
MethodInvocation other = this._other as MethodInvocation;
- return _isEqualNodes(node.target, other.target) && _isEqualTokens(node.period, other.period) && _isEqualNodes(node.methodName, other.methodName) && _isEqualNodes(node.argumentList, other.argumentList);
+ return isEqualNodes(node.target, other.target) && isEqualTokens(node.period, other.period) && isEqualNodes(node.methodName, other.methodName) && isEqualNodes(node.argumentList, other.argumentList);
}
@override
bool visitNamedExpression(NamedExpression node) {
NamedExpression other = this._other as NamedExpression;
- return _isEqualNodes(node.name, other.name) && _isEqualNodes(node.expression, other.expression);
+ return isEqualNodes(node.name, other.name) && isEqualNodes(node.expression, other.expression);
}
@override
bool visitNativeClause(NativeClause node) {
NativeClause other = this._other as NativeClause;
- return _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.name, other.name);
+ return isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.name, other.name);
}
@override
bool visitNativeFunctionBody(NativeFunctionBody node) {
NativeFunctionBody other = this._other as NativeFunctionBody;
- return _isEqualTokens(node.nativeToken, other.nativeToken) && _isEqualNodes(node.stringLiteral, other.stringLiteral) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualTokens(node.nativeToken, other.nativeToken) && isEqualNodes(node.stringLiteral, other.stringLiteral) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitNullLiteral(NullLiteral node) {
NullLiteral other = this._other as NullLiteral;
- return _isEqualTokens(node.literal, other.literal);
+ return isEqualTokens(node.literal, other.literal);
}
@override
bool visitParenthesizedExpression(ParenthesizedExpression node) {
ParenthesizedExpression other = this._other as ParenthesizedExpression;
- return _isEqualTokens(node.leftParenthesis, other.leftParenthesis) && _isEqualNodes(node.expression, other.expression) && _isEqualTokens(node.rightParenthesis, other.rightParenthesis);
+ return isEqualTokens(node.leftParenthesis, other.leftParenthesis) && isEqualNodes(node.expression, other.expression) && isEqualTokens(node.rightParenthesis, other.rightParenthesis);
}
@override
bool visitPartDirective(PartDirective node) {
PartDirective other = this._other as PartDirective;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.partToken, other.partToken) && _isEqualNodes(node.uri, other.uri) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.partToken, other.partToken) && isEqualNodes(node.uri, other.uri) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitPartOfDirective(PartOfDirective node) {
PartOfDirective other = this._other as PartOfDirective;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.partToken, other.partToken) && _isEqualTokens(node.ofToken, other.ofToken) && _isEqualNodes(node.libraryName, other.libraryName) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.partToken, other.partToken) && isEqualTokens(node.ofToken, other.ofToken) && isEqualNodes(node.libraryName, other.libraryName) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitPostfixExpression(PostfixExpression node) {
PostfixExpression other = this._other as PostfixExpression;
- return _isEqualNodes(node.operand, other.operand) && _isEqualTokens(node.operator, other.operator);
+ return isEqualNodes(node.operand, other.operand) && isEqualTokens(node.operator, other.operator);
}
@override
bool visitPrefixedIdentifier(PrefixedIdentifier node) {
PrefixedIdentifier other = this._other as PrefixedIdentifier;
- return _isEqualNodes(node.prefix, other.prefix) && _isEqualTokens(node.period, other.period) && _isEqualNodes(node.identifier, other.identifier);
+ return isEqualNodes(node.prefix, other.prefix) && isEqualTokens(node.period, other.period) && isEqualNodes(node.identifier, other.identifier);
}
@override
bool visitPrefixExpression(PrefixExpression node) {
PrefixExpression other = this._other as PrefixExpression;
- return _isEqualTokens(node.operator, other.operator) && _isEqualNodes(node.operand, other.operand);
+ return isEqualTokens(node.operator, other.operator) && isEqualNodes(node.operand, other.operand);
}
@override
bool visitPropertyAccess(PropertyAccess node) {
PropertyAccess other = this._other as PropertyAccess;
- return _isEqualNodes(node.target, other.target) && _isEqualTokens(node.operator, other.operator) && _isEqualNodes(node.propertyName, other.propertyName);
+ return isEqualNodes(node.target, other.target) && isEqualTokens(node.operator, other.operator) && isEqualNodes(node.propertyName, other.propertyName);
}
@override
bool visitRedirectingConstructorInvocation(RedirectingConstructorInvocation node) {
RedirectingConstructorInvocation other = this._other as RedirectingConstructorInvocation;
- return _isEqualTokens(node.keyword, other.keyword) && _isEqualTokens(node.period, other.period) && _isEqualNodes(node.constructorName, other.constructorName) && _isEqualNodes(node.argumentList, other.argumentList);
+ return isEqualTokens(node.keyword, other.keyword) && isEqualTokens(node.period, other.period) && isEqualNodes(node.constructorName, other.constructorName) && isEqualNodes(node.argumentList, other.argumentList);
}
@override
bool visitRethrowExpression(RethrowExpression node) {
RethrowExpression other = this._other as RethrowExpression;
- return _isEqualTokens(node.keyword, other.keyword);
+ return isEqualTokens(node.keyword, other.keyword);
}
@override
bool visitReturnStatement(ReturnStatement node) {
ReturnStatement other = this._other as ReturnStatement;
- return _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.expression, other.expression) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.expression, other.expression) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitScriptTag(ScriptTag node) {
ScriptTag other = this._other as ScriptTag;
- return _isEqualTokens(node.scriptTag, other.scriptTag);
+ return isEqualTokens(node.scriptTag, other.scriptTag);
}
@override
bool visitShowCombinator(ShowCombinator node) {
ShowCombinator other = this._other as ShowCombinator;
- return _isEqualTokens(node.keyword, other.keyword) && _isEqualNodeLists(node.shownNames, other.shownNames);
+ return isEqualTokens(node.keyword, other.keyword) && _isEqualNodeLists(node.shownNames, other.shownNames);
}
@override
bool visitSimpleFormalParameter(SimpleFormalParameter node) {
SimpleFormalParameter other = this._other as SimpleFormalParameter;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.type, other.type) && _isEqualNodes(node.identifier, other.identifier);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.type, other.type) && isEqualNodes(node.identifier, other.identifier);
}
@override
bool visitSimpleIdentifier(SimpleIdentifier node) {
SimpleIdentifier other = this._other as SimpleIdentifier;
- return _isEqualTokens(node.token, other.token);
+ return isEqualTokens(node.token, other.token);
}
@override
bool visitSimpleStringLiteral(SimpleStringLiteral node) {
SimpleStringLiteral other = this._other as SimpleStringLiteral;
- return _isEqualTokens(node.literal, other.literal) && (node.value == other.value);
+ return isEqualTokens(node.literal, other.literal) && (node.value == other.value);
}
@override
@@ -1920,121 +2445,121 @@
@override
bool visitSuperConstructorInvocation(SuperConstructorInvocation node) {
SuperConstructorInvocation other = this._other as SuperConstructorInvocation;
- return _isEqualTokens(node.keyword, other.keyword) && _isEqualTokens(node.period, other.period) && _isEqualNodes(node.constructorName, other.constructorName) && _isEqualNodes(node.argumentList, other.argumentList);
+ return isEqualTokens(node.keyword, other.keyword) && isEqualTokens(node.period, other.period) && isEqualNodes(node.constructorName, other.constructorName) && isEqualNodes(node.argumentList, other.argumentList);
}
@override
bool visitSuperExpression(SuperExpression node) {
SuperExpression other = this._other as SuperExpression;
- return _isEqualTokens(node.keyword, other.keyword);
+ return isEqualTokens(node.keyword, other.keyword);
}
@override
bool visitSwitchCase(SwitchCase node) {
SwitchCase other = this._other as SwitchCase;
- return _isEqualNodeLists(node.labels, other.labels) && _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.expression, other.expression) && _isEqualTokens(node.colon, other.colon) && _isEqualNodeLists(node.statements, other.statements);
+ return _isEqualNodeLists(node.labels, other.labels) && isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.expression, other.expression) && isEqualTokens(node.colon, other.colon) && _isEqualNodeLists(node.statements, other.statements);
}
@override
bool visitSwitchDefault(SwitchDefault node) {
SwitchDefault other = this._other as SwitchDefault;
- return _isEqualNodeLists(node.labels, other.labels) && _isEqualTokens(node.keyword, other.keyword) && _isEqualTokens(node.colon, other.colon) && _isEqualNodeLists(node.statements, other.statements);
+ return _isEqualNodeLists(node.labels, other.labels) && isEqualTokens(node.keyword, other.keyword) && isEqualTokens(node.colon, other.colon) && _isEqualNodeLists(node.statements, other.statements);
}
@override
bool visitSwitchStatement(SwitchStatement node) {
SwitchStatement other = this._other as SwitchStatement;
- return _isEqualTokens(node.keyword, other.keyword) && _isEqualTokens(node.leftParenthesis, other.leftParenthesis) && _isEqualNodes(node.expression, other.expression) && _isEqualTokens(node.rightParenthesis, other.rightParenthesis) && _isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodeLists(node.members, other.members) && _isEqualTokens(node.rightBracket, other.rightBracket);
+ return isEqualTokens(node.keyword, other.keyword) && isEqualTokens(node.leftParenthesis, other.leftParenthesis) && isEqualNodes(node.expression, other.expression) && isEqualTokens(node.rightParenthesis, other.rightParenthesis) && isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodeLists(node.members, other.members) && isEqualTokens(node.rightBracket, other.rightBracket);
}
@override
bool visitSymbolLiteral(SymbolLiteral node) {
SymbolLiteral other = this._other as SymbolLiteral;
- return _isEqualTokens(node.poundSign, other.poundSign) && _isEqualTokenLists(node.components, other.components);
+ return isEqualTokens(node.poundSign, other.poundSign) && _isEqualTokenLists(node.components, other.components);
}
@override
bool visitThisExpression(ThisExpression node) {
ThisExpression other = this._other as ThisExpression;
- return _isEqualTokens(node.keyword, other.keyword);
+ return isEqualTokens(node.keyword, other.keyword);
}
@override
bool visitThrowExpression(ThrowExpression node) {
ThrowExpression other = this._other as ThrowExpression;
- return _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.expression, other.expression);
+ return isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.expression, other.expression);
}
@override
bool visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
TopLevelVariableDeclaration other = this._other as TopLevelVariableDeclaration;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualNodes(node.variables, other.variables) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualNodes(node.variables, other.variables) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitTryStatement(TryStatement node) {
TryStatement other = this._other as TryStatement;
- return _isEqualTokens(node.tryKeyword, other.tryKeyword) && _isEqualNodes(node.body, other.body) && _isEqualNodeLists(node.catchClauses, other.catchClauses) && _isEqualTokens(node.finallyKeyword, other.finallyKeyword) && _isEqualNodes(node.finallyBlock, other.finallyBlock);
+ return isEqualTokens(node.tryKeyword, other.tryKeyword) && isEqualNodes(node.body, other.body) && _isEqualNodeLists(node.catchClauses, other.catchClauses) && isEqualTokens(node.finallyKeyword, other.finallyKeyword) && isEqualNodes(node.finallyBlock, other.finallyBlock);
}
@override
bool visitTypeArgumentList(TypeArgumentList node) {
TypeArgumentList other = this._other as TypeArgumentList;
- return _isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodeLists(node.arguments, other.arguments) && _isEqualTokens(node.rightBracket, other.rightBracket);
+ return isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodeLists(node.arguments, other.arguments) && isEqualTokens(node.rightBracket, other.rightBracket);
}
@override
bool visitTypeName(TypeName node) {
TypeName other = this._other as TypeName;
- return _isEqualNodes(node.name, other.name) && _isEqualNodes(node.typeArguments, other.typeArguments);
+ return isEqualNodes(node.name, other.name) && isEqualNodes(node.typeArguments, other.typeArguments);
}
@override
bool visitTypeParameter(TypeParameter node) {
TypeParameter other = this._other as TypeParameter;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualNodes(node.name, other.name) && _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.bound, other.bound);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualNodes(node.name, other.name) && isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.bound, other.bound);
}
@override
bool visitTypeParameterList(TypeParameterList node) {
TypeParameterList other = this._other as TypeParameterList;
- return _isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodeLists(node.typeParameters, other.typeParameters) && _isEqualTokens(node.rightBracket, other.rightBracket);
+ return isEqualTokens(node.leftBracket, other.leftBracket) && _isEqualNodeLists(node.typeParameters, other.typeParameters) && isEqualTokens(node.rightBracket, other.rightBracket);
}
@override
bool visitVariableDeclaration(VariableDeclaration node) {
VariableDeclaration other = this._other as VariableDeclaration;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualNodes(node.name, other.name) && _isEqualTokens(node.equals, other.equals) && _isEqualNodes(node.initializer, other.initializer);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualNodes(node.name, other.name) && isEqualTokens(node.equals, other.equals) && isEqualNodes(node.initializer, other.initializer);
}
@override
bool visitVariableDeclarationList(VariableDeclarationList node) {
VariableDeclarationList other = this._other as VariableDeclarationList;
- return _isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && _isEqualTokens(node.keyword, other.keyword) && _isEqualNodes(node.type, other.type) && _isEqualNodeLists(node.variables, other.variables);
+ return isEqualNodes(node.documentationComment, other.documentationComment) && _isEqualNodeLists(node.metadata, other.metadata) && isEqualTokens(node.keyword, other.keyword) && isEqualNodes(node.type, other.type) && _isEqualNodeLists(node.variables, other.variables);
}
@override
bool visitVariableDeclarationStatement(VariableDeclarationStatement node) {
VariableDeclarationStatement other = this._other as VariableDeclarationStatement;
- return _isEqualNodes(node.variables, other.variables) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualNodes(node.variables, other.variables) && isEqualTokens(node.semicolon, other.semicolon);
}
@override
bool visitWhileStatement(WhileStatement node) {
WhileStatement other = this._other as WhileStatement;
- return _isEqualTokens(node.keyword, other.keyword) && _isEqualTokens(node.leftParenthesis, other.leftParenthesis) && _isEqualNodes(node.condition, other.condition) && _isEqualTokens(node.rightParenthesis, other.rightParenthesis) && _isEqualNodes(node.body, other.body);
+ return isEqualTokens(node.keyword, other.keyword) && isEqualTokens(node.leftParenthesis, other.leftParenthesis) && isEqualNodes(node.condition, other.condition) && isEqualTokens(node.rightParenthesis, other.rightParenthesis) && isEqualNodes(node.body, other.body);
}
@override
bool visitWithClause(WithClause node) {
WithClause other = this._other as WithClause;
- return _isEqualTokens(node.withKeyword, other.withKeyword) && _isEqualNodeLists(node.mixinTypes, other.mixinTypes);
+ return isEqualTokens(node.withKeyword, other.withKeyword) && _isEqualNodeLists(node.mixinTypes, other.mixinTypes);
}
@override
bool visitYieldStatement(YieldStatement node) {
YieldStatement other = this._other as YieldStatement;
- return _isEqualTokens(node.yieldKeyword, other.yieldKeyword) && _isEqualNodes(node.expression, other.expression) && _isEqualTokens(node.semicolon, other.semicolon);
+ return isEqualTokens(node.yieldKeyword, other.yieldKeyword) && isEqualNodes(node.expression, other.expression) && isEqualTokens(node.semicolon, other.semicolon);
}
/**
@@ -2057,7 +2582,7 @@
return false;
}
for (int i = 0; i < size; i++) {
- if (!_isEqualNodes(first[i], second[i])) {
+ if (!isEqualNodes(first[i], second[i])) {
return false;
}
}
@@ -2065,13 +2590,13 @@
}
/**
- * Return `true` if the given AST nodes have the same structure.
+ * Return `true` if the [first] node and the [second] node have the same
+ * structure.
*
- * @param first the first node being compared
- * @param second the second node being compared
- * @return `true` if the given AST nodes have the same structure
+ * *Note:* This method is only visible for testing purposes and should not be
+ * used by clients.
*/
- bool _isEqualNodes(AstNode first, AstNode second) {
+ bool isEqualNodes(AstNode first, AstNode second) {
if (first == null) {
return second == null;
} else if (second == null) {
@@ -2098,7 +2623,7 @@
return false;
}
for (int i = 0; i < length; i++) {
- if (!_isEqualTokens(first[i], second[i])) {
+ if (!isEqualTokens(first[i], second[i])) {
return false;
}
}
@@ -2106,13 +2631,13 @@
}
/**
- * Return `true` if the given tokens have the same structure.
+ * Return `true` if the [first] token and the [second] token have the same
+ * structure.
*
- * @param first the first node being compared
- * @param second the second node being compared
- * @return `true` if the given tokens have the same structure
+ * *Note:* This method is only visible for testing purposes and should not be
+ * used by clients.
*/
- bool _isEqualTokens(Token first, Token second) {
+ bool isEqualTokens(Token first, Token second) {
if (first == null) {
return second == null;
} else if (second == null) {
@@ -2120,7 +2645,9 @@
} else if (identical(first, second)) {
return true;
}
- return first.offset == second.offset && first.length == second.length && first.lexeme == second.lexeme;
+ return first.offset == second.offset
+ && first.length == second.length
+ && first.lexeme == second.lexeme;
}
}
@@ -4325,12 +4852,10 @@
* appeared in the original source
*/
List<AstNode> get sortedDirectivesAndDeclarations {
- List<AstNode> childList = new List<AstNode>();
- childList.addAll(_directives);
- childList.addAll(_declarations);
- List<AstNode> children = new List.from(childList);
- children.sort(AstNode.LEXICAL_ORDER);
- return children;
+ return <AstNode>[]
+ ..addAll(_directives)
+ ..addAll(_declarations)
+ ..sort(AstNode.LEXICAL_ORDER);
}
}
@@ -4526,15 +5051,15 @@
@override
Object visitAdjacentStrings(AdjacentStrings node) {
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
for (StringLiteral string in node.strings) {
Object value = string.accept(this);
if (identical(value, NOT_A_CONSTANT)) {
return value;
}
- builder.append(value);
+ buffer.write(value);
}
- return builder.toString();
+ return buffer.toString();
}
@override
@@ -4797,28 +5322,28 @@
@override
Object visitStringInterpolation(StringInterpolation node) {
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
for (InterpolationElement element in node.elements) {
Object value = element.accept(this);
if (identical(value, NOT_A_CONSTANT)) {
return value;
}
- builder.append(value);
+ buffer.write(value);
}
- return builder.toString();
+ return buffer.toString();
}
@override
Object visitSymbolLiteral(SymbolLiteral node) {
// TODO(brianwilkerson) This isn't optimal because a Symbol is not a String.
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
for (Token component in node.components) {
- if (builder.length > 0) {
- builder.appendChar(0x2E);
+ if (buffer.length > 0) {
+ buffer.writeCharCode(0x2E);
}
- builder.append(component.lexeme);
+ buffer.write(component.lexeme);
}
- return builder.toString();
+ return buffer.toString();
}
/**
@@ -6217,6 +6742,12 @@
@override
Token get firstTokenAfterCommentAndMetadata => _name.beginToken;
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ super.visitChildren(visitor);
+ safelyVisitChild(_name, visitor);
+ }
}
/**
@@ -6304,6 +6835,13 @@
@override
Token get firstTokenAfterCommentAndMetadata => keyword;
+
+ @override
+ void visitChildren(AstVisitor visitor) {
+ super.visitChildren(visitor);
+ safelyVisitChild(_name, visitor);
+ _constants.accept(visitor);
+ }
}
/**
@@ -10825,17 +11363,17 @@
@override
String get name {
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
bool needsPeriod = false;
for (SimpleIdentifier identifier in _components) {
if (needsPeriod) {
- builder.append(".");
+ buffer.write(".");
} else {
needsPeriod = true;
}
- builder.append(identifier.name);
+ buffer.write(identifier.name);
}
- return builder.toString();
+ return buffer.toString();
}
@override
@@ -11906,7 +12444,7 @@
} on NodeLocator_NodeFoundException catch (exception) {
// A node with the right source position was found.
} catch (exception) {
- AnalysisEngine.instance.logger.logInformation2("Unable to locate element at offset (${_startOffset} - ${_endOffset})", exception);
+ AnalysisEngine.instance.logger.logInformation2("Unable to locate element at offset ($_startOffset - $_endOffset)", exception);
return null;
}
return _foundNode;
@@ -13089,7 +13627,7 @@
int count = list.length;
for (int i = 0; i < count; i++) {
if (identical(_oldNode, list[i])) {
- javaListSet(list, i, _newNode);
+ list[i] = _newNode;
return true;
}
}
@@ -13231,12 +13769,10 @@
* appeared in the original source
*/
List<AstNode> get sortedCommentAndAnnotations {
- List<AstNode> childList = new List<AstNode>();
- childList.add(_comment);
- childList.addAll(_metadata);
- List<AstNode> children = new List.from(childList);
- children.sort(AstNode.LEXICAL_ORDER);
- return children;
+ return <AstNode>[]
+ ..add(_comment)
+ ..addAll(_metadata)
+ ..sort(AstNode.LEXICAL_ORDER);
}
}
@@ -15739,7 +16275,8 @@
AstNode parent = this.parent;
if (parent is CatchClause) {
CatchClause clause = parent;
- return identical(this, clause.exceptionParameter) || identical(this, clause.stackTraceParameter);
+ return identical(this, clause.exceptionParameter) ||
+ identical(this, clause.stackTraceParameter);
} else if (parent is ClassDeclaration) {
return identical(this, parent.name);
} else if (parent is ClassTypeAlias) {
@@ -15748,6 +16285,10 @@
return identical(this, parent.name);
} else if (parent is DeclaredIdentifier) {
return identical(this, parent.identifier);
+ } else if (parent is EnumDeclaration) {
+ return identical(this, parent.name);
+ } else if (parent is EnumConstantDeclaration) {
+ return identical(this, parent.name);
} else if (parent is FunctionDeclaration) {
return identical(this, parent.name);
} else if (parent is FunctionTypeAlias) {
@@ -15911,7 +16452,7 @@
*/
Element _returnOrReportElement(AstNode parent, bool isValid, Element element) {
if (!isValid) {
- 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.logInformation2("Internal error: attempting to set the name of a ${parent.runtimeType} to a ${element.runtimeType}", new JavaException());
return null;
}
return element;
@@ -16104,8 +16645,8 @@
}
@override
- void appendStringValue(JavaStringBuilder builder) {
- builder.append(value);
+ void appendStringValue(StringBuffer buffer) {
+ buffer.write(value);
}
}
@@ -16181,7 +16722,7 @@
}
@override
- void appendStringValue(JavaStringBuilder builder) {
+ void appendStringValue(StringBuffer buffer) {
throw new IllegalArgumentException();
}
@@ -16232,29 +16773,25 @@
*/
abstract class StringLiteral extends Literal {
/**
- * Return the value of the string literal, or `null` if the string is not a constant string
- * without any string interpolation.
- *
- * @return the value of the string literal
+ * Return the value of the string literal, or `null` if the string is not a
+ * constant string without any string interpolation.
*/
String get stringValue {
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
try {
- appendStringValue(builder);
+ appendStringValue(buffer);
} on IllegalArgumentException catch (exception) {
return null;
}
- return builder.toString();
+ return buffer.toString();
}
/**
- * Append the value of the given string literal to the given string builder.
- *
- * @param builder the builder to which the string's value is to be appended
- * @throws IllegalArgumentException if the string is not a constant string without any string
- * interpolation
+ * Append the value of this string literal to the given [buffer]. Throw an
+ * [IllegalArgumentException] if the string is not a constant string without
+ * any string interpolation.
*/
- void appendStringValue(JavaStringBuilder builder);
+ void appendStringValue(StringBuffer buffer);
}
/**
@@ -19638,7 +20175,7 @@
void insert(int index, E node) {
int length = _elements.length;
if (index < 0 || index > length) {
- throw new RangeError("Index: ${index}, Size: ${_elements.length}");
+ throw new RangeError("Index: $index, Size: ${_elements.length}");
}
owner.becomeParentOf(node);
if (length == 0) {
@@ -19659,7 +20196,7 @@
}
E operator[](int index) {
if (index < 0 || index >= _elements.length) {
- throw new RangeError("Index: ${index}, Size: ${_elements.length}");
+ throw new RangeError("Index: $index, Size: ${_elements.length}");
}
return _elements[index] as E;
}
@@ -19689,7 +20226,7 @@
}
E removeAt(int index) {
if (index < 0 || index >= _elements.length) {
- throw new RangeError("Index: ${index}, Size: ${_elements.length}");
+ throw new RangeError("Index: $index, Size: ${_elements.length}");
}
E removedNode = _elements[index] as E;
int length = _elements.length;
@@ -19702,7 +20239,7 @@
}
void operator[]=(int index, E node) {
if (index < 0 || index >= _elements.length) {
- throw new RangeError("Index: ${index}, Size: ${_elements.length}");
+ throw new RangeError("Index: $index, Size: ${_elements.length}");
}
owner.becomeParentOf(node);
_elements[index] = node;
diff --git a/pkg/analyzer/lib/src/generated/constant.dart b/pkg/analyzer/lib/src/generated/constant.dart
index fa82b57..ee68be8 100644
--- a/pkg/analyzer/lib/src/generated/constant.dart
+++ b/pkg/analyzer/lib/src/generated/constant.dart
@@ -306,7 +306,7 @@
/**
* RegExp that validates a non-empty non-private symbol. From sdk/lib/internal/symbol.dart.
*/
- static RegExp _PUBLIC_SYMBOL_PATTERN = new RegExp("^(?:${ConstantValueComputer._OPERATOR_RE}\$|${_PUBLIC_IDENTIFIER_RE}(?:=?\$|[.](?!\$)))+?\$");
+ static RegExp _PUBLIC_SYMBOL_PATTERN = new RegExp("^(?:${ConstantValueComputer._OPERATOR_RE}\$|$_PUBLIC_IDENTIFIER_RE(?:=?\$|[.](?!\$)))+?\$");
/**
* Determine whether the given string is a valid name for a public symbol (i.e. whether it is
@@ -378,14 +378,12 @@
_variableDeclarationMap = _constantFinder.variableMap;
constructorDeclarationMap = _constantFinder.constructorMap;
_constructorInvocations = _constantFinder.constructorInvocations;
- for (MapEntry<VariableElement, VariableDeclaration> entry in getMapEntrySet(_variableDeclarationMap)) {
- VariableDeclaration declaration = entry.getValue();
+ _variableDeclarationMap.values.forEach((VariableDeclaration declaration) {
ReferenceFinder referenceFinder = new ReferenceFinder(declaration, referenceGraph, _variableDeclarationMap, constructorDeclarationMap);
referenceGraph.addNode(declaration);
declaration.initializer.accept(referenceFinder);
- }
- for (MapEntry<ConstructorElement, ConstructorDeclaration> entry in getMapEntrySet(constructorDeclarationMap)) {
- ConstructorDeclaration declaration = entry.getValue();
+ });
+ constructorDeclarationMap.forEach((ConstructorElement element, ConstructorDeclaration declaration) {
ReferenceFinder referenceFinder = new ReferenceFinder(declaration, referenceGraph, _variableDeclarationMap, constructorDeclarationMap);
referenceGraph.addNode(declaration);
bool superInvocationFound = false;
@@ -399,7 +397,7 @@
if (!superInvocationFound) {
// No explicit superconstructor invocation found, so we need to manually insert
// a reference to the implicit superconstructor.
- InterfaceType superclass = (entry.getKey().returnType as InterfaceType).superclass;
+ InterfaceType superclass = (element.returnType as InterfaceType).superclass;
if (superclass != null && !superclass.isObject) {
ConstructorElement unnamedConstructor = superclass.element.unnamedConstructor;
ConstructorDeclaration superConstructorDeclaration = findConstructorDeclaration(unnamedConstructor);
@@ -419,7 +417,7 @@
}
}
}
- }
+ });
for (InstanceCreationExpression expression in _constructorInvocations) {
referenceGraph.addNode(expression);
ConstructorElement constructor = expression.staticElement;
@@ -900,10 +898,16 @@
}
/**
- * [AstCloner] that copies the necessary information from the AST to allow const constructor
- * initializers to be evaluated.
+ * A `ConstantValueComputer_InitializerCloner` is an [AstCloner] that copies the
+ * necessary information from the AST to allow const constructor initializers to
+ * be evaluated.
*/
class ConstantValueComputer_InitializerCloner extends AstCloner {
+ // TODO(brianwilkerson) Investigate replacing uses of this class with uses of
+ // AstCloner and ResolutionCopier.
+
+ ConstantValueComputer_InitializerCloner() : super(true);
+
@override
InstanceCreationExpression visitInstanceCreationExpression(InstanceCreationExpression node) {
InstanceCreationExpression expression = super.visitInstanceCreationExpression(node);
@@ -1195,7 +1199,7 @@
}
}
InterfaceType listType = _typeProvider.listType.substitute4([elementType]);
- return new DartObjectImpl(listType, new ListState(new List.from(elements)));
+ return new DartObjectImpl(listType, new ListState(elements));
}
@override
@@ -1359,15 +1363,15 @@
@override
DartObjectImpl visitSymbolLiteral(SymbolLiteral node) {
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
List<Token> components = node.components;
for (int i = 0; i < components.length; i++) {
if (i > 0) {
- builder.appendChar(0x2E);
+ buffer.writeCharCode(0x2E);
}
- builder.append(components[i].lexeme);
+ buffer.write(components[i].lexeme);
}
- return new DartObjectImpl(_typeProvider.symbolType, new SymbolState(builder.toString()));
+ return new DartObjectImpl(_typeProvider.symbolType, new SymbolState(buffer.toString()));
}
/**
@@ -1926,7 +1930,7 @@
return new DartObjectImpl(typeProvider.stringType, result);
}
// We should never get here.
- throw new IllegalStateException("add returned a ${result.runtimeType.toString()}");
+ throw new IllegalStateException("add returned a ${result.runtimeType}");
}
/**
@@ -2011,7 +2015,7 @@
return new DartObjectImpl(typeProvider.numType, result);
}
// We should never get here.
- throw new IllegalStateException("divide returned a ${result.runtimeType.toString()}");
+ throw new IllegalStateException("divide returned a ${result.runtimeType}");
}
/**
@@ -2217,7 +2221,7 @@
return new DartObjectImpl(typeProvider.numType, result);
}
// We should never get here.
- throw new IllegalStateException("minus returned a ${result.runtimeType.toString()}");
+ throw new IllegalStateException("minus returned a ${result.runtimeType}");
}
/**
@@ -2237,7 +2241,7 @@
return new DartObjectImpl(typeProvider.numType, result);
}
// We should never get here.
- throw new IllegalStateException("negated returned a ${result.runtimeType.toString()}");
+ throw new IllegalStateException("negated returned a ${result.runtimeType}");
}
/**
@@ -2291,7 +2295,7 @@
return new DartObjectImpl(typeProvider.numType, result);
}
// We should never get here.
- throw new IllegalStateException("remainder returned a ${result.runtimeType.toString()}");
+ throw new IllegalStateException("remainder returned a ${result.runtimeType}");
}
/**
@@ -2341,11 +2345,11 @@
return new DartObjectImpl(typeProvider.numType, result);
}
// We should never get here.
- throw new IllegalStateException("times returned a ${result.runtimeType.toString()}");
+ throw new IllegalStateException("times returned a ${result.runtimeType}");
}
@override
- String toString() => "${type.displayName} (${_state.toString()})";
+ String toString() => "${type.displayName} ($_state)";
}
/**
@@ -2425,7 +2429,8 @@
DartObject getString(TypeProvider typeProvider, String variableName) {
String value = _declaredVariables[variableName];
if (value == null) {
- return new DartObjectImpl(typeProvider.intType, IntState.UNKNOWN_VALUE);
+ return new DartObjectImpl(typeProvider.stringType,
+ StringState.UNKNOWN_VALUE);
}
return new DartObjectImpl(typeProvider.stringType, new StringState(value));
}
@@ -4181,9 +4186,8 @@
} else if (count == 0) {
return true;
}
- for (MapEntry<DartObjectImpl, DartObjectImpl> entry in getMapEntrySet(_entries)) {
- DartObjectImpl key = entry.getKey();
- DartObjectImpl value = entry.getValue();
+ for (DartObjectImpl key in _entries.keys) {
+ DartObjectImpl value = _entries[key];
DartObjectImpl otherValue = otherElements[key];
if (value != otherValue) {
return false;
@@ -4198,9 +4202,8 @@
@override
Map<Object, Object> get value {
HashMap<Object, Object> result = new HashMap<Object, Object>();
- for (MapEntry<DartObjectImpl, DartObjectImpl> entry in getMapEntrySet(_entries)) {
- DartObjectImpl key = entry.getKey();
- DartObjectImpl value = entry.getValue();
+ for (DartObjectImpl key in _entries.keys) {
+ DartObjectImpl value = _entries[key];
if (!key.hasExactValue || !value.hasExactValue) {
return null;
}
@@ -4211,8 +4214,8 @@
@override
bool get hasExactValue {
- for (MapEntry<DartObjectImpl, DartObjectImpl> entry in getMapEntrySet(_entries)) {
- if (!entry.getKey().hasExactValue || !entry.getValue().hasExactValue) {
+ for (DartObjectImpl key in _entries.keys) {
+ if (!key.hasExactValue || !_entries[key].hasExactValue) {
return false;
}
}
@@ -4523,7 +4526,7 @@
if (rightValue == null) {
return UNKNOWN_VALUE;
}
- return new StringState("${value}${rightValue}");
+ return new StringState("$value$rightValue");
} else if (rightOperand is DynamicState) {
return UNKNOWN_VALUE;
}
@@ -4578,7 +4581,7 @@
}
@override
- String toString() => value == null ? "-unknown-" : "'${value}'";
+ String toString() => value == null ? "-unknown-" : "'$value'";
}
/**
@@ -4637,7 +4640,7 @@
int get hashCode => value == null ? 0 : value.hashCode;
@override
- String toString() => value == null ? "-unknown-" : "#${value}";
+ String toString() => value == null ? "-unknown-" : "#$value";
}
/**
diff --git a/pkg/analyzer/lib/src/generated/element.dart b/pkg/analyzer/lib/src/generated/element.dart
index 51fb4d1..91d8575 100644
--- a/pkg/analyzer/lib/src/generated/element.dart
+++ b/pkg/analyzer/lib/src/generated/element.dart
@@ -167,7 +167,7 @@
}
@override
- String get identifier => "AngularComponent@${_annotationOffset}";
+ String get identifier => "AngularComponent@$_annotationOffset";
}
/**
@@ -271,7 +271,7 @@
}
@override
- String get identifier => "Decorator@${_offset}";
+ String get identifier => "Decorator@$_offset";
}
/**
@@ -384,9 +384,9 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
- builder.append(".");
- builder.append(name);
+ void appendTo(StringBuffer buffer) {
+ buffer.write(".");
+ buffer.write(name);
}
}
@@ -731,7 +731,7 @@
ElementKind get kind => ElementKind.ANGULAR_VIEW;
@override
- String get identifier => "AngularView@${templateUriOffset}";
+ String get identifier => "AngularView@$templateUriOffset";
}
/**
@@ -1286,13 +1286,16 @@
accept(ElementVisitor visitor) => visitor.visitClassElement(this);
/**
- * Set the toolkit specific information objects attached to this class.
- *
- * @param toolkitObjects the toolkit objects attached to this class
+ * Add the given [toolkitObject] to the list of toolkit specific information
+ * objects attached to this class.
*/
void addToolkitObjects(ToolkitObjectElement toolkitObject) {
(toolkitObject as ToolkitObjectElementImpl).enclosingElement = this;
- _toolkitObjects = ArrayUtils.add(_toolkitObjects, toolkitObject);
+ if (_toolkitObjects.isEmpty) {
+ // Convert from a non-growable list to a growable list.
+ _toolkitObjects = <ToolkitObjectElement>[];
+ }
+ _toolkitObjects.add(toolkitObject);
}
@override
@@ -1302,7 +1305,7 @@
List<InterfaceType> get allSupertypes {
List<InterfaceType> list = new List<InterfaceType>();
_collectAllSupertypes(list);
- return new List.from(list);
+ return list;
}
@override
@@ -1644,23 +1647,23 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
+ void appendTo(StringBuffer buffer) {
String name = displayName;
if (name == null) {
- builder.append("{unnamed class}");
+ buffer.write("{unnamed class}");
} else {
- builder.append(name);
+ buffer.write(name);
}
int variableCount = _typeParameters.length;
if (variableCount > 0) {
- builder.append("<");
+ buffer.write("<");
for (int i = 0; i < variableCount; i++) {
if (i > 0) {
- builder.append(", ");
+ buffer.write(", ");
}
- (_typeParameters[i] as TypeParameterElementImpl).appendTo(builder);
+ (_typeParameters[i] as TypeParameterElementImpl).appendTo(buffer);
}
- builder.append(">");
+ buffer.write(">");
}
}
@@ -2083,6 +2086,11 @@
return type as ClassElementImpl;
}
}
+ for (ClassElement type in _enums) {
+ if ((type as ClassElementImpl).identifier == identifier) {
+ return type as ClassElementImpl;
+ }
+ }
return null;
}
@@ -2240,11 +2248,11 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
+ void appendTo(StringBuffer buffer) {
if (source == null) {
- builder.append("{compilation unit}");
+ buffer.write("{compilation unit}");
} else {
- builder.append(source.fullName);
+ buffer.write(source.fullName);
}
}
@@ -2505,14 +2513,14 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
- builder.append(enclosingElement.displayName);
+ void appendTo(StringBuffer buffer) {
+ buffer.write(enclosingElement.displayName);
String name = displayName;
if (name != null && !name.isEmpty) {
- builder.append(".");
- builder.append(name);
+ buffer.write(".");
+ buffer.write(name);
}
- super.appendTo(builder);
+ super.appendTo(buffer);
}
}
@@ -2589,27 +2597,27 @@
ConstructorElement baseElement = this.baseElement;
List<ParameterElement> parameters = this.parameters;
FunctionType type = this.type;
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append(baseElement.enclosingElement.displayName);
+ StringBuffer buffer = new StringBuffer();
+ buffer.write(baseElement.enclosingElement.displayName);
String name = displayName;
if (name != null && !name.isEmpty) {
- builder.append(".");
- builder.append(name);
+ buffer.write(".");
+ buffer.write(name);
}
- builder.append("(");
+ buffer.write("(");
int parameterCount = parameters.length;
for (int i = 0; i < parameterCount; i++) {
if (i > 0) {
- builder.append(", ");
+ buffer.write(", ");
}
- builder.append(parameters[i]).toString();
+ buffer.write(parameters[i]);
}
- builder.append(")");
+ buffer.write(")");
if (type != null) {
- builder.append(Element.RIGHT_ARROW);
- builder.append(type.returnType);
+ buffer.write(Element.RIGHT_ARROW);
+ buffer.write(type.returnType);
}
- return builder.toString();
+ return buffer.toString();
}
@override
@@ -3258,7 +3266,7 @@
}
@override
- String toString() => "@${element.toString()}";
+ String toString() => '@$element';
}
/**
@@ -3375,7 +3383,7 @@
}
Source source = this.source;
if (source != null) {
- return "${shortName} (${source.fullName})";
+ return "$shortName (${source.fullName})";
}
return shortName;
}
@@ -3482,9 +3490,9 @@
@override
String toString() {
- JavaStringBuilder builder = new JavaStringBuilder();
- appendTo(builder);
- return builder.toString();
+ StringBuffer buffer = new StringBuffer();
+ appendTo(buffer);
+ return buffer.toString();
}
@override
@@ -3493,17 +3501,15 @@
}
/**
- * Append a textual representation of this type to the given builder.
- *
- * @param builder the builder to which the text is to be appended
+ * Append a textual representation of this element to the given [buffer].
*/
- void appendTo(JavaStringBuilder builder) {
+ void appendTo(StringBuffer buffer) {
if (_name == null) {
- builder.append("<unnamed ");
- builder.append(runtimeType.toString());
- builder.append(">");
+ buffer.write("<unnamed ");
+ buffer.write(runtimeType.toString());
+ buffer.write(">");
} else {
- builder.append(_name);
+ buffer.write(_name);
}
}
@@ -3775,7 +3781,7 @@
components.insert(0, (ancestor as ElementImpl).identifier);
ancestor = ancestor.enclosingElement;
}
- this._components = new List.from(components);
+ this._components = components;
}
/**
@@ -3823,15 +3829,15 @@
@override
String get encoding {
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
int length = _components.length;
for (int i = 0; i < length; i++) {
if (i > 0) {
- builder.appendChar(_SEPARATOR_CHAR);
+ buffer.writeCharCode(_SEPARATOR_CHAR);
}
- _encode(builder, _components[i]);
+ _encode(buffer, _components[i]);
}
- return builder.toString();
+ return buffer.toString();
}
@override
@@ -3855,27 +3861,27 @@
*/
List<String> _decode(String encoding) {
List<String> components = new List<String>();
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
int index = 0;
int length = encoding.length;
while (index < length) {
int currentChar = encoding.codeUnitAt(index);
if (currentChar == _SEPARATOR_CHAR) {
if (index + 1 < length && encoding.codeUnitAt(index + 1) == _SEPARATOR_CHAR) {
- builder.appendChar(_SEPARATOR_CHAR);
+ buffer.writeCharCode(_SEPARATOR_CHAR);
index += 2;
} else {
- components.add(builder.toString());
- builder.length = 0;
+ components.add(buffer.toString());
+ buffer = new StringBuffer();
index++;
}
} else {
- builder.appendChar(currentChar);
+ buffer.writeCharCode(currentChar);
index++;
}
}
- components.add(builder.toString());
- return new List.from(components);
+ components.add(buffer.toString());
+ return components;
}
/**
@@ -3884,14 +3890,14 @@
* @param builder the builder to which the encoded component is to be appended
* @param component the component to be appended to the builder
*/
- void _encode(JavaStringBuilder builder, String component) {
+ void _encode(StringBuffer buffer, String component) {
int length = component.length;
for (int i = 0; i < length; i++) {
int currentChar = component.codeUnitAt(i);
if (currentChar == _SEPARATOR_CHAR) {
- builder.appendChar(_SEPARATOR_CHAR);
+ buffer.writeCharCode(_SEPARATOR_CHAR);
}
- builder.appendChar(currentChar);
+ buffer.writeCharCode(currentChar);
}
}
}
@@ -4343,43 +4349,43 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
+ void appendTo(StringBuffer buffer) {
if (this.kind != ElementKind.GETTER) {
- builder.append("(");
+ buffer.write("(");
String closing = null;
ParameterKind kind = ParameterKind.REQUIRED;
int parameterCount = _parameters.length;
for (int i = 0; i < parameterCount; i++) {
if (i > 0) {
- builder.append(", ");
+ buffer.write(", ");
}
ParameterElementImpl parameter = _parameters[i] as ParameterElementImpl;
ParameterKind parameterKind = parameter.parameterKind;
if (parameterKind != kind) {
if (closing != null) {
- builder.append(closing);
+ buffer.write(closing);
}
if (parameterKind == ParameterKind.POSITIONAL) {
- builder.append("[");
+ buffer.write("[");
closing = "]";
} else if (parameterKind == ParameterKind.NAMED) {
- builder.append("{");
+ buffer.write("{");
closing = "}";
} else {
closing = null;
}
}
kind = parameterKind;
- parameter.appendToWithoutDelimiters(builder);
+ parameter.appendToWithoutDelimiters(buffer);
}
if (closing != null) {
- builder.append(closing);
+ buffer.write(closing);
}
- builder.append(")");
+ buffer.write(")");
}
if (type != null) {
- builder.append(Element.RIGHT_ARROW);
- builder.append(type.returnType);
+ buffer.write(Element.RIGHT_ARROW);
+ buffer.write(type.returnType);
}
}
}
@@ -4523,9 +4529,9 @@
ElementKind get kind => ElementKind.EXPORT;
@override
- void appendTo(JavaStringBuilder builder) {
- builder.append("export ");
- (exportedLibrary as LibraryElementImpl).appendTo(builder);
+ void appendTo(StringBuffer buffer) {
+ buffer.write("export ");
+ (exportedLibrary as LibraryElementImpl).appendTo(buffer);
}
@override
@@ -4778,13 +4784,7 @@
bool get isStatic => baseElement.isStatic;
@override
- String toString() {
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append(type);
- builder.append(" ");
- builder.append(displayName);
- return builder.toString();
- }
+ String toString() => '$type $displayName';
@override
InterfaceType get definingType => super.definingType as InterfaceType;
@@ -4903,19 +4903,19 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
+ void appendTo(StringBuffer buffer) {
String name = displayName;
if (name != null) {
- builder.append(name);
+ buffer.write(name);
}
- super.appendTo(builder);
+ super.appendTo(buffer);
}
@override
String get identifier {
String identifier = super.identifier;
if (!isStatic) {
- identifier += "@${nameOffset}";
+ identifier += "@$nameOffset";
}
return identifier;
}
@@ -5236,32 +5236,32 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
- builder.append("typedef ");
- builder.append(displayName);
+ void appendTo(StringBuffer buffer) {
+ buffer.write("typedef ");
+ buffer.write(displayName);
int typeParameterCount = _typeParameters.length;
if (typeParameterCount > 0) {
- builder.append("<");
+ buffer.write("<");
for (int i = 0; i < typeParameterCount; i++) {
if (i > 0) {
- builder.append(", ");
+ buffer.write(", ");
}
- (_typeParameters[i] as TypeParameterElementImpl).appendTo(builder);
+ (_typeParameters[i] as TypeParameterElementImpl).appendTo(buffer);
}
- builder.append(">");
+ buffer.write(">");
}
- builder.append("(");
+ buffer.write("(");
int parameterCount = _parameters.length;
for (int i = 0; i < parameterCount; i++) {
if (i > 0) {
- builder.append(", ");
+ buffer.write(", ");
}
- (_parameters[i] as ParameterElementImpl).appendTo(builder);
+ (_parameters[i] as ParameterElementImpl).appendTo(buffer);
}
- builder.append(")");
+ buffer.write(")");
if (type != null) {
- builder.append(Element.RIGHT_ARROW);
- builder.append(type.returnType);
+ buffer.write(Element.RIGHT_ARROW);
+ buffer.write(type.returnType);
}
}
}
@@ -5286,12 +5286,15 @@
if (secondTypes.length != firstTypes.length) {
return false;
}
- JavaIterator<MapEntry<String, DartType>> firstIterator = new JavaIterator(getMapEntrySet(firstTypes));
- JavaIterator<MapEntry<String, DartType>> secondIterator = new JavaIterator(getMapEntrySet(secondTypes));
- while (firstIterator.hasNext) {
- MapEntry<String, DartType> firstEntry = firstIterator.next();
- MapEntry<String, DartType> secondEntry = secondIterator.next();
- if (firstEntry.getKey() != secondEntry.getKey() || !(firstEntry.getValue() as TypeImpl).internalEquals(secondEntry.getValue(), visitedElementPairs)) {
+ Iterator<String> firstKeys = firstTypes.keys.iterator;
+ Iterator<String> secondKeys = secondTypes.keys.iterator;
+ while (firstKeys.moveNext() && secondKeys.moveNext()) {
+ String firstKey = firstKeys.current;
+ String secondKey = secondKeys.current;
+ TypeImpl firstType = firstTypes[firstKey];
+ TypeImpl secondType = secondTypes[secondKey];
+ if (firstKey != secondKey
+ || !firstType.internalEquals(secondType, visitedElementPairs)) {
return false;
}
}
@@ -5332,63 +5335,63 @@
List<DartType> optionalParameterTypes = this.optionalParameterTypes;
Map<String, DartType> namedParameterTypes = this.namedParameterTypes;
DartType returnType = this.returnType;
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append("(");
+ StringBuffer buffer = new StringBuffer();
+ buffer.write("(");
bool needsComma = false;
if (normalParameterTypes.length > 0) {
for (DartType type in normalParameterTypes) {
if (needsComma) {
- builder.append(", ");
+ buffer.write(", ");
} else {
needsComma = true;
}
- builder.append(type.displayName);
+ buffer.write(type.displayName);
}
}
if (optionalParameterTypes.length > 0) {
if (needsComma) {
- builder.append(", ");
+ buffer.write(", ");
needsComma = false;
}
- builder.append("[");
+ buffer.write("[");
for (DartType type in optionalParameterTypes) {
if (needsComma) {
- builder.append(", ");
+ buffer.write(", ");
} else {
needsComma = true;
}
- builder.append(type.displayName);
+ buffer.write(type.displayName);
}
- builder.append("]");
+ buffer.write("]");
needsComma = true;
}
if (namedParameterTypes.length > 0) {
if (needsComma) {
- builder.append(", ");
+ buffer.write(", ");
needsComma = false;
}
- builder.append("{");
- for (MapEntry<String, DartType> entry in getMapEntrySet(namedParameterTypes)) {
+ buffer.write("{");
+ namedParameterTypes.forEach((String name, DartType type) {
if (needsComma) {
- builder.append(", ");
+ buffer.write(", ");
} else {
needsComma = true;
}
- builder.append(entry.getKey());
- builder.append(": ");
- builder.append(entry.getValue().displayName);
- }
- builder.append("}");
+ buffer.write(name);
+ buffer.write(": ");
+ buffer.write(type.displayName);
+ });
+ buffer.write("}");
needsComma = true;
}
- builder.append(")");
- builder.append(Element.RIGHT_ARROW);
+ buffer.write(")");
+ buffer.write(Element.RIGHT_ARROW);
if (returnType == null) {
- builder.append("null");
+ buffer.write("null");
} else {
- builder.append(returnType.displayName);
+ buffer.write(returnType.displayName);
}
- name = builder.toString();
+ name = buffer.toString();
}
return name;
}
@@ -5430,7 +5433,7 @@
types.add(type);
}
}
- return new List.from(types);
+ return types;
}
@override
@@ -5450,7 +5453,7 @@
types.add(type);
}
}
- return new List.from(types);
+ return types;
}
@override
@@ -5564,16 +5567,15 @@
if (namedTypesT.length < namedTypesS.length) {
return false;
}
- // Loop through each element in S verifying that T has a matching parameter name and that the
- // corresponding type is more specific then the type in S.
- JavaIterator<MapEntry<String, DartType>> iteratorS = new JavaIterator(getMapEntrySet(namedTypesS));
- while (iteratorS.hasNext) {
- MapEntry<String, DartType> entryS = iteratorS.next();
- DartType typeT = namedTypesT[entryS.getKey()];
+ // Loop through each element in S verifying that T has a matching
+ // parameter name and that the corresponding type is more specific then
+ // the type in S.
+ for (String keyS in namedTypesS.keys) {
+ DartType typeT = namedTypesT[keyS];
if (typeT == null) {
return false;
}
- if (!(typeT as TypeImpl).isMoreSpecificThan2(entryS.getValue(), withDynamic, visitedTypePairs)) {
+ if (!(typeT as TypeImpl).isMoreSpecificThan2(namedTypesS[keyS], withDynamic, visitedTypePairs)) {
return false;
}
}
@@ -5656,65 +5658,65 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
+ void appendTo(StringBuffer buffer) {
List<DartType> normalParameterTypes = this.normalParameterTypes;
List<DartType> optionalParameterTypes = this.optionalParameterTypes;
Map<String, DartType> namedParameterTypes = this.namedParameterTypes;
DartType returnType = this.returnType;
- builder.append("(");
+ buffer.write("(");
bool needsComma = false;
if (normalParameterTypes.length > 0) {
for (DartType type in normalParameterTypes) {
if (needsComma) {
- builder.append(", ");
+ buffer.write(", ");
} else {
needsComma = true;
}
- (type as TypeImpl).appendTo(builder);
+ (type as TypeImpl).appendTo(buffer);
}
}
if (optionalParameterTypes.length > 0) {
if (needsComma) {
- builder.append(", ");
+ buffer.write(", ");
needsComma = false;
}
- builder.append("[");
+ buffer.write("[");
for (DartType type in optionalParameterTypes) {
if (needsComma) {
- builder.append(", ");
+ buffer.write(", ");
} else {
needsComma = true;
}
- (type as TypeImpl).appendTo(builder);
+ (type as TypeImpl).appendTo(buffer);
}
- builder.append("]");
+ buffer.write("]");
needsComma = true;
}
if (namedParameterTypes.length > 0) {
if (needsComma) {
- builder.append(", ");
+ buffer.write(", ");
needsComma = false;
}
- builder.append("{");
- for (MapEntry<String, DartType> entry in getMapEntrySet(namedParameterTypes)) {
+ buffer.write("{");
+ namedParameterTypes.forEach((String name, DartType type) {
if (needsComma) {
- builder.append(", ");
+ buffer.write(", ");
} else {
needsComma = true;
}
- builder.append(entry.getKey());
- builder.append(": ");
- (entry.getValue() as TypeImpl).appendTo(builder);
- }
- builder.append("}");
+ buffer.write(name);
+ buffer.write(": ");
+ (type as TypeImpl).appendTo(buffer);
+ });
+ buffer.write("}");
needsComma = true;
}
- builder.append(")");
- builder.append(Element.RIGHT_ARROW);
+ buffer.write(")");
+ buffer.write(Element.RIGHT_ARROW);
if (returnType == null) {
- builder.append("null");
+ buffer.write("null");
} else {
- (returnType as TypeImpl).appendTo(builder);
+ (returnType as TypeImpl).appendTo(buffer);
}
}
@@ -5792,16 +5794,15 @@
if (namedTypesT.length < namedTypesS.length) {
return false;
}
- // Loop through each element in S verifying that T has a matching parameter name and that the
- // corresponding type is assignable to the type in S.
- JavaIterator<MapEntry<String, DartType>> iteratorS = new JavaIterator(getMapEntrySet(namedTypesS));
- while (iteratorS.hasNext) {
- MapEntry<String, DartType> entryS = iteratorS.next();
- DartType typeT = namedTypesT[entryS.getKey()];
+ // Loop through each element in S verifying that T has a matching
+ // parameter name and that the corresponding type is assignable to the
+ // type in S.
+ for (String keyS in namedTypesS.keys) {
+ DartType typeT = namedTypesT[keyS];
if (typeT == null) {
return false;
}
- if (!(typeT as TypeImpl).isAssignableTo2(entryS.getValue(), visitedTypePairs)) {
+ if (!(typeT as TypeImpl).isAssignableTo2(namedTypesS[keyS], visitedTypePairs)) {
return false;
}
}
@@ -6069,10 +6070,10 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
- builder.append("[");
- builder.append(name);
- builder.append("]");
+ void appendTo(StringBuffer buffer) {
+ buffer.write("[");
+ buffer.write(name);
+ buffer.write("]");
}
}
@@ -6103,16 +6104,16 @@
@override
String toString() {
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append("show ");
+ StringBuffer buffer = new StringBuffer();
+ buffer.write("show ");
int count = hiddenNames.length;
for (int i = 0; i < count; i++) {
if (i > 0) {
- builder.append(", ");
+ buffer.write(", ");
}
- builder.append(hiddenNames[i]);
+ buffer.write(hiddenNames[i]);
}
- return builder.toString();
+ return buffer.toString();
}
}
@@ -6251,11 +6252,11 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
+ void appendTo(StringBuffer buffer) {
if (source == null) {
- builder.append("{HTML file}");
+ buffer.write("{HTML file}");
} else {
- builder.append(source.fullName);
+ buffer.write(source.fullName);
}
}
@@ -6399,13 +6400,13 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
- builder.append("import ");
- (importedLibrary as LibraryElementImpl).appendTo(builder);
+ void appendTo(StringBuffer buffer) {
+ buffer.write("import ");
+ (importedLibrary as LibraryElementImpl).appendTo(buffer);
}
@override
- String get identifier => "${(importedLibrary as LibraryElementImpl).identifier}@${nameOffset}";
+ String get identifier => "${(importedLibrary as LibraryElementImpl).identifier}@$nameOffset";
}
/**
@@ -6903,18 +6904,18 @@
}
// If there is at least one non-dynamic type, then list them out
if (!allDynamic) {
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append(name);
- builder.append("<");
+ StringBuffer buffer = new StringBuffer();
+ buffer.write(name);
+ buffer.write("<");
for (int i = 0; i < typeArguments.length; i++) {
if (i != 0) {
- builder.append(", ");
+ buffer.write(", ");
}
DartType typeArg = typeArguments[i];
- builder.append(typeArg.displayName);
+ buffer.write(typeArg.displayName);
}
- builder.append(">");
- name = builder.toString();
+ buffer.write(">");
+ name = buffer.toString();
}
return name;
}
@@ -7268,18 +7269,18 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
- builder.append(name);
+ void appendTo(StringBuffer buffer) {
+ buffer.write(name);
int argumentCount = typeArguments.length;
if (argumentCount > 0) {
- builder.append("<");
+ buffer.write("<");
for (int i = 0; i < argumentCount; i++) {
if (i > 0) {
- builder.append(", ");
+ buffer.write(", ");
}
- (typeArguments[i] as TypeImpl).appendTo(builder);
+ (typeArguments[i] as TypeImpl).appendTo(buffer);
}
- builder.append(">");
+ buffer.write(">");
}
}
@@ -7506,7 +7507,7 @@
String _attributeName;
- IsTagHasAttributeSelectorElementImpl(String tagName, String attributeName) : super("${tagName}[${attributeName}]", -1) {
+ IsTagHasAttributeSelectorElementImpl(String tagName, String attributeName) : super("$tagName[$attributeName]", -1) {
this._tagName = tagName;
this._attributeName = attributeName;
}
@@ -7922,7 +7923,7 @@
importList.add(_imports[i]);
}
}
- return new List.from(importList);
+ return importList;
}
@override
@@ -8342,14 +8343,14 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
- builder.append(type);
- builder.append(" ");
- builder.append(displayName);
+ void appendTo(StringBuffer buffer) {
+ buffer.write(type);
+ buffer.write(" ");
+ buffer.write(displayName);
}
@override
- String get identifier => "${super.identifier}@${nameOffset}";
+ String get identifier => "${super.identifier}@$nameOffset";
}
/**
@@ -8630,11 +8631,11 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
- builder.append(enclosingElement.displayName);
- builder.append(".");
- builder.append(displayName);
- super.appendTo(builder);
+ void appendTo(StringBuffer buffer) {
+ buffer.write(enclosingElement.displayName);
+ buffer.write(".");
+ buffer.write(displayName);
+ super.appendTo(buffer);
}
}
@@ -8698,24 +8699,24 @@
MethodElement baseElement = this.baseElement;
List<ParameterElement> parameters = this.parameters;
FunctionType type = this.type;
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append(baseElement.enclosingElement.displayName);
- builder.append(".");
- builder.append(baseElement.displayName);
- builder.append("(");
+ StringBuffer buffer = new StringBuffer();
+ buffer.write(baseElement.enclosingElement.displayName);
+ buffer.write(".");
+ buffer.write(baseElement.displayName);
+ buffer.write("(");
int parameterCount = parameters.length;
for (int i = 0; i < parameterCount; i++) {
if (i > 0) {
- builder.append(", ");
+ buffer.write(", ");
}
- builder.append(parameters[i]).toString();
+ buffer.write(parameters[i]);
}
- builder.append(")");
+ buffer.write(")");
if (type != null) {
- builder.append(Element.RIGHT_ARROW);
- builder.append(type.returnType);
+ buffer.write(Element.RIGHT_ARROW);
+ buffer.write(type.returnType);
}
- return builder.toString();
+ return buffer.toString();
}
}
@@ -9032,17 +9033,17 @@
@override
String toString() {
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append("[");
+ StringBuffer buffer = new StringBuffer();
+ buffer.write("[");
int count = conflictingElements.length;
for (int i = 0; i < count; i++) {
if (i > 0) {
- builder.append(", ");
+ buffer.write(", ");
}
- (conflictingElements[i] as ElementImpl).appendTo(builder);
+ (conflictingElements[i] as ElementImpl).appendTo(buffer);
}
- builder.append("]");
- return builder.toString();
+ buffer.write("]");
+ return buffer.toString();
}
@override
@@ -9302,7 +9303,7 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
+ void appendTo(StringBuffer buffer) {
String left = "";
String right = "";
while (true) {
@@ -9316,9 +9317,9 @@
}
break;
}
- builder.append(left);
- appendToWithoutDelimiters(builder);
- builder.append(right);
+ buffer.write(left);
+ appendToWithoutDelimiters(buffer);
+ buffer.write(right);
}
/**
@@ -9326,18 +9327,18 @@
*
* @param builder the builder to which the type and name are to be appended
*/
- void appendToWithoutDelimiters(JavaStringBuilder builder) {
- builder.append(type);
- builder.append(" ");
- builder.append(displayName);
+ void appendToWithoutDelimiters(StringBuffer buffer) {
+ buffer.write(type);
+ buffer.write(" ");
+ buffer.write(displayName);
if (_defaultValueCode != null) {
if (parameterKind == ParameterKind.NAMED) {
- builder.append(": ");
+ buffer.write(": ");
}
if (parameterKind == ParameterKind.POSITIONAL) {
- builder.append(" = ");
+ buffer.write(" = ");
}
- builder.append(_defaultValueCode);
+ buffer.write(_defaultValueCode);
}
}
}
@@ -9458,13 +9459,7 @@
}
break;
}
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append(left);
- builder.append(type);
- builder.append(" ");
- builder.append(baseElement.displayName);
- builder.append(right);
- return builder.toString();
+ return '$left$type ${baseElement.displayName}$right';
}
@override
@@ -9777,9 +9772,9 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
- builder.append("as ");
- super.appendTo(builder);
+ void appendTo(StringBuffer buffer) {
+ buffer.write("as ");
+ super.appendTo(buffer);
}
@override
@@ -9987,17 +9982,17 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
- builder.append(isGetter ? "get " : "set ");
- builder.append(variable.displayName);
- super.appendTo(builder);
+ void appendTo(StringBuffer buffer) {
+ buffer.write(isGetter ? "get " : "set ");
+ buffer.write(variable.displayName);
+ super.appendTo(buffer);
}
@override
String get identifier {
String name = displayName;
String suffix = isGetter ? "?" : "=";
- return "${name}${suffix}";
+ return "$name$suffix";
}
}
@@ -10107,27 +10102,27 @@
PropertyAccessorElement baseElement = this.baseElement;
List<ParameterElement> parameters = this.parameters;
FunctionType type = this.type;
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer builder = new StringBuffer();
if (isGetter) {
- builder.append("get ");
+ builder.write("get ");
} else {
- builder.append("set ");
+ builder.write("set ");
}
- builder.append(baseElement.enclosingElement.displayName);
- builder.append(".");
- builder.append(baseElement.displayName);
- builder.append("(");
+ builder.write(baseElement.enclosingElement.displayName);
+ builder.write(".");
+ builder.write(baseElement.displayName);
+ builder.write("(");
int parameterCount = parameters.length;
for (int i = 0; i < parameterCount; i++) {
if (i > 0) {
- builder.append(", ");
+ builder.write(", ");
}
- builder.append(parameters[i]).toString();
+ builder.write(parameters[i]);
}
- builder.append(")");
+ builder.write(")");
if (type != null) {
- builder.append(Element.RIGHT_ARROW);
- builder.append(type.returnType);
+ builder.write(Element.RIGHT_ARROW);
+ builder.write(type.returnType);
}
return builder.toString();
}
@@ -10492,16 +10487,16 @@
@override
String toString() {
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append("show ");
+ StringBuffer buffer = new StringBuffer();
+ buffer.write("show ");
int count = shownNames.length;
for (int i = 0; i < count; i++) {
if (i > 0) {
- builder.append(", ");
+ buffer.write(", ");
}
- builder.append(shownNames[i]);
+ buffer.write(shownNames[i]);
}
- return builder.toString();
+ return buffer.toString();
}
}
@@ -10880,21 +10875,19 @@
@override
String toString() {
- JavaStringBuilder builder = new JavaStringBuilder();
- appendTo(builder);
- return builder.toString();
+ StringBuffer buffer = new StringBuffer();
+ appendTo(buffer);
+ return buffer.toString();
}
/**
- * Append a textual representation of this type to the given builder.
- *
- * @param builder the builder to which the text is to be appended
+ * Append a textual representation of this type to the given [buffer].
*/
- void appendTo(JavaStringBuilder builder) {
+ void appendTo(StringBuffer buffer) {
if (name == null) {
- builder.append("<unnamed type>");
+ buffer.write("<unnamed type>");
} else {
- builder.append(name);
+ buffer.write(name);
}
}
@@ -11009,11 +11002,11 @@
ElementKind get kind => ElementKind.TYPE_PARAMETER;
@override
- void appendTo(JavaStringBuilder builder) {
- builder.append(displayName);
+ void appendTo(StringBuffer buffer) {
+ buffer.write(displayName);
if (bound != null) {
- builder.append(" extends ");
- builder.append(bound);
+ buffer.write(" extends ");
+ buffer.write(bound);
}
}
}
@@ -11267,7 +11260,7 @@
// instead of raising an exception.
throw new IllegalArgumentException("No known use case for empty unions.");
} else if (set.length == 1) {
- return new JavaIterator(set).next();
+ return set.first;
} else {
return new UnionTypeImpl(set);
}
@@ -11299,15 +11292,15 @@
@override
String get displayName {
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
String prefix = "{";
for (DartType t in _types) {
- builder.append(prefix);
- builder.append(t.displayName);
+ buffer.write(prefix);
+ buffer.write(t.displayName);
prefix = ",";
}
- builder.append("}");
- return builder.toString();
+ buffer.write("}");
+ return buffer.toString();
}
@override
@@ -11322,18 +11315,18 @@
for (DartType t in _types) {
out.add(t.substitute2(argumentTypes, parameterTypes));
}
- return union(new List.from(out));
+ return union(out);
}
@override
- void appendTo(JavaStringBuilder builder) {
+ void appendTo(StringBuffer buffer) {
String prefix = "{";
- for (DartType t in _types) {
- builder.append(prefix);
- (t as TypeImpl).appendTo(builder);
+ for (DartType type in _types) {
+ buffer.write(prefix);
+ (type as TypeImpl).appendTo(buffer);
prefix = ",";
}
- builder.append("}");
+ buffer.write("}");
}
@override
@@ -11663,10 +11656,10 @@
}
@override
- void appendTo(JavaStringBuilder builder) {
- builder.append(type);
- builder.append(" ");
- builder.append(displayName);
+ void appendTo(StringBuffer buffer) {
+ buffer.write(type);
+ buffer.write(" ");
+ buffer.write(displayName);
}
}
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index ea758e7..4de74d4 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -8,6 +8,7 @@
library engine;
import 'dart:collection';
+import "dart:math" as math;
import 'package:analyzer/src/task/task_dart.dart';
@@ -1003,14 +1004,13 @@
@override
void applyAnalysisDelta(AnalysisDelta delta) {
ChangeSet changeSet = new ChangeSet();
- for (MapEntry<Source, AnalysisLevel> entry in getMapEntrySet(delta.analysisLevels)) {
- Source source = entry.getKey();
- if (entry.getValue() == AnalysisLevel.NONE) {
+ delta.analysisLevels.forEach((Source source, AnalysisLevel level) {
+ if (level == AnalysisLevel.NONE) {
changeSet.removedSource(source);
} else {
changeSet.addedSource(source);
}
- }
+ });
applyChanges(changeSet);
}
@@ -1043,13 +1043,17 @@
}
_sourceChanged(source);
}
- for (MapEntry<Source, String> entry in getMapEntrySet(changeSet.changedContents)) {
- setContents(entry.getKey(), entry.getValue());
- }
- for (MapEntry<Source, ChangeSet_ContentChange> entry in getMapEntrySet(changeSet.changedRanges)) {
- ChangeSet_ContentChange change = entry.getValue();
- setChangedContents(entry.getKey(), change.contents, change.offset, change.oldLength, change.newLength);
- }
+ changeSet.changedContents.forEach((Source key, String value) {
+ setContents(key, value);
+ });
+ changeSet.changedRanges.forEach((Source source, ChangeSet_ContentChange change) {
+ setChangedContents(
+ source,
+ change.contents,
+ change.offset,
+ change.oldLength,
+ change.newLength);
+ });
for (Source source in changeSet.deletedSources) {
_sourceDeleted(source);
}
@@ -1107,15 +1111,15 @@
if (comment == null) {
return null;
}
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
List<Token> tokens = comment.tokens;
for (int i = 0; i < tokens.length; i++) {
if (i > 0) {
- builder.append("\n");
+ buffer.write("\n");
}
- builder.append(tokens[i].lexeme);
+ buffer.write(tokens[i].lexeme);
}
- return builder.toString();
+ return buffer.toString();
}
nameNode = nameNode.parent;
}
@@ -1160,7 +1164,7 @@
if (errors.isEmpty) {
return AnalysisError.NO_ERRORS;
}
- return new List.from(errors);
+ return errors;
} else if (sourceEntry is HtmlEntry) {
HtmlEntry htmlEntry = sourceEntry;
try {
@@ -1209,7 +1213,7 @@
return _getDartScanData2(source, SourceEntry.LINE_INFO, null);
}
} on ObsoleteSourceAnalysisException catch (exception) {
- AnalysisEngine.instance.logger.logInformation2("Could not compute ${SourceEntry.LINE_INFO.toString()}", exception);
+ AnalysisEngine.instance.logger.logInformation2("Could not compute ${SourceEntry.LINE_INFO}", exception);
}
return null;
}
@@ -1382,7 +1386,7 @@
if (htmlSources.isEmpty) {
return Source.EMPTY_ARRAY;
}
- return new List.from(htmlSources);
+ return htmlSources;
}
@override
@@ -1413,7 +1417,7 @@
// }
}
}
- return new List.from(sources);
+ return sources;
}
@override
@@ -1432,7 +1436,7 @@
// }
}
}
- return new List.from(sources);
+ return sources;
}
@override
@@ -1462,7 +1466,7 @@
if (dependentLibraries.isEmpty) {
return Source.EMPTY_ARRAY;
}
- return new List.from(dependentLibraries);
+ return dependentLibraries;
}
@override
@@ -1727,10 +1731,10 @@
try {
task.perform(_resultRecorder);
} on ObsoleteSourceAnalysisException catch (exception) {
- AnalysisEngine.instance.logger.logInformation2("Could not perform analysis task: ${taskDescription}", exception);
+ AnalysisEngine.instance.logger.logInformation2("Could not perform analysis task: $taskDescription", exception);
} on AnalysisException catch (exception) {
if (exception.cause is! JavaIOException) {
- AnalysisEngine.instance.logger.logError2("Internal error while performing the task: ${task}", exception);
+ AnalysisEngine.instance.logger.logError2("Internal error while performing the task: $task", exception);
}
}
int performEnd = JavaSystem.currentTimeMillis();
@@ -1755,9 +1759,7 @@
@override
void recordLibraryElements(Map<Source, LibraryElement> elementMap) {
Source htmlSource = _sourceFactory.forUri(DartSdk.DART_HTML);
- for (MapEntry<Source, LibraryElement> entry in getMapEntrySet(elementMap)) {
- Source librarySource = entry.getKey();
- LibraryElement library = entry.getValue();
+ elementMap.forEach((Source librarySource, LibraryElement library) {
//
// Cache the element in the library's info.
//
@@ -1784,7 +1786,7 @@
dartEntry.setValueInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, AnalysisError.NO_ERRORS);
dartEntry.setValueInLibrary(DartEntry.HINTS, librarySource, AnalysisError.NO_ERRORS);
}
- }
+ });
}
@override
@@ -1861,7 +1863,7 @@
// result in an infinite loop in performAnalysisTask() because re-caching one AST structure
// can cause another priority source's AST structure to be flushed.
//
- int count = Math.min(sources.length, _options.cacheSize - _PRIORITY_ORDER_SIZE_DELTA);
+ int count = math.min(sources.length, _options.cacheSize - _PRIORITY_ORDER_SIZE_DELTA);
_priorityOrder = new List<Source>(count);
for (int i = 0; i < count; i++) {
_priorityOrder[i] = sources[i];
@@ -2836,7 +2838,7 @@
try {
return _getDartParseData(source, dartEntry, descriptor);
} on ObsoleteSourceAnalysisException catch (exception) {
- AnalysisEngine.instance.logger.logInformation2("Could not compute ${descriptor.toString()}", exception);
+ AnalysisEngine.instance.logger.logInformation2("Could not compute $descriptor", exception);
return defaultValue;
}
}
@@ -2890,7 +2892,7 @@
try {
return _getDartResolutionData(unitSource, librarySource, dartEntry, descriptor);
} on ObsoleteSourceAnalysisException catch (exception) {
- AnalysisEngine.instance.logger.logInformation2("Could not compute ${descriptor.toString()}", exception);
+ AnalysisEngine.instance.logger.logInformation2("Could not compute $descriptor", exception);
return defaultValue;
}
}
@@ -2935,7 +2937,7 @@
try {
return _getDartScanData(source, dartEntry, descriptor);
} on ObsoleteSourceAnalysisException catch (exception) {
- AnalysisEngine.instance.logger.logInformation2("Could not compute ${descriptor.toString()}", exception);
+ AnalysisEngine.instance.logger.logInformation2("Could not compute $descriptor", exception);
return defaultValue;
}
}
@@ -3009,7 +3011,7 @@
try {
return _getHtmlResolutionData2(source, htmlEntry, descriptor);
} on ObsoleteSourceAnalysisException catch (exception) {
- AnalysisEngine.instance.logger.logInformation2("Could not compute ${descriptor.toString()}", exception);
+ AnalysisEngine.instance.logger.logInformation2("Could not compute $descriptor", exception);
return defaultValue;
}
}
@@ -3378,7 +3380,7 @@
sources.add(iterator.key);
}
}
- return new List.from(sources);
+ return sources;
}
/**
@@ -3603,7 +3605,7 @@
}
}
// invalidate Angular applications
- List<AngularApplication> angularApplicationsCopy = [];
+ List<AngularApplication> angularApplicationsCopy = <AngularApplication>[];
for (AngularApplication application in angularApplicationsCopy) {
if (application.dependsOn(librarySource)) {
Source entryPointSource = application.entryPoint;
@@ -4230,9 +4232,7 @@
* @param oldPartMap the table containing the parts associated with each library
*/
void _removeFromPartsUsingMap(HashMap<Source, List<Source>> oldPartMap) {
- for (MapEntry<Source, List<Source>> entry in getMapEntrySet(oldPartMap)) {
- Source librarySource = entry.getKey();
- List<Source> oldParts = entry.getValue();
+ oldPartMap.forEach((Source librarySource, List<Source> oldParts) {
for (int i = 0; i < oldParts.length; i++) {
Source partSource = oldParts[i];
if (partSource != librarySource) {
@@ -4245,7 +4245,7 @@
}
}
}
- }
+ });
}
/**
@@ -4416,21 +4416,21 @@
}
int consistencyCheckEnd = JavaSystem.nanoTime();
if (changedSources.length > 0 || missingSources.length > 0) {
- PrintStringWriter writer = new PrintStringWriter();
- writer.print("Consistency check took ");
- writer.print((consistencyCheckEnd - consistencyCheckStart) / 1000000.0);
- writer.println(" ms and found");
- writer.print(" ");
- writer.print(changedSources.length);
- writer.println(" inconsistent entries");
- writer.print(" ");
- writer.print(missingSources.length);
- writer.println(" missing sources");
+ StringBuffer buffer = new StringBuffer();
+ buffer.write("Consistency check took ");
+ buffer.write((consistencyCheckEnd - consistencyCheckStart) / 1000000.0);
+ buffer.writeln(" ms and found");
+ buffer.write(" ");
+ buffer.write(changedSources.length);
+ buffer.writeln(" inconsistent entries");
+ buffer.write(" ");
+ buffer.write(missingSources.length);
+ buffer.writeln(" missing sources");
for (Source source in missingSources) {
- writer.print(" ");
- writer.println(source.fullName);
+ buffer.write(" ");
+ buffer.writeln(source.fullName);
}
- _logInformation(writer.toString());
+ _logInformation(buffer.toString());
}
return changedSources.length > 0;
}
@@ -4707,7 +4707,7 @@
_dependencyGraph.addEdge(library, importedLibrary);
}
}
- library.importedLibraries = new List.from(importedLibraries);
+ library.importedLibraries = importedLibraries;
} else {
library.explicitlyImportsCore = false;
ResolvableLibrary importedLibrary = _libraryMap[AnalysisContextImpl_this._coreLibrarySource];
@@ -4745,7 +4745,7 @@
_dependencyGraph.addEdge(library, exportedLibrary);
}
}
- library.exportedLibraries = new List.from(exportedLibraries);
+ library.exportedLibraries = exportedLibraries;
}
}
@@ -5052,7 +5052,7 @@
@override
String toString() {
if (task == null) {
- return "blocked: ${_blocked}";
+ return "blocked: $_blocked";
}
return task.toString();
}
@@ -5101,10 +5101,8 @@
}
@override
- List<AnalysisContextStatistics_CacheRow> get cacheRows {
- Iterable<AnalysisContextStatistics_CacheRow> items = _dataMap.values;
- return new List.from(items);
- }
+ List<AnalysisContextStatistics_CacheRow> get cacheRows
+ => _dataMap.values.toList();
@override
List<CaughtException> get exceptions => new List.from(_exceptions);
@@ -5113,7 +5111,7 @@
List<AnalysisContextStatistics_PartitionData> get partitionData => _partitionData;
@override
- List<Source> get sources => new List.from(_sources);
+ List<Source> get sources => _sources;
void putCacheItem(SourceEntry dartEntry, DataDescriptor descriptor) {
_internalPutCacheItem(dartEntry, descriptor, dartEntry.getState(descriptor));
@@ -5307,38 +5305,34 @@
@override
String toString() {
- JavaStringBuilder builder = new JavaStringBuilder();
- bool needsSeparator = _appendSources(builder, false, AnalysisLevel.ALL);
- needsSeparator = _appendSources(builder, needsSeparator, AnalysisLevel.RESOLVED);
- _appendSources(builder, needsSeparator, AnalysisLevel.NONE);
- return builder.toString();
+ StringBuffer buffer = new StringBuffer();
+ bool needsSeparator = _appendSources(buffer, false, AnalysisLevel.ALL);
+ needsSeparator = _appendSources(buffer, needsSeparator, AnalysisLevel.RESOLVED);
+ _appendSources(buffer, needsSeparator, AnalysisLevel.NONE);
+ return buffer.toString();
}
/**
- * Append sources with the given analysis level, prefixed with a label and possibly a separator.
- *
- * @param builder the builder to which the sources are to be appended
- * @param needsSeparator `true` if a separator is needed before the label
- * @param level the analysis level of the sources to be appended
- * @return `true` if future lists of sources will need a separator
+ * Appendto the given [builder] all sources with the given analysis [level],
+ * prefixed with a label and a separator if [needsSeparator] is `true`.
*/
- bool _appendSources(JavaStringBuilder builder, bool needsSeparator, AnalysisLevel level) {
+ bool _appendSources(StringBuffer buffer, bool needsSeparator, AnalysisLevel level) {
bool first = true;
- for (MapEntry<Source, AnalysisLevel> entry in getMapEntrySet(_analysisMap)) {
- if (entry.getValue() == level) {
+ _analysisMap.forEach((Source source, AnalysisLevel sourceLevel) {
+ if (sourceLevel == level) {
if (first) {
first = false;
if (needsSeparator) {
- builder.append("; ");
+ buffer.write("; ");
}
- builder.append(level);
- builder.append(" ");
+ buffer.write(level);
+ buffer.write(" ");
} else {
- builder.append(", ");
+ buffer.write(", ");
}
- builder.append(entry.getKey().fullName);
+ buffer.write(source.fullName);
}
- }
+ });
return needsSeparator || !first;
}
}
@@ -5942,7 +5936,7 @@
_safelyPerform();
} on AnalysisException catch (exception, stackTrace) {
_thrownException = new CaughtException(exception, stackTrace);
- AnalysisEngine.instance.logger.logInformation2("Task failed: ${taskDescription}", new CaughtException(exception, stackTrace));
+ AnalysisEngine.instance.logger.logInformation2("Task failed: $taskDescription", new CaughtException(exception, stackTrace));
}
return accept(visitor);
}
@@ -6122,7 +6116,7 @@
* Return Dart [Expression]s this Angular expression consists of.
*/
List<Expression> get expressions {
- List<Expression> expressions = [];
+ List<Expression> expressions = <Expression>[];
expressions.add(expression);
for (AngularFormatterNode formatter in formatters) {
expressions.add(formatter.name);
@@ -6321,7 +6315,7 @@
List<AngularElement> _angularElements;
- List<NgProcessor> _processors = [];
+ List<NgProcessor> _processors = <NgProcessor>[];
LibraryElementImpl _libraryElement;
@@ -6333,7 +6327,7 @@
bool _isAngular = false;
- List<LocalVariableElementImpl> _definedVariables = [];
+ List<LocalVariableElementImpl> _definedVariables = <LocalVariableElementImpl>[];
Set<LibraryElement> _injectedLibraries = new Set();
@@ -6378,7 +6372,7 @@
try {
Source templateSource = _context.sourceFactory.forUri2(_source.resolveRelativeUri(parseUriWithException(templateUri)));
if (!_context.exists(templateSource)) {
- templateSource = _context.sourceFactory.resolveUri(_source, "package:${templateUri}");
+ templateSource = _context.sourceFactory.resolveUri(_source, "package:$templateUri");
if (!_context.exists(templateSource)) {
_errorListener.onError(new AnalysisError.con2(angularElement.source, hasTemplate.templateUriOffset, templateUri.length, AngularCode.URI_DOES_NOT_EXIST, [templateUri]));
continue;
@@ -6541,7 +6535,7 @@
List<Token> tokens = _splitAtBar(token);
Expression mainExpression = _parseDartExpressionInToken(tokens[0]);
// parse formatters
- List<AngularFormatterNode> formatters = [];
+ List<AngularFormatterNode> formatters = <AngularFormatterNode>[];
for (int i = 1; i < tokens.length; i++) {
Token formatterToken = tokens[i];
Token barToken = formatterToken;
@@ -6555,7 +6549,7 @@
SimpleIdentifier name = nameExpression as SimpleIdentifier;
formatterToken = name.endToken.next;
// parse arguments
- List<AngularFormatterArgument> arguments = [];
+ List<AngularFormatterArgument> arguments = <AngularFormatterArgument>[];
while (formatterToken.type != TokenType.EOF) {
// skip ":"
Token colonToken = formatterToken;
@@ -6740,15 +6734,15 @@
}
void _parseEmbeddedExpressionsInAttribute(ht.XmlAttributeNode node) {
- List<AngularMoustacheXmlExpression> expressions = [];
+ List<AngularMoustacheXmlExpression> expressions = <AngularMoustacheXmlExpression>[];
_parseEmbeddedExpressions(expressions, node.valueToken);
if (!expressions.isEmpty) {
- node.expressions = new List.from(expressions);
+ node.expressions = expressions;
}
}
void _parseEmbeddedExpressionsInTag(ht.XmlTagNode node) {
- List<AngularMoustacheXmlExpression> expressions = [];
+ List<AngularMoustacheXmlExpression> expressions = <AngularMoustacheXmlExpression>[];
ht.Token token = node.attributeEnd;
ht.Token endToken = node.endToken;
bool inChild = false;
@@ -6768,7 +6762,7 @@
}
token = token.next;
}
- node.expressions = new List.from(expressions);
+ node.expressions = expressions;
}
void _recordDefinedVariable(LocalVariableElementImpl variable) {
@@ -6839,13 +6833,13 @@
_unit.accept(this);
// simulate imports for injects
{
- List<ImportElement> imports = [];
+ List<ImportElement> imports = <ImportElement>[];
for (LibraryElement injectedLibrary in _injectedLibraries) {
ImportElementImpl importElement = new ImportElementImpl(-1);
importElement.importedLibrary = injectedLibrary;
imports.add(importElement);
}
- _libraryElement.imports = new List.from(imports);
+ _libraryElement.imports = imports;
}
}
@@ -6855,7 +6849,7 @@
}
List<Token> _splitAtBar(Token token) {
- List<Token> tokens = [];
+ List<Token> tokens = <Token>[];
tokens.add(token);
while (token.type != TokenType.EOF) {
if (token.type == TokenType.BAR) {
@@ -7431,7 +7425,7 @@
this._errors = errors;
this._lineInfo = lineInfo;
if (lineInfo == null) {
- AnalysisEngine.instance.logger.logInformation2("No line info: ${source}", new JavaException());
+ AnalysisEngine.instance.logger.logInformation2("No line info: $source", new JavaException());
}
}
@@ -7581,29 +7575,29 @@
@override
String toString() {
- JavaStringBuilder builder = new JavaStringBuilder();
- bool needsSeparator = _appendSources(builder, addedSources, false, "addedSources");
- needsSeparator = _appendSources(builder, changedSources, needsSeparator, "changedSources");
- needsSeparator = _appendSources2(builder, _changedContent, needsSeparator, "changedContent");
- needsSeparator = _appendSources2(builder, changedRanges, needsSeparator, "changedRanges");
- needsSeparator = _appendSources(builder, deletedSources, needsSeparator, "deletedSources");
- needsSeparator = _appendSources(builder, removedSources, needsSeparator, "removedSources");
+ StringBuffer buffer = new StringBuffer();
+ bool needsSeparator = _appendSources(buffer, addedSources, false, "addedSources");
+ needsSeparator = _appendSources(buffer, changedSources, needsSeparator, "changedSources");
+ needsSeparator = _appendSources2(buffer, _changedContent, needsSeparator, "changedContent");
+ needsSeparator = _appendSources2(buffer, changedRanges, needsSeparator, "changedRanges");
+ needsSeparator = _appendSources(buffer, deletedSources, needsSeparator, "deletedSources");
+ needsSeparator = _appendSources(buffer, removedSources, needsSeparator, "removedSources");
int count = removedContainers.length;
if (count > 0) {
if (removedSources.isEmpty) {
if (needsSeparator) {
- builder.append("; ");
+ buffer.write("; ");
}
- builder.append("removed: from ");
- builder.append(count);
- builder.append(" containers");
+ buffer.write("removed: from ");
+ buffer.write(count);
+ buffer.write(" containers");
} else {
- builder.append(", and more from ");
- builder.append(count);
- builder.append(" containers");
+ buffer.write(", and more from ");
+ buffer.write(count);
+ buffer.write(" containers");
}
}
- return builder.toString();
+ return buffer.toString();
}
/**
@@ -7616,18 +7610,18 @@
* @param label the label used to prefix the sources
* @return `true` if future lists of sources will need a separator
*/
- bool _appendSources(JavaStringBuilder builder, List<Source> sources, bool needsSeparator, String label) {
+ bool _appendSources(StringBuffer buffer, List<Source> sources, bool needsSeparator, String label) {
if (sources.isEmpty) {
return needsSeparator;
}
if (needsSeparator) {
- builder.append("; ");
+ buffer.write("; ");
}
- builder.append(label);
+ buffer.write(label);
String prefix = " ";
for (Source source in sources) {
- builder.append(prefix);
- builder.append(source.fullName);
+ buffer.write(prefix);
+ buffer.write(source.fullName);
prefix = ", ";
}
return true;
@@ -7643,18 +7637,18 @@
* @param label the label used to prefix the sources
* @return `true` if future lists of sources will need a separator
*/
- bool _appendSources2(JavaStringBuilder builder, HashMap<Source, dynamic> sources, bool needsSeparator, String label) {
+ bool _appendSources2(StringBuffer buffer, HashMap<Source, dynamic> sources, bool needsSeparator, String label) {
if (sources.isEmpty) {
return needsSeparator;
}
if (needsSeparator) {
- builder.append("; ");
+ buffer.write("; ");
}
- builder.append(label);
+ buffer.write(label);
String prefix = " ";
for (Source source in sources.keys.toSet()) {
- builder.append(prefix);
- builder.append(source.fullName);
+ buffer.write(prefix);
+ buffer.write(source.fullName);
prefix = ", ";
}
return true;
@@ -7952,7 +7946,7 @@
if (errors.length == 0) {
return AnalysisError.NO_ERRORS;
}
- return new List.from(errors);
+ return errors;
}
/**
@@ -8010,7 +8004,7 @@
}
state = state._nextState;
}
- return new List.from(result);
+ return result;
}
/**
@@ -8930,7 +8924,7 @@
_content = data.data;
_modificationTime = data.modificationTime;
} catch (exception, stackTrace) {
- throw new AnalysisException("Could not get contents of ${source}", new CaughtException(exception, stackTrace));
+ throw new AnalysisException("Could not get contents of $source", new CaughtException(exception, stackTrace));
}
}
}
@@ -9411,7 +9405,7 @@
Source get source => cache != null ? cache.source : null;
@override
- String get taskDescription => "incremental analysis ${(cache != null ? cache.source : "null")}";
+ String get taskDescription => "incremental analysis ${cache != null ? cache.source : "null"}";
@override
void internalPerform() {
@@ -10688,7 +10682,7 @@
errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.offset, uriLiteral.length, CompileTimeErrorCode.INVALID_URI, [uriContent]));
return null;
}
- throw new RuntimeException(message: "Failed to handle validation code: ${code}");
+ throw new RuntimeException(message: "Failed to handle validation code: $code");
}
/**
@@ -10852,7 +10846,7 @@
_includedSources.add(referencedSource);
}
} else {
- throw new AnalysisException("${runtimeType.toString()} failed to handle a ${directive.runtimeType.toString()}");
+ throw new AnalysisException("$runtimeType failed to handle a ${directive.runtimeType}");
}
}
}
@@ -11258,7 +11252,7 @@
final ht.HtmlUnit _unit;
- List<PolymerTagHtmlElement> _tagHtmlElements = [];
+ List<PolymerTagHtmlElement> _tagHtmlElements = <PolymerTagHtmlElement>[];
ht.XmlTagNode _elementNode;
@@ -11309,18 +11303,18 @@
return;
}
// prepare attribute name tokens
- List<PolymerHtmlUnitBuilder_NameToken> nameTokens = [];
+ List<PolymerHtmlUnitBuilder_NameToken> nameTokens = <PolymerHtmlUnitBuilder_NameToken>[];
{
int index = 0;
int textOffset = attributesAttribute.textOffset;
int nameOffset = -1;
- JavaStringBuilder nameBuilder = new JavaStringBuilder();
+ StringBuffer nameBuffer = new StringBuffer();
while (index < attributesText.length) {
int c = attributesText.codeUnitAt(index++);
if (Character.isWhitespace(c)) {
if (nameOffset != -1) {
- nameTokens.add(new PolymerHtmlUnitBuilder_NameToken(nameOffset, nameBuilder.toString()));
- nameBuilder = new JavaStringBuilder();
+ nameTokens.add(new PolymerHtmlUnitBuilder_NameToken(nameOffset, nameBuffer.toString()));
+ nameBuffer = new StringBuffer();
nameOffset = -1;
}
continue;
@@ -11328,15 +11322,15 @@
if (nameOffset == -1) {
nameOffset = textOffset + index - 1;
}
- nameBuilder.appendChar(c);
+ nameBuffer.writeCharCode(c);
}
if (nameOffset != -1) {
- nameTokens.add(new PolymerHtmlUnitBuilder_NameToken(nameOffset, nameBuilder.toString()));
- nameBuilder = new JavaStringBuilder();
+ nameTokens.add(new PolymerHtmlUnitBuilder_NameToken(nameOffset, nameBuffer.toString()));
+ nameBuffer = new StringBuffer();
}
}
// create attributes for name tokens
- List<PolymerAttributeElement> attributes = [];
+ List<PolymerAttributeElement> attributes = <PolymerAttributeElement>[];
Set<String> definedNames = new Set();
ClassElement classElement = _dartElement.classElement;
for (PolymerHtmlUnitBuilder_NameToken nameToken in nameTokens) {
@@ -11365,7 +11359,7 @@
}
attribute.field = field;
}
- _htmlElement.attributes = new List.from(attributes);
+ _htmlElement.attributes = attributes;
}
void _createTagHtmlElement(ht.XmlTagNode node) {
@@ -11634,16 +11628,15 @@
* @return an array of errors (not `null`, contains no `null`s)
*/
List<AnalysisError> get errors {
- Iterable<MapEntry<Source, HashSet<AnalysisError>>> entrySet = getMapEntrySet(_errors);
- int numEntries = entrySet.length;
+ int numEntries = _errors.length;
if (numEntries == 0) {
return AnalysisError.NO_ERRORS;
}
List<AnalysisError> resultList = new List<AnalysisError>();
- for (MapEntry<Source, HashSet<AnalysisError>> entry in entrySet) {
- resultList.addAll(entry.getValue());
+ for (HashSet<AnalysisError> errors in _errors.values) {
+ resultList.addAll(errors);
}
- return new List.from(resultList);
+ return resultList;
}
/**
@@ -12223,7 +12216,7 @@
ht.HtmlUnit get resolvedUnit => _resolvedUnit;
@override
- String get taskDescription => "resolve as Angular template ${source}";
+ String get taskDescription => "resolve as Angular template $source";
@override
void internalPerform() {
@@ -13178,7 +13171,7 @@
}
CachedResult result = resultMap[CONTENT];
if (result != null && result.state == CacheState.ERROR) {
- String message = "contentState changing from ${result.state} to ${newState}";
+ String message = "contentState changing from ${result.state} to $newState";
InstrumentationBuilder builder = Instrumentation.builder2("SourceEntry-validateStateChange");
builder.data3("message", message);
//builder.data("source", source.getFullName());
@@ -13399,7 +13392,7 @@
@override
String toString() {
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
List<SourcePriority> priorities = SourcePriority.values;
bool needsSeparator = false;
int queueCount = _workQueues.length;
@@ -13407,21 +13400,21 @@
List<Source> queue = _workQueues[i];
if (!queue.isEmpty) {
if (needsSeparator) {
- builder.append("; ");
+ buffer.write("; ");
}
- builder.append(priorities[i]);
- builder.append(": ");
+ buffer.write(priorities[i]);
+ buffer.write(": ");
int queueSize = queue.length;
for (int j = 0; j < queueSize; j++) {
if (j > 0) {
- builder.append(", ");
+ buffer.write(", ");
}
- builder.append(queue[j].fullName);
+ buffer.write(queue[j].fullName);
}
needsSeparator = true;
}
}
- return builder.toString();
+ return buffer.toString();
}
}
diff --git a/pkg/analyzer/lib/src/generated/error.dart b/pkg/analyzer/lib/src/generated/error.dart
index ba84adf..a197646 100644
--- a/pkg/analyzer/lib/src/generated/error.dart
+++ b/pkg/analyzer/lib/src/generated/error.dart
@@ -201,16 +201,16 @@
@override
String toString() {
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append((source != null) ? source.fullName : "<unknown source>");
- builder.append("(");
- builder.append(_offset);
- builder.append("..");
- builder.append(_offset + _length - 1);
- builder.append("): ");
- //builder.append("(" + lineNumber + ":" + columnNumber + "): ");
- builder.append(_message);
- return builder.toString();
+ StringBuffer buffer = new StringBuffer();
+ buffer.write((source != null) ? source.fullName : "<unknown source>");
+ buffer.write("(");
+ buffer.write(_offset);
+ buffer.write("..");
+ buffer.write(_offset + _length - 1);
+ buffer.write("): ");
+ //buffer.write("(" + lineNumber + ":" + columnNumber + "): ");
+ buffer.write(_message);
+ return buffer.toString();
}
}
@@ -357,7 +357,7 @@
ErrorType get type => ErrorType.ANGULAR;
@override
- String get uniqueName => "${runtimeType.toString()}.${name}";
+ String get uniqueName => "$runtimeType.$name";
}
/**
@@ -525,7 +525,7 @@
ErrorType get type => ErrorType.CHECKED_MODE_COMPILE_TIME_ERROR;
@override
- String get uniqueName => "${runtimeType.toString()}.${name}";
+ String get uniqueName => "$runtimeType.$name";
}
/**
@@ -2089,7 +2089,7 @@
ErrorType get type => ErrorType.COMPILE_TIME_ERROR;
@override
- String get uniqueName => "${runtimeType.toString()}.${name}";
+ String get uniqueName => "$runtimeType.$name";
}
/**
@@ -2769,7 +2769,7 @@
ErrorType get type => ErrorType.HINT;
@override
- String get uniqueName => "${runtimeType.toString()}.${name}";
+ String get uniqueName => "$runtimeType.$name";
}
/**
@@ -2830,7 +2830,7 @@
ErrorType get type => ErrorType.STATIC_WARNING;
@override
- String get uniqueName => "${runtimeType.toString()}.${name}";
+ String get uniqueName => "$runtimeType.$name";
}
/**
@@ -2882,7 +2882,7 @@
ErrorType get type => ErrorType.POLYMER;
@override
- String get uniqueName => "${runtimeType.toString()}.${name}";
+ String get uniqueName => "$runtimeType.$name";
}
/**
@@ -3243,7 +3243,7 @@
ErrorType get type => ErrorType.STATIC_TYPE_WARNING;
@override
- String get uniqueName => "${runtimeType.toString()}.${name}";
+ String get uniqueName => "$runtimeType.$name";
}
/**
@@ -4173,7 +4173,7 @@
ErrorType get type => ErrorType.STATIC_WARNING;
@override
- String get uniqueName => "${runtimeType.toString()}.${name}";
+ String get uniqueName => "$runtimeType.$name";
}
/**
@@ -4217,5 +4217,5 @@
ErrorType get type => ErrorType.TODO;
@override
- String get uniqueName => "${runtimeType.toString()}.${name}";
+ String get uniqueName => "$runtimeType.$name";
}
\ No newline at end of file
diff --git a/pkg/analyzer/lib/src/generated/html.dart b/pkg/analyzer/lib/src/generated/html.dart
index 1c2a2d8..41ae5ea 100644
--- a/pkg/analyzer/lib/src/generated/html.dart
+++ b/pkg/analyzer/lib/src/generated/html.dart
@@ -248,7 +248,7 @@
String tag = _tail.lexeme;
for (String str in _passThroughElements) {
if (str == tag) {
- endPassThrough = "</${str}>";
+ endPassThrough = "</$str>";
break;
}
}
@@ -341,17 +341,17 @@
}
class ExpressionVisitor_HtmlUnitUtils_getExpression extends ExpressionVisitor {
- int offset = 0;
+ final int offset;
- List<Expression> result;
+ Expression result;
- ExpressionVisitor_HtmlUnitUtils_getExpression(this.offset, this.result) : super();
+ ExpressionVisitor_HtmlUnitUtils_getExpression(this.offset);
@override
void visitExpression(Expression expression) {
Expression at = HtmlUnitUtils._getExpressionAt(expression, offset);
if (at != null) {
- result[0] = at;
+ result = at;
throw new HtmlUnitUtils_FoundExpressionError();
}
}
@@ -383,7 +383,7 @@
/**
* A set containing the names of tags that do not have a closing tag.
*/
- static Set<String> SELF_CLOSING = new HashSet<String>.from(JavaArrays.asList(<String> [
+ static Set<String> SELF_CLOSING = new HashSet<String>.from(<String>[
"area",
"base",
"basefont",
@@ -396,7 +396,7 @@
"link",
"meta",
"param",
- "!"]));
+ "!"]);
/**
* Given the contents of an embedded expression that occurs at the given offset, parse it as a
@@ -628,11 +628,12 @@
if (htmlUnit == null) {
return null;
}
- List<XmlAttributeNode> result = [null];
+ RecursiveXmlVisitor_HtmlUnitUtils_getAttributeNode visitor
+ = new RecursiveXmlVisitor_HtmlUnitUtils_getAttributeNode(offset);
try {
- htmlUnit.accept(new RecursiveXmlVisitor_HtmlUnitUtils_getAttributeNode(offset, result));
+ htmlUnit.accept(visitor);
} on HtmlUnitUtils_FoundAttributeNodeError catch (e) {
- return result[0];
+ return visitor.result;
}
return null;
}
@@ -678,11 +679,12 @@
if (htmlUnit == null) {
return null;
}
- List<XmlTagNode> result = [null];
+ RecursiveXmlVisitor_HtmlUnitUtils_getEnclosingTagNode visitor
+ = new RecursiveXmlVisitor_HtmlUnitUtils_getEnclosingTagNode(offset);
try {
- htmlUnit.accept(new RecursiveXmlVisitor_HtmlUnitUtils_getEnclosingTagNode(offset, result));
+ htmlUnit.accept(visitor);
} on HtmlUnitUtils_FoundTagNodeError catch (e) {
- return result[0];
+ return visitor.result;
}
return null;
}
@@ -695,12 +697,13 @@
if (htmlUnit == null) {
return null;
}
- List<Expression> result = [null];
+ ExpressionVisitor_HtmlUnitUtils_getExpression visitor
+ = new ExpressionVisitor_HtmlUnitUtils_getExpression(offset);
try {
// TODO(scheglov) this code is very Angular specific
- htmlUnit.accept(new ExpressionVisitor_HtmlUnitUtils_getExpression(offset, result));
+ htmlUnit.accept(visitor);
} on HtmlUnitUtils_FoundExpressionError catch (e) {
- return result[0];
+ return visitor.result;
}
return null;
}
@@ -819,17 +822,17 @@
}
class RecursiveXmlVisitor_HtmlUnitUtils_getAttributeNode extends RecursiveXmlVisitor<Object> {
- int offset = 0;
+ final int offset;
- List<XmlAttributeNode> result;
+ XmlAttributeNode result;
- RecursiveXmlVisitor_HtmlUnitUtils_getAttributeNode(this.offset, this.result) : super();
+ RecursiveXmlVisitor_HtmlUnitUtils_getAttributeNode(this.offset);
@override
Object visitXmlAttributeNode(XmlAttributeNode node) {
Token nameToken = node.nameToken;
if (nameToken.offset <= offset && offset <= nameToken.end) {
- result[0] = node;
+ result = node;
throw new HtmlUnitUtils_FoundAttributeNodeError();
}
return super.visitXmlAttributeNode(node);
@@ -837,16 +840,16 @@
}
class RecursiveXmlVisitor_HtmlUnitUtils_getEnclosingTagNode extends RecursiveXmlVisitor<Object> {
- int offset = 0;
+ final int offset;
- List<XmlTagNode> result;
+ XmlTagNode result;
- RecursiveXmlVisitor_HtmlUnitUtils_getEnclosingTagNode(this.offset, this.result) : super();
+ RecursiveXmlVisitor_HtmlUnitUtils_getEnclosingTagNode(this.offset);
@override
Object visitXmlTagNode(XmlTagNode node) {
if (node.offset <= offset && offset < node.end) {
- result[0] = node;
+ result = node;
super.visitXmlTagNode(node);
throw new HtmlUnitUtils_FoundTagNodeError();
}
@@ -1488,12 +1491,9 @@
}
}
if (children != null) {
- for (JavaIterator iter = new JavaIterator(children); iter.hasNext;) {
- XmlNode node = iter.next();
+ children.forEach((XmlNode node) {
node.parent = this;
- }
- // This will create ArrayList for exactly given number of elements.
- return new List.from(children);
+ });
}
return children;
}
@@ -1501,13 +1501,13 @@
/**
* This method exists for debugging purposes only.
*/
- void _appendIdentifier(JavaStringBuilder builder, XmlNode node) {
+ void _appendIdentifier(StringBuffer buffer, XmlNode node) {
if (node is XmlTagNode) {
- builder.append(node.tag);
+ buffer.write(node.tag);
} else if (node is XmlAttributeNode) {
- builder.append(node.name);
+ buffer.write(node.name);
} else {
- builder.append("htmlUnit");
+ buffer.write("htmlUnit");
}
}
@@ -1515,23 +1515,23 @@
* This method exists for debugging purposes only.
*/
String _buildRecursiveStructureMessage(XmlNode newParent) {
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append("Attempt to create recursive structure: ");
+ StringBuffer buffer = new StringBuffer();
+ buffer.write("Attempt to create recursive structure: ");
XmlNode current = newParent;
while (current != null) {
if (!identical(current, newParent)) {
- builder.append(" -> ");
+ buffer.write(" -> ");
}
if (identical(current, this)) {
- builder.appendChar(0x2A);
- _appendIdentifier(builder, current);
- builder.appendChar(0x2A);
+ buffer.writeCharCode(0x2A);
+ _appendIdentifier(buffer, current);
+ buffer.writeCharCode(0x2A);
} else {
- _appendIdentifier(builder, current);
+ _appendIdentifier(buffer, current);
}
current = current.parent;
}
- return builder.toString();
+ return buffer.toString();
}
/**
@@ -1952,27 +1952,27 @@
Token get beginToken => nodeStart;
/**
- * Answer a string representing the content contained in the receiver. This includes the textual
- * representation of any child tag nodes ([getTagNodes]). Whitespace between '<',
- * '</', and '>', '/>' is discarded, but all other whitespace is preserved.
- *
- * @return the content (not `null`)
+ * Return a string representing the content contained in the receiver. This
+ * includes the textual representation of any child tag nodes ([getTagNodes]).
+ * Whitespace between '<', '</', and '>', '/>' is discarded, but all
+ * other whitespace is preserved.
*/
String get content {
Token token = attributeEnd.next;
if (identical(token, contentEnd)) {
return "";
}
- //TODO (danrubel): handle CDATA and replace HTML character encodings with the actual characters
+ // TODO(danrubel) Handle CDATA and replace HTML character encodings with
+ // the actual characters.
String content = token.lexeme;
token = token.next;
if (identical(token, contentEnd)) {
return content;
}
- JavaStringBuilder buffer = new JavaStringBuilder();
- buffer.append(content);
+ StringBuffer buffer = new StringBuffer();
+ buffer.write(content);
while (!identical(token, contentEnd)) {
- buffer.append(token.lexeme);
+ buffer.write(token.lexeme);
token = token.next;
}
return buffer.toString();
diff --git a/pkg/analyzer/lib/src/generated/java_core.dart b/pkg/analyzer/lib/src/generated/java_core.dart
index 16cfe12..a816069 100644
--- a/pkg/analyzer/lib/src/generated/java_core.dart
+++ b/pkg/analyzer/lib/src/generated/java_core.dart
@@ -1,7 +1,5 @@
library java.core;
-import "dart:math" as math;
-
final Stopwatch nanoTimeStopwatch = new Stopwatch();
const int LONG_MAX_VALUE = 0x7fffffffffffffff;
@@ -51,7 +49,6 @@
}
return result;
}
- static List asList(List list) => list;
}
class Character {
@@ -119,20 +116,6 @@
}
}
-class CharSequence {
- final String _content;
- CharSequence(this._content);
- static CharSequence wrap(String content) => new CharBuffer(content);
- int charAt(int index) => _content.codeUnitAt(index);
- int length() => _content.length;
- String subSequence(int start, int end) => _content.substring(start, end);
-}
-
-class CharBuffer extends CharSequence {
- CharBuffer(String content) : super(content);
- static CharBuffer wrap(String content) => new CharBuffer(content);
-}
-
class JavaString {
static int indexOf(String target, String str, int fromIndex) {
if (fromIndex > target.length) return -1;
@@ -248,6 +231,10 @@
return iter.join(separator);
}
+ static void printf(StringBuffer buffer, String fmt, List args) {
+ buffer.write(_printf(fmt, args));
+ }
+
static String remove(String str, String remove) {
if (isEmpty(str) || isEmpty(remove)) {
return str;
@@ -283,11 +270,6 @@
}
}
-class Math {
- static num max(num a, num b) => math.max(a, b);
- static num min(num a, num b) => math.min(a, b);
-}
-
class RuntimeException extends JavaException {
RuntimeException({String message: "", Exception cause: null}) :
super(message, cause);
@@ -298,7 +280,7 @@
final Exception cause;
JavaException([this.message = "", this.cause = null]);
JavaException.withCause(this.cause) : message = null;
- String toString() => "${runtimeType}: $message $cause";
+ String toString() => "$runtimeType: $message $cause";
}
class JavaIOException extends JavaException {
@@ -361,65 +343,6 @@
MissingFormatArgumentException(this.s);
}
-class JavaIterator<E> {
- Iterable<E> _iterable;
- List<E> _elements = new List<E>();
- int _coPos = 0;
- int _elPos = 0;
- E _current = null;
- JavaIterator(this._iterable) {
- Iterator iterator = _iterable.iterator;
- while (iterator.moveNext()) {
- _elements.add(iterator.current);
- }
- }
-
- bool get hasNext {
- return _elPos < _elements.length;
- }
-
- E next() {
- _current = _elements[_elPos];
- _coPos++;
- _elPos++;
- return _current;
- }
-
- void remove() {
- if (_iterable is List) {
- _coPos--;
- (_iterable as List).remove(_coPos);
- } else if (_iterable is Set) {
- (_iterable as Set).remove(_current);
- } else {
- throw new StateError("Unsupported iterable ${_iterable.runtimeType}");
- }
- }
-}
-
-class MapEntry<K, V> {
- final Map<K, V> _map;
- final K _key;
- V _value;
- MapEntry(this._map, this._key, this._value);
- K getKey() => _key;
- V getValue() => _value;
- V setValue(V v) {
- V prevValue = _value;
- _value = v;
- _map[_key] = v;
- return prevValue;
- }
-}
-
-Iterable<MapEntry> getMapEntrySet(Map m) {
- List<MapEntry> result = [];
- m.forEach((k, v) {
- result.add(new MapEntry(m, k, v));
- });
- return result;
-}
-
javaListSet(List list, int index, newValue) {
var oldValue = list[index];
list[index] = newValue;
@@ -434,12 +357,6 @@
return a.containsAll(b) && b.containsAll(a);
}
-javaMapPut(Map target, key, value) {
- var oldValue = target[key];
- target[key] = value;
- return oldValue;
-}
-
bool javaStringEqualsIgnoreCase(String a, String b) {
return a.toLowerCase() == b.toLowerCase();
}
@@ -454,48 +371,6 @@
return t.substring(toffset, tend) == o.substring(ooffset, oend);
}
-bool javaBooleanOr(bool a, bool b) {
- return a || b;
-}
-
-bool javaBooleanAnd(bool a, bool b) {
- return a && b;
-}
-
-int javaByte(Object o) {
- return (o as int) & 0xFF;
-}
-
-class JavaStringBuilder {
- StringBuffer sb = new StringBuffer();
- String toString() => sb.toString();
- JavaStringBuilder append(x) {
- sb.write(x);
- return this;
- }
- JavaStringBuilder appendChar(int c) {
- sb.writeCharCode(c);
- return this;
- }
- int get length => sb.length;
- void set length(int newLength) {
- if (newLength < 0) {
- throw new StringIndexOutOfBoundsException(newLength);
- }
- if (sb.length < newLength) {
- while (sb.length < newLength) {
- sb.writeCharCode(0);
- }
- } else if (sb.length > newLength) {
- var s = sb.toString().substring(0, newLength);
- sb = new StringBuffer(s);
- }
- }
- void clear() {
- sb = new StringBuffer();
- }
-}
-
abstract class Enum<E extends Enum> implements Comparable<E> {
/// The name of this enum constant, as declared in the enum declaration.
final String name;
diff --git a/pkg/analyzer/lib/src/generated/java_engine.dart b/pkg/analyzer/lib/src/generated/java_engine.dart
index 374586f..0f787cb 100644
--- a/pkg/analyzer/lib/src/generated/java_engine.dart
+++ b/pkg/analyzer/lib/src/generated/java_engine.dart
@@ -40,6 +40,9 @@
if (str == null || str.isEmpty) {
return str;
}
+ if (separator == null) {
+ return str;
+ }
int pos = str.indexOf(separator);
if (pos < 0) {
return str;
@@ -207,24 +210,6 @@
}
}
-class ArrayUtils {
- static List add(List target, Object value) {
- target = new List.from(target);
- target.add(value);
- return target;
- }
- static List addAt(List target, int index, Object value) {
- target = new List.from(target);
- target.insert(index, value);
- return target;
- }
- static List addAll(List target, List source) {
- List result = new List.from(target);
- result.addAll(source);
- return result;
- }
-}
-
class ObjectUtilities {
static int combineHashCodes(int first, int second) => first * 31 + second;
}
diff --git a/pkg/analyzer/lib/src/generated/java_io.dart b/pkg/analyzer/lib/src/generated/java_io.dart
index b2c95e1..66e38d7 100644
--- a/pkg/analyzer/lib/src/generated/java_io.dart
+++ b/pkg/analyzer/lib/src/generated/java_io.dart
@@ -1,7 +1,7 @@
library java.io;
import "dart:io";
-import 'java_core.dart' show JavaIOException, CharSequence;
+import 'java_core.dart' show JavaIOException;
import 'package:path/path.dart' as pathos;
class JavaSystemIO {
diff --git a/pkg/analyzer/lib/src/generated/java_junit.dart b/pkg/analyzer/lib/src/generated/java_junit.dart
deleted file mode 100644
index 6f2c7da..0000000
--- a/pkg/analyzer/lib/src/generated/java_junit.dart
+++ /dev/null
@@ -1,144 +0,0 @@
-library java.junit;
-
-import 'package:unittest/unittest.dart' hide fail;
-import 'package:unittest/unittest.dart' as _ut show fail;
-
-
-class JUnitTestCase {
- void setUp() {}
- void tearDown() {}
- static void fail(String msg) {
- _ut.fail(msg);
- }
- static void assertTrue(bool x) {
- expect(x, isTrue);
- }
- static void assertTrueMsg(String msg, bool x) {
- expect(x, isTrueMsg(msg));
- }
- static void assertFalse(bool x) {
- expect(x, isFalse);
- }
- static void assertFalseMsg(String msg, bool x) {
- expect(x, isFalseMsg(msg));
- }
- static void assertNull(x) {
- expect(x, isNull);
- }
- static void assertNullMsg(String msg, x) {
- expect(x, isNullMsg(msg));
- }
- static void assertNotNull(x) {
- expect(x, isNotNull);
- }
- static void assertNotNullMsg(String msg, x) {
- expect(x, isNotNullMsg(msg));
- }
- static void assertEquals(expected, actual) {
- expect(actual, equals(expected));
- }
- static void assertEqualsMsg(String msg, expected, actual) {
- expect(actual, equalsMsg(msg, expected));
- }
- static void assertSame(expected, actual) {
- expect(actual, same(expected));
- }
- static void assertSameMsg(String msg, expected, actual) {
- expect(actual, sameMsg(msg, expected));
- }
- static void assertNotSame(expected, actual) {
- expect(actual, notSame(expected));
- }
-}
-
-runJUnitTest(testInstance, Function testFunction) {
- testInstance.setUp();
- try {
- testFunction();
- } finally {
- testInstance.tearDown();
- }
-}
-
-/**
- * Returns a matches that matches if the value is not the same instance as "object" (`!==`).
- */
-Matcher notSame(expected) => new _IsNotSameAs(expected);
-
-class _IsNotSameAs extends Matcher {
- final _expected;
- const _IsNotSameAs(this._expected);
- bool matches(item, Map matchState) => !identical(item, _expected);
- Description describe(Description description) =>
- description.add('not same instance as ').addDescriptionOf(_expected);
-}
-
-Matcher equalsMsg(String msg, expected) => new _EqualsWithMessage(msg, expected);
-class _EqualsWithMessage extends Matcher {
- final String msg;
- final expectedValue;
- const _EqualsWithMessage(this.msg, this.expectedValue);
- bool matches(item, Map matchState) {
- return item == expectedValue;
- }
- Description describe(Description mismatchDescription) {
- return mismatchDescription.replace(msg);
- }
-}
-
-Matcher sameMsg(String msg, expected) => new _IsSameAsWithMessage(msg, expected);
-class _IsSameAsWithMessage extends Matcher {
- final String msg;
- final _expected;
- const _IsSameAsWithMessage(this.msg, this._expected);
- bool matches(item, Map matchState) => identical(item, _expected);
- Description describe(Description description) => description.add(msg).addDescriptionOf(_expected);
-}
-
-Matcher isTrueMsg(String msg) => new _IsTrueWithMessage(msg);
-class _IsTrueWithMessage extends Matcher {
- final String msg;
- const _IsTrueWithMessage(this.msg);
- bool matches(item, Map matchState) {
- return item == true;
- }
- Description describe(Description mismatchDescription) {
- return mismatchDescription.replace(msg);
- }
-}
-
-Matcher isFalseMsg(String msg) => new _IsFalseWithMessage(msg);
-class _IsFalseWithMessage extends Matcher {
- final String msg;
- const _IsFalseWithMessage(this.msg);
- bool matches(item, Map matchState) {
- return item == false;
- }
- Description describe(Description mismatchDescription) {
- return mismatchDescription.replace(msg);
- }
-}
-
-Matcher isNullMsg(String msg) => new _IsNullWithMessage(msg);
-class _IsNullWithMessage extends Matcher {
- final String msg;
- const _IsNullWithMessage(this.msg);
- bool matches(item, Map matchState) {
- return item == null;
- }
- Description describe(Description mismatchDescription) {
- return mismatchDescription.replace(msg);
- }
-}
-
-Matcher isNotNullMsg(String msg) => new _IsNotNullWithMessage(msg);
-class _IsNotNullWithMessage extends Matcher {
- final String msg;
- const _IsNotNullWithMessage(this.msg);
- bool matches(item, Map matchState) {
- return item != null;
- }
- Description describe(Description mismatchDescription) {
- return mismatchDescription.replace(msg);
- }
-}
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index c776fb3..a609a4a 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -8,6 +8,8 @@
library engine.parser;
import 'dart:collection';
+import "dart:math" as math;
+
import 'java_core.dart';
import 'java_engine.dart';
import 'instrumentation.dart';
@@ -1171,7 +1173,7 @@
* @param visitedNode the visited node that should have been the parent of the node to be replaced
*/
AstNode _notAChild(AstNode visitedNode) {
- throw new IncrementalParseException.con1("Internal error: the visited node (a ${visitedNode.runtimeType.toString()}) was not the parent of the node to be replaced (a ${_oldNode.runtimeType.toString()})");
+ throw new IncrementalParseException.con1("Internal error: the visited node (a ${visitedNode.runtimeType}) was not the parent of the node to be replaced (a ${_oldNode.runtimeType})");
}
}
@@ -1429,15 +1431,15 @@
@override
String toString() {
- JavaStringBuilder builder = new JavaStringBuilder();
- bool needsSpace = _appendKeyword(builder, false, abstractKeyword);
- needsSpace = _appendKeyword(builder, needsSpace, constKeyword);
- needsSpace = _appendKeyword(builder, needsSpace, externalKeyword);
- needsSpace = _appendKeyword(builder, needsSpace, factoryKeyword);
- needsSpace = _appendKeyword(builder, needsSpace, finalKeyword);
- needsSpace = _appendKeyword(builder, needsSpace, staticKeyword);
- _appendKeyword(builder, needsSpace, varKeyword);
- return builder.toString();
+ StringBuffer buffer = new StringBuffer();
+ bool needsSpace = _appendKeyword(buffer, false, abstractKeyword);
+ needsSpace = _appendKeyword(buffer, needsSpace, constKeyword);
+ needsSpace = _appendKeyword(buffer, needsSpace, externalKeyword);
+ needsSpace = _appendKeyword(buffer, needsSpace, factoryKeyword);
+ needsSpace = _appendKeyword(buffer, needsSpace, finalKeyword);
+ needsSpace = _appendKeyword(buffer, needsSpace, staticKeyword);
+ _appendKeyword(buffer, needsSpace, varKeyword);
+ return buffer.toString();
}
/**
@@ -1449,12 +1451,12 @@
* @param keyword the keyword to be appended
* @return `true` if subsequent keywords need to be prefixed with a space
*/
- bool _appendKeyword(JavaStringBuilder builder, bool needsSpace, Token keyword) {
+ bool _appendKeyword(StringBuffer buffer, bool needsSpace, Token keyword) {
if (keyword != null) {
if (needsSpace) {
- builder.appendChar(0x20);
+ buffer.writeCharCode(0x20);
}
- builder.append(keyword.lexeme);
+ buffer.write(keyword.lexeme);
return true;
}
return needsSpace;
@@ -2827,15 +2829,15 @@
* @param startIndex the index of the first character representing the scalar value
* @param endIndex the index of the last character representing the scalar value
*/
- void _appendScalarValue(JavaStringBuilder builder, String escapeSequence, int scalarValue, int startIndex, int endIndex) {
+ void _appendScalarValue(StringBuffer buffer, String escapeSequence, int scalarValue, int startIndex, int endIndex) {
if (scalarValue < 0 || scalarValue > Character.MAX_CODE_POINT || (scalarValue >= 0xD800 && scalarValue <= 0xDFFF)) {
_reportErrorForCurrentToken(ParserErrorCode.INVALID_CODE_POINT, [escapeSequence]);
return;
}
if (scalarValue < Character.MAX_VALUE) {
- builder.appendChar(scalarValue);
+ buffer.writeCharCode(scalarValue);
} else {
- builder.append(Character.toChars(scalarValue));
+ buffer.write(Character.toChars(scalarValue));
}
}
@@ -2872,18 +2874,18 @@
}
}
if (end - start + 1 < 0) {
- AnalysisEngine.instance.logger.logError("Internal error: computeStringValue(${lexeme}, ${first}, ${last})");
+ AnalysisEngine.instance.logger.logError("Internal error: computeStringValue($lexeme, $first, $last)");
return "";
}
if (isRaw) {
return lexeme.substring(start, end);
}
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
int index = start;
while (index < end) {
- index = _translateCharacter(builder, lexeme, index);
+ index = _translateCharacter(buffer, lexeme, index);
}
- return builder.toString();
+ return buffer.toString();
}
/**
@@ -4526,7 +4528,7 @@
} else {
// Internal error: this method should not have been invoked if the current token was something
// other than one of the above.
- throw new IllegalStateException("parseDirective invoked in an invalid state; currentToken = ${_currentToken}");
+ throw new IllegalStateException("parseDirective invoked in an invalid state; currentToken = $_currentToken");
}
}
@@ -4598,9 +4600,8 @@
if (commentTokens.isEmpty) {
return null;
}
- List<Token> tokens = new List.from(commentTokens);
- List<CommentReference> references = _parseCommentReferences(tokens);
- return Comment.createDocumentationCommentWithReferences(tokens, references);
+ List<CommentReference> references = _parseCommentReferences(commentTokens);
+ return Comment.createDocumentationCommentWithReferences(commentTokens, references);
}
/**
@@ -6442,7 +6443,7 @@
_reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER, []);
components.add(_createSyntheticToken(TokenType.IDENTIFIER));
}
- return new SymbolLiteral(poundSign, new List.from(components));
+ return new SymbolLiteral(poundSign, components);
}
/**
@@ -6885,7 +6886,7 @@
if (token.type == TokenType.EOF) {
token = token.previous;
}
- _reportError(new AnalysisError.con2(_source, token.offset, Math.max(token.length, 1), errorCode, arguments));
+ _reportError(new AnalysisError.con2(_source, token.offset, math.max(token.length, 1), errorCode, arguments));
}
/**
@@ -7366,52 +7367,48 @@
bool _tokenMatchesString(Token token, String identifier) => token.type == TokenType.IDENTIFIER && token.lexeme == identifier;
/**
- * Translate the characters at the given index in the given string, appending the translated
- * character to the given builder. The index is assumed to be valid.
- *
- * @param builder the builder to which the translated character is to be appended
- * @param lexeme the string containing the character(s) to be translated
- * @param index the index of the character to be translated
- * @return the index of the next character to be translated
+ * Translate the characters at the given [index] in the given [lexeme],
+ * appending the translated character to the given [buffer]. The index is
+ * assumed to be valid.
*/
- int _translateCharacter(JavaStringBuilder builder, String lexeme, int index) {
+ int _translateCharacter(StringBuffer buffer, String lexeme, int index) {
int currentChar = lexeme.codeUnitAt(index);
if (currentChar != 0x5C) {
- builder.appendChar(currentChar);
+ buffer.writeCharCode(currentChar);
return index + 1;
}
//
- // We have found an escape sequence, so we parse the string to determine what kind of escape
- // sequence and what character to add to the builder.
+ // We have found an escape sequence, so we parse the string to determine
+ // what kind of escape sequence and what character to add to the builder.
//
int length = lexeme.length;
int currentIndex = index + 1;
if (currentIndex >= length) {
- // Illegal escape sequence: no char after escape
- // This cannot actually happen because it would require the escape character to be the last
- // character in the string, but if it were it would escape the closing quote, leaving the
- // string unclosed.
+ // Illegal escape sequence: no char after escape.
+ // This cannot actually happen because it would require the escape
+ // character to be the last character in the string, but if it were it
+ // would escape the closing quote, leaving the string unclosed.
// reportError(ParserErrorCode.MISSING_CHAR_IN_ESCAPE_SEQUENCE);
return length;
}
currentChar = lexeme.codeUnitAt(currentIndex);
if (currentChar == 0x6E) {
- builder.appendChar(0xA);
+ buffer.writeCharCode(0xA);
// newline
} else if (currentChar == 0x72) {
- builder.appendChar(0xD);
+ buffer.writeCharCode(0xD);
// carriage return
} else if (currentChar == 0x66) {
- builder.appendChar(0xC);
+ buffer.writeCharCode(0xC);
// form feed
} else if (currentChar == 0x62) {
- builder.appendChar(0x8);
+ buffer.writeCharCode(0x8);
// backspace
} else if (currentChar == 0x74) {
- builder.appendChar(0x9);
+ buffer.writeCharCode(0x9);
// tab
} else if (currentChar == 0x76) {
- builder.appendChar(0xB);
+ buffer.writeCharCode(0xB);
// vertical tab
} else if (currentChar == 0x78) {
if (currentIndex + 2 >= length) {
@@ -7425,7 +7422,9 @@
// Illegal escape sequence: invalid hex digit
_reportErrorForCurrentToken(ParserErrorCode.INVALID_HEX_ESCAPE, []);
} else {
- builder.appendChar(((Character.digit(firstDigit, 16) << 4) + Character.digit(secondDigit, 16)));
+ int charCode = (Character.digit(firstDigit, 16) << 4)
+ + Character.digit(secondDigit, 16);
+ buffer.writeCharCode(charCode);
}
return currentIndex + 3;
} else if (currentChar == 0x75) {
@@ -7440,7 +7439,9 @@
currentIndex++;
if (currentIndex >= length) {
// Illegal escape sequence: incomplete escape
- _reportErrorForCurrentToken(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
+ _reportErrorForCurrentToken(
+ ParserErrorCode.INVALID_UNICODE_ESCAPE,
+ []);
return length;
}
currentChar = lexeme.codeUnitAt(currentIndex);
@@ -7449,9 +7450,12 @@
while (currentChar != 0x7D) {
if (!_isHexDigit(currentChar)) {
// Illegal escape sequence: invalid hex digit
- _reportErrorForCurrentToken(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
+ _reportErrorForCurrentToken(
+ ParserErrorCode.INVALID_UNICODE_ESCAPE,
+ []);
currentIndex++;
- while (currentIndex < length && lexeme.codeUnitAt(currentIndex) != 0x7D) {
+ while (currentIndex < length
+ && lexeme.codeUnitAt(currentIndex) != 0x7D) {
currentIndex++;
}
return currentIndex + 1;
@@ -7461,37 +7465,59 @@
currentIndex++;
if (currentIndex >= length) {
// Illegal escape sequence: incomplete escape
- _reportErrorForCurrentToken(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
+ _reportErrorForCurrentToken(
+ ParserErrorCode.INVALID_UNICODE_ESCAPE,
+ []);
return length;
}
currentChar = lexeme.codeUnitAt(currentIndex);
}
if (digitCount < 1 || digitCount > 6) {
// Illegal escape sequence: not enough or too many hex digits
- _reportErrorForCurrentToken(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
+ _reportErrorForCurrentToken(
+ ParserErrorCode.INVALID_UNICODE_ESCAPE,
+ []);
}
- _appendScalarValue(builder, lexeme.substring(index, currentIndex + 1), value, index, currentIndex);
+ _appendScalarValue(
+ buffer,
+ lexeme.substring(index, currentIndex + 1),
+ value,
+ index,
+ currentIndex);
return currentIndex + 1;
} else {
if (currentIndex + 3 >= length) {
// Illegal escape sequence: not enough hex digits
- _reportErrorForCurrentToken(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
+ _reportErrorForCurrentToken(
+ ParserErrorCode.INVALID_UNICODE_ESCAPE,
+ []);
return length;
}
int firstDigit = currentChar;
int secondDigit = lexeme.codeUnitAt(currentIndex + 1);
int thirdDigit = lexeme.codeUnitAt(currentIndex + 2);
int fourthDigit = lexeme.codeUnitAt(currentIndex + 3);
- if (!_isHexDigit(firstDigit) || !_isHexDigit(secondDigit) || !_isHexDigit(thirdDigit) || !_isHexDigit(fourthDigit)) {
+ if (!_isHexDigit(firstDigit)
+ || !_isHexDigit(secondDigit)
+ || !_isHexDigit(thirdDigit)
+ || !_isHexDigit(fourthDigit)) {
// Illegal escape sequence: invalid hex digits
_reportErrorForCurrentToken(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
} else {
- _appendScalarValue(builder, lexeme.substring(index, currentIndex + 1), (((((Character.digit(firstDigit, 16) << 4) + Character.digit(secondDigit, 16)) << 4) + Character.digit(thirdDigit, 16)) << 4) + Character.digit(fourthDigit, 16), index, currentIndex + 3);
+ _appendScalarValue(
+ buffer,
+ lexeme.substring(index, currentIndex + 1),
+ (((((Character.digit(firstDigit, 16) << 4)
+ + Character.digit(secondDigit, 16)) << 4)
+ + Character.digit(thirdDigit, 16)) << 4)
+ + Character.digit(fourthDigit, 16),
+ index,
+ currentIndex + 3);
}
return currentIndex + 4;
}
} else {
- builder.appendChar(currentChar);
+ buffer.writeCharCode(currentChar);
}
return currentIndex + 1;
}
@@ -8299,7 +8325,7 @@
ErrorType get type => ErrorType.SYNTACTIC_ERROR;
@override
- String get uniqueName => "${runtimeType.toString()}.${name}";
+ String get uniqueName => "$runtimeType.$name";
}
/**
@@ -8353,7 +8379,12 @@
@override
bool visitAnnotation(Annotation node) {
Annotation toNode = this._toNode as Annotation;
- if (javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.atSign, toNode.atSign), _isEqualNodes(node.name, toNode.name)), _isEqualTokens(node.period, toNode.period)), _isEqualNodes(node.constructorName, toNode.constructorName)), _isEqualNodes(node.arguments, toNode.arguments))) {
+ if (_and(
+ _isEqualTokens(node.atSign, toNode.atSign),
+ _isEqualNodes(node.name, toNode.name),
+ _isEqualTokens(node.period, toNode.period),
+ _isEqualNodes(node.constructorName, toNode.constructorName),
+ _isEqualNodes(node.arguments, toNode.arguments))) {
toNode.element = node.element;
return true;
}
@@ -8363,13 +8394,19 @@
@override
bool visitArgumentList(ArgumentList node) {
ArgumentList toNode = this._toNode as ArgumentList;
- return javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), _isEqualNodeLists(node.arguments, toNode.arguments)), _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis));
+ return _and(
+ _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
+ _isEqualNodeLists(node.arguments, toNode.arguments),
+ _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis));
}
@override
bool visitAsExpression(AsExpression node) {
AsExpression toNode = this._toNode as AsExpression;
- if (javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.expression, toNode.expression), _isEqualTokens(node.asOperator, toNode.asOperator)), _isEqualNodes(node.type, toNode.type))) {
+ if (_and(
+ _isEqualNodes(node.expression, toNode.expression),
+ _isEqualTokens(node.asOperator, toNode.asOperator),
+ _isEqualNodes(node.type, toNode.type))) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -8380,13 +8417,21 @@
@override
bool visitAssertStatement(AssertStatement node) {
AssertStatement toNode = this._toNode as AssertStatement;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.keyword, toNode.keyword), _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis)), _isEqualNodes(node.condition, toNode.condition)), _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis)), _isEqualTokens(node.semicolon, toNode.semicolon));
+ return _and(
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
+ _isEqualNodes(node.condition, toNode.condition),
+ _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis),
+ _isEqualTokens(node.semicolon, toNode.semicolon));
}
@override
bool visitAssignmentExpression(AssignmentExpression node) {
AssignmentExpression toNode = this._toNode as AssignmentExpression;
- if (javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.leftHandSide, toNode.leftHandSide), _isEqualTokens(node.operator, toNode.operator)), _isEqualNodes(node.rightHandSide, toNode.rightHandSide))) {
+ if (_and(
+ _isEqualNodes(node.leftHandSide, toNode.leftHandSide),
+ _isEqualTokens(node.operator, toNode.operator),
+ _isEqualNodes(node.rightHandSide, toNode.rightHandSide))) {
toNode.propagatedElement = node.propagatedElement;
toNode.propagatedType = node.propagatedType;
toNode.staticElement = node.staticElement;
@@ -8399,13 +8444,18 @@
@override
bool visitAwaitExpression(AwaitExpression node) {
AwaitExpression toNode = this._toNode as AwaitExpression;
- return javaBooleanAnd(_isEqualTokens(node.awaitKeyword, toNode.awaitKeyword), _isEqualNodes(node.expression, toNode.expression));
+ return _and(
+ _isEqualTokens(node.awaitKeyword, toNode.awaitKeyword),
+ _isEqualNodes(node.expression, toNode.expression));
}
@override
bool visitBinaryExpression(BinaryExpression node) {
BinaryExpression toNode = this._toNode as BinaryExpression;
- if (javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.leftOperand, toNode.leftOperand), _isEqualTokens(node.operator, toNode.operator)), _isEqualNodes(node.rightOperand, toNode.rightOperand))) {
+ if (_and(
+ _isEqualNodes(node.leftOperand, toNode.leftOperand),
+ _isEqualTokens(node.operator, toNode.operator),
+ _isEqualNodes(node.rightOperand, toNode.rightOperand))) {
toNode.propagatedElement = node.propagatedElement;
toNode.propagatedType = node.propagatedType;
toNode.staticElement = node.staticElement;
@@ -8418,7 +8468,10 @@
@override
bool visitBlock(Block node) {
Block toNode = this._toNode as Block;
- return javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.leftBracket, toNode.leftBracket), _isEqualNodeLists(node.statements, toNode.statements)), _isEqualTokens(node.rightBracket, toNode.rightBracket));
+ return _and(
+ _isEqualTokens(node.leftBracket, toNode.leftBracket),
+ _isEqualNodeLists(node.statements, toNode.statements),
+ _isEqualTokens(node.rightBracket, toNode.rightBracket));
}
@override
@@ -8430,7 +8483,9 @@
@override
bool visitBooleanLiteral(BooleanLiteral node) {
BooleanLiteral toNode = this._toNode as BooleanLiteral;
- if (javaBooleanAnd(_isEqualTokens(node.literal, toNode.literal), node.value == toNode.value)) {
+ if (_and(
+ _isEqualTokens(node.literal, toNode.literal),
+ node.value == toNode.value)) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -8441,13 +8496,18 @@
@override
bool visitBreakStatement(BreakStatement node) {
BreakStatement toNode = this._toNode as BreakStatement;
- return javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.keyword, toNode.keyword), _isEqualNodes(node.label, toNode.label)), _isEqualTokens(node.semicolon, toNode.semicolon));
+ return _and(
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.label, toNode.label),
+ _isEqualTokens(node.semicolon, toNode.semicolon));
}
@override
bool visitCascadeExpression(CascadeExpression node) {
CascadeExpression toNode = this._toNode as CascadeExpression;
- if (javaBooleanAnd(_isEqualNodes(node.target, toNode.target), _isEqualNodeLists(node.cascadeSections, toNode.cascadeSections))) {
+ if (_and(
+ _isEqualNodes(node.target, toNode.target),
+ _isEqualNodeLists(node.cascadeSections, toNode.cascadeSections))) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -8458,19 +8518,51 @@
@override
bool visitCatchClause(CatchClause node) {
CatchClause toNode = this._toNode as CatchClause;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.onKeyword, toNode.onKeyword), _isEqualNodes(node.exceptionType, toNode.exceptionType)), _isEqualTokens(node.catchKeyword, toNode.catchKeyword)), _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis)), _isEqualNodes(node.exceptionParameter, toNode.exceptionParameter)), _isEqualTokens(node.comma, toNode.comma)), _isEqualNodes(node.stackTraceParameter, toNode.stackTraceParameter)), _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis)), _isEqualNodes(node.body, toNode.body));
+ return _and(
+ _isEqualTokens(node.onKeyword, toNode.onKeyword),
+ _isEqualNodes(node.exceptionType, toNode.exceptionType),
+ _isEqualTokens(node.catchKeyword, toNode.catchKeyword),
+ _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
+ _isEqualNodes(node.exceptionParameter, toNode.exceptionParameter),
+ _isEqualTokens(node.comma, toNode.comma),
+ _isEqualNodes(node.stackTraceParameter, toNode.stackTraceParameter),
+ _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis),
+ _isEqualNodes(node.body, toNode.body));
}
@override
bool visitClassDeclaration(ClassDeclaration node) {
ClassDeclaration toNode = this._toNode as ClassDeclaration;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.abstractKeyword, toNode.abstractKeyword)), _isEqualTokens(node.classKeyword, toNode.classKeyword)), _isEqualNodes(node.name, toNode.name)), _isEqualNodes(node.typeParameters, toNode.typeParameters)), _isEqualNodes(node.extendsClause, toNode.extendsClause)), _isEqualNodes(node.withClause, toNode.withClause)), _isEqualNodes(node.implementsClause, toNode.implementsClause)), _isEqualTokens(node.leftBracket, toNode.leftBracket)), _isEqualNodeLists(node.members, toNode.members)), _isEqualTokens(node.rightBracket, toNode.rightBracket));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.abstractKeyword, toNode.abstractKeyword),
+ _isEqualTokens(node.classKeyword, toNode.classKeyword),
+ _isEqualNodes(node.name, toNode.name),
+ _isEqualNodes(node.typeParameters, toNode.typeParameters),
+ _isEqualNodes(node.extendsClause, toNode.extendsClause),
+ _isEqualNodes(node.withClause, toNode.withClause),
+ _isEqualNodes(node.implementsClause, toNode.implementsClause),
+ _isEqualTokens(node.leftBracket, toNode.leftBracket),
+ _isEqualNodeLists(node.members, toNode.members),
+ _isEqualTokens(node.rightBracket, toNode.rightBracket));
}
@override
bool visitClassTypeAlias(ClassTypeAlias node) {
ClassTypeAlias toNode = this._toNode as ClassTypeAlias;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.keyword, toNode.keyword)), _isEqualNodes(node.name, toNode.name)), _isEqualNodes(node.typeParameters, toNode.typeParameters)), _isEqualTokens(node.equals, toNode.equals)), _isEqualTokens(node.abstractKeyword, toNode.abstractKeyword)), _isEqualNodes(node.superclass, toNode.superclass)), _isEqualNodes(node.withClause, toNode.withClause)), _isEqualNodes(node.implementsClause, toNode.implementsClause)), _isEqualTokens(node.semicolon, toNode.semicolon));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.name, toNode.name),
+ _isEqualNodes(node.typeParameters, toNode.typeParameters),
+ _isEqualTokens(node.equals, toNode.equals),
+ _isEqualTokens(node.abstractKeyword, toNode.abstractKeyword),
+ _isEqualNodes(node.superclass, toNode.superclass),
+ _isEqualNodes(node.withClause, toNode.withClause),
+ _isEqualNodes(node.implementsClause, toNode.implementsClause),
+ _isEqualTokens(node.semicolon, toNode.semicolon));
}
@override
@@ -8482,13 +8574,20 @@
@override
bool visitCommentReference(CommentReference node) {
CommentReference toNode = this._toNode as CommentReference;
- return javaBooleanAnd(_isEqualTokens(node.newKeyword, toNode.newKeyword), _isEqualNodes(node.identifier, toNode.identifier));
+ return _and(
+ _isEqualTokens(node.newKeyword, toNode.newKeyword),
+ _isEqualNodes(node.identifier, toNode.identifier));
}
@override
bool visitCompilationUnit(CompilationUnit node) {
CompilationUnit toNode = this._toNode as CompilationUnit;
- if (javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.beginToken, toNode.beginToken), _isEqualNodes(node.scriptTag, toNode.scriptTag)), _isEqualNodeLists(node.directives, toNode.directives)), _isEqualNodeLists(node.declarations, toNode.declarations)), _isEqualTokens(node.endToken, toNode.endToken))) {
+ if (_and(
+ _isEqualTokens(node.beginToken, toNode.beginToken),
+ _isEqualNodes(node.scriptTag, toNode.scriptTag),
+ _isEqualNodeLists(node.directives, toNode.directives),
+ _isEqualNodeLists(node.declarations, toNode.declarations),
+ _isEqualTokens(node.endToken, toNode.endToken))) {
toNode.element = node.element;
return true;
}
@@ -8498,7 +8597,12 @@
@override
bool visitConditionalExpression(ConditionalExpression node) {
ConditionalExpression toNode = this._toNode as ConditionalExpression;
- if (javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.condition, toNode.condition), _isEqualTokens(node.question, toNode.question)), _isEqualNodes(node.thenExpression, toNode.thenExpression)), _isEqualTokens(node.colon, toNode.colon)), _isEqualNodes(node.elseExpression, toNode.elseExpression))) {
+ if (_and(
+ _isEqualNodes(node.condition, toNode.condition),
+ _isEqualTokens(node.question, toNode.question),
+ _isEqualNodes(node.thenExpression, toNode.thenExpression),
+ _isEqualTokens(node.colon, toNode.colon),
+ _isEqualNodes(node.elseExpression, toNode.elseExpression))) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -8509,7 +8613,20 @@
@override
bool visitConstructorDeclaration(ConstructorDeclaration node) {
ConstructorDeclaration toNode = this._toNode as ConstructorDeclaration;
- if (javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.externalKeyword, toNode.externalKeyword)), _isEqualTokens(node.constKeyword, toNode.constKeyword)), _isEqualTokens(node.factoryKeyword, toNode.factoryKeyword)), _isEqualNodes(node.returnType, toNode.returnType)), _isEqualTokens(node.period, toNode.period)), _isEqualNodes(node.name, toNode.name)), _isEqualNodes(node.parameters, toNode.parameters)), _isEqualTokens(node.separator, toNode.separator)), _isEqualNodeLists(node.initializers, toNode.initializers)), _isEqualNodes(node.redirectedConstructor, toNode.redirectedConstructor)), _isEqualNodes(node.body, toNode.body))) {
+ if (_and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.externalKeyword, toNode.externalKeyword),
+ _isEqualTokens(node.constKeyword, toNode.constKeyword),
+ _isEqualTokens(node.factoryKeyword, toNode.factoryKeyword),
+ _isEqualNodes(node.returnType, toNode.returnType),
+ _isEqualTokens(node.period, toNode.period),
+ _isEqualNodes(node.name, toNode.name),
+ _isEqualNodes(node.parameters, toNode.parameters),
+ _isEqualTokens(node.separator, toNode.separator),
+ _isEqualNodeLists(node.initializers, toNode.initializers),
+ _isEqualNodes(node.redirectedConstructor, toNode.redirectedConstructor),
+ _isEqualNodes(node.body, toNode.body))) {
toNode.element = node.element;
return true;
}
@@ -8519,13 +8636,21 @@
@override
bool visitConstructorFieldInitializer(ConstructorFieldInitializer node) {
ConstructorFieldInitializer toNode = this._toNode as ConstructorFieldInitializer;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.keyword, toNode.keyword), _isEqualTokens(node.period, toNode.period)), _isEqualNodes(node.fieldName, toNode.fieldName)), _isEqualTokens(node.equals, toNode.equals)), _isEqualNodes(node.expression, toNode.expression));
+ return _and(
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualTokens(node.period, toNode.period),
+ _isEqualNodes(node.fieldName, toNode.fieldName),
+ _isEqualTokens(node.equals, toNode.equals),
+ _isEqualNodes(node.expression, toNode.expression));
}
@override
bool visitConstructorName(ConstructorName node) {
ConstructorName toNode = this._toNode as ConstructorName;
- if (javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.type, toNode.type), _isEqualTokens(node.period, toNode.period)), _isEqualNodes(node.name, toNode.name))) {
+ if (_and(
+ _isEqualNodes(node.type, toNode.type),
+ _isEqualTokens(node.period, toNode.period),
+ _isEqualNodes(node.name, toNode.name))) {
toNode.staticElement = node.staticElement;
return true;
}
@@ -8535,31 +8660,52 @@
@override
bool visitContinueStatement(ContinueStatement node) {
ContinueStatement toNode = this._toNode as ContinueStatement;
- return javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.keyword, toNode.keyword), _isEqualNodes(node.label, toNode.label)), _isEqualTokens(node.semicolon, toNode.semicolon));
+ return _and(
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.label, toNode.label),
+ _isEqualTokens(node.semicolon, toNode.semicolon));
}
@override
bool visitDeclaredIdentifier(DeclaredIdentifier node) {
DeclaredIdentifier toNode = this._toNode as DeclaredIdentifier;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.keyword, toNode.keyword)), _isEqualNodes(node.type, toNode.type)), _isEqualNodes(node.identifier, toNode.identifier));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.type, toNode.type),
+ _isEqualNodes(node.identifier, toNode.identifier));
}
@override
bool visitDefaultFormalParameter(DefaultFormalParameter node) {
DefaultFormalParameter toNode = this._toNode as DefaultFormalParameter;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.parameter, toNode.parameter), node.kind == toNode.kind), _isEqualTokens(node.separator, toNode.separator)), _isEqualNodes(node.defaultValue, toNode.defaultValue));
+ return _and(
+ _isEqualNodes(node.parameter, toNode.parameter),
+ node.kind == toNode.kind,
+ _isEqualTokens(node.separator, toNode.separator),
+ _isEqualNodes(node.defaultValue, toNode.defaultValue));
}
@override
bool visitDoStatement(DoStatement node) {
DoStatement toNode = this._toNode as DoStatement;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.doKeyword, toNode.doKeyword), _isEqualNodes(node.body, toNode.body)), _isEqualTokens(node.whileKeyword, toNode.whileKeyword)), _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis)), _isEqualNodes(node.condition, toNode.condition)), _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis)), _isEqualTokens(node.semicolon, toNode.semicolon));
+ return _and(
+ _isEqualTokens(node.doKeyword, toNode.doKeyword),
+ _isEqualNodes(node.body, toNode.body),
+ _isEqualTokens(node.whileKeyword, toNode.whileKeyword),
+ _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
+ _isEqualNodes(node.condition, toNode.condition),
+ _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis),
+ _isEqualTokens(node.semicolon, toNode.semicolon));
}
@override
bool visitDoubleLiteral(DoubleLiteral node) {
DoubleLiteral toNode = this._toNode as DoubleLiteral;
- if (javaBooleanAnd(_isEqualTokens(node.literal, toNode.literal), node.value == toNode.value)) {
+ if (_and(
+ _isEqualTokens(node.literal, toNode.literal),
+ node.value == toNode.value)) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -8582,19 +8728,35 @@
@override
bool visitEnumConstantDeclaration(EnumConstantDeclaration node) {
EnumConstantDeclaration toNode = this._toNode as EnumConstantDeclaration;
- return javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualNodes(node.name, toNode.name));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualNodes(node.name, toNode.name));
}
@override
bool visitEnumDeclaration(EnumDeclaration node) {
EnumDeclaration toNode = this._toNode as EnumDeclaration;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.keyword, toNode.keyword)), _isEqualNodes(node.name, toNode.name)), _isEqualTokens(node.leftBracket, toNode.leftBracket)), _isEqualNodeLists(node.constants, toNode.constants)), _isEqualTokens(node.rightBracket, toNode.rightBracket));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.name, toNode.name),
+ _isEqualTokens(node.leftBracket, toNode.leftBracket),
+ _isEqualNodeLists(node.constants, toNode.constants),
+ _isEqualTokens(node.rightBracket, toNode.rightBracket));
}
@override
bool visitExportDirective(ExportDirective node) {
ExportDirective toNode = this._toNode as ExportDirective;
- if (javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.keyword, toNode.keyword)), _isEqualNodes(node.uri, toNode.uri)), _isEqualNodeLists(node.combinators, toNode.combinators)), _isEqualTokens(node.semicolon, toNode.semicolon))) {
+ if (_and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.uri, toNode.uri),
+ _isEqualNodeLists(node.combinators, toNode.combinators),
+ _isEqualTokens(node.semicolon, toNode.semicolon))) {
toNode.element = node.element;
return true;
}
@@ -8604,55 +8766,102 @@
@override
bool visitExpressionFunctionBody(ExpressionFunctionBody node) {
ExpressionFunctionBody toNode = this._toNode as ExpressionFunctionBody;
- return javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.functionDefinition, toNode.functionDefinition), _isEqualNodes(node.expression, toNode.expression)), _isEqualTokens(node.semicolon, toNode.semicolon));
+ return _and(
+ _isEqualTokens(node.functionDefinition, toNode.functionDefinition),
+ _isEqualNodes(node.expression, toNode.expression),
+ _isEqualTokens(node.semicolon, toNode.semicolon));
}
@override
bool visitExpressionStatement(ExpressionStatement node) {
ExpressionStatement toNode = this._toNode as ExpressionStatement;
- return javaBooleanAnd(_isEqualNodes(node.expression, toNode.expression), _isEqualTokens(node.semicolon, toNode.semicolon));
+ return _and(
+ _isEqualNodes(node.expression, toNode.expression),
+ _isEqualTokens(node.semicolon, toNode.semicolon));
}
@override
bool visitExtendsClause(ExtendsClause node) {
ExtendsClause toNode = this._toNode as ExtendsClause;
- return javaBooleanAnd(_isEqualTokens(node.keyword, toNode.keyword), _isEqualNodes(node.superclass, toNode.superclass));
+ return _and(
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.superclass, toNode.superclass));
}
@override
bool visitFieldDeclaration(FieldDeclaration node) {
FieldDeclaration toNode = this._toNode as FieldDeclaration;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.staticKeyword, toNode.staticKeyword)), _isEqualNodes(node.fields, toNode.fields)), _isEqualTokens(node.semicolon, toNode.semicolon));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.staticKeyword, toNode.staticKeyword),
+ _isEqualNodes(node.fields, toNode.fields),
+ _isEqualTokens(node.semicolon, toNode.semicolon));
}
@override
bool visitFieldFormalParameter(FieldFormalParameter node) {
FieldFormalParameter toNode = this._toNode as FieldFormalParameter;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.keyword, toNode.keyword)), _isEqualNodes(node.type, toNode.type)), _isEqualTokens(node.thisToken, toNode.thisToken)), _isEqualTokens(node.period, toNode.period)), _isEqualNodes(node.identifier, toNode.identifier));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.type, toNode.type),
+ _isEqualTokens(node.thisToken, toNode.thisToken),
+ _isEqualTokens(node.period, toNode.period),
+ _isEqualNodes(node.identifier, toNode.identifier));
}
@override
bool visitForEachStatement(ForEachStatement node) {
ForEachStatement toNode = this._toNode as ForEachStatement;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.forKeyword, toNode.forKeyword), _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis)), _isEqualNodes(node.loopVariable, toNode.loopVariable)), _isEqualTokens(node.inKeyword, toNode.inKeyword)), _isEqualNodes(node.iterator, toNode.iterator)), _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis)), _isEqualNodes(node.body, toNode.body));
+ return _and(
+ _isEqualTokens(node.forKeyword, toNode.forKeyword),
+ _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
+ _isEqualNodes(node.loopVariable, toNode.loopVariable),
+ _isEqualTokens(node.inKeyword, toNode.inKeyword),
+ _isEqualNodes(node.iterator, toNode.iterator),
+ _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis),
+ _isEqualNodes(node.body, toNode.body));
}
@override
bool visitFormalParameterList(FormalParameterList node) {
FormalParameterList toNode = this._toNode as FormalParameterList;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), _isEqualNodeLists(node.parameters, toNode.parameters)), _isEqualTokens(node.leftDelimiter, toNode.leftDelimiter)), _isEqualTokens(node.rightDelimiter, toNode.rightDelimiter)), _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis));
+ return _and(
+ _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
+ _isEqualNodeLists(node.parameters, toNode.parameters),
+ _isEqualTokens(node.leftDelimiter, toNode.leftDelimiter),
+ _isEqualTokens(node.rightDelimiter, toNode.rightDelimiter),
+ _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis));
}
@override
bool visitForStatement(ForStatement node) {
ForStatement toNode = this._toNode as ForStatement;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.forKeyword, toNode.forKeyword), _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis)), _isEqualNodes(node.variables, toNode.variables)), _isEqualNodes(node.initialization, toNode.initialization)), _isEqualTokens(node.leftSeparator, toNode.leftSeparator)), _isEqualNodes(node.condition, toNode.condition)), _isEqualTokens(node.rightSeparator, toNode.rightSeparator)), _isEqualNodeLists(node.updaters, toNode.updaters)), _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis)), _isEqualNodes(node.body, toNode.body));
+ return _and(_isEqualTokens(node.forKeyword, toNode.forKeyword),
+ _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
+ _isEqualNodes(node.variables, toNode.variables),
+ _isEqualNodes(node.initialization, toNode.initialization),
+ _isEqualTokens(node.leftSeparator, toNode.leftSeparator),
+ _isEqualNodes(node.condition, toNode.condition),
+ _isEqualTokens(node.rightSeparator, toNode.rightSeparator),
+ _isEqualNodeLists(node.updaters, toNode.updaters),
+ _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis),
+ _isEqualNodes(node.body, toNode.body));
}
@override
bool visitFunctionDeclaration(FunctionDeclaration node) {
FunctionDeclaration toNode = this._toNode as FunctionDeclaration;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.externalKeyword, toNode.externalKeyword)), _isEqualNodes(node.returnType, toNode.returnType)), _isEqualTokens(node.propertyKeyword, toNode.propertyKeyword)), _isEqualNodes(node.name, toNode.name)), _isEqualNodes(node.functionExpression, toNode.functionExpression));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.externalKeyword, toNode.externalKeyword),
+ _isEqualNodes(node.returnType, toNode.returnType),
+ _isEqualTokens(node.propertyKeyword, toNode.propertyKeyword),
+ _isEqualNodes(node.name, toNode.name),
+ _isEqualNodes(node.functionExpression, toNode.functionExpression));
}
@override
@@ -8664,7 +8873,9 @@
@override
bool visitFunctionExpression(FunctionExpression node) {
FunctionExpression toNode = this._toNode as FunctionExpression;
- if (javaBooleanAnd(_isEqualNodes(node.parameters, toNode.parameters), _isEqualNodes(node.body, toNode.body))) {
+ if (_and(
+ _isEqualNodes(node.parameters, toNode.parameters),
+ _isEqualNodes(node.body, toNode.body))) {
toNode.element = node.element;
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
@@ -8676,7 +8887,9 @@
@override
bool visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
FunctionExpressionInvocation toNode = this._toNode as FunctionExpressionInvocation;
- if (javaBooleanAnd(_isEqualNodes(node.function, toNode.function), _isEqualNodes(node.argumentList, toNode.argumentList))) {
+ if (_and(
+ _isEqualNodes(node.function, toNode.function),
+ _isEqualNodes(node.argumentList, toNode.argumentList))) {
toNode.propagatedElement = node.propagatedElement;
toNode.propagatedType = node.propagatedType;
toNode.staticElement = node.staticElement;
@@ -8689,37 +8902,69 @@
@override
bool visitFunctionTypeAlias(FunctionTypeAlias node) {
FunctionTypeAlias toNode = this._toNode as FunctionTypeAlias;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.keyword, toNode.keyword)), _isEqualNodes(node.returnType, toNode.returnType)), _isEqualNodes(node.name, toNode.name)), _isEqualNodes(node.typeParameters, toNode.typeParameters)), _isEqualNodes(node.parameters, toNode.parameters)), _isEqualTokens(node.semicolon, toNode.semicolon));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.returnType, toNode.returnType),
+ _isEqualNodes(node.name, toNode.name),
+ _isEqualNodes(node.typeParameters, toNode.typeParameters),
+ _isEqualNodes(node.parameters, toNode.parameters),
+ _isEqualTokens(node.semicolon, toNode.semicolon));
}
@override
bool visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
FunctionTypedFormalParameter toNode = this._toNode as FunctionTypedFormalParameter;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualNodes(node.returnType, toNode.returnType)), _isEqualNodes(node.identifier, toNode.identifier)), _isEqualNodes(node.parameters, toNode.parameters));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualNodes(node.returnType, toNode.returnType),
+ _isEqualNodes(node.identifier, toNode.identifier),
+ _isEqualNodes(node.parameters, toNode.parameters));
}
@override
bool visitHideCombinator(HideCombinator node) {
HideCombinator toNode = this._toNode as HideCombinator;
- return javaBooleanAnd(_isEqualTokens(node.keyword, toNode.keyword), _isEqualNodeLists(node.hiddenNames, toNode.hiddenNames));
+ return _and(
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodeLists(node.hiddenNames, toNode.hiddenNames));
}
@override
bool visitIfStatement(IfStatement node) {
IfStatement toNode = this._toNode as IfStatement;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.ifKeyword, toNode.ifKeyword), _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis)), _isEqualNodes(node.condition, toNode.condition)), _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis)), _isEqualNodes(node.thenStatement, toNode.thenStatement)), _isEqualTokens(node.elseKeyword, toNode.elseKeyword)), _isEqualNodes(node.elseStatement, toNode.elseStatement));
+ return _and(
+ _isEqualTokens(node.ifKeyword, toNode.ifKeyword),
+ _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
+ _isEqualNodes(node.condition, toNode.condition),
+ _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis),
+ _isEqualNodes(node.thenStatement, toNode.thenStatement),
+ _isEqualTokens(node.elseKeyword, toNode.elseKeyword),
+ _isEqualNodes(node.elseStatement, toNode.elseStatement));
}
@override
bool visitImplementsClause(ImplementsClause node) {
ImplementsClause toNode = this._toNode as ImplementsClause;
- return javaBooleanAnd(_isEqualTokens(node.keyword, toNode.keyword), _isEqualNodeLists(node.interfaces, toNode.interfaces));
+ return _and(
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodeLists(node.interfaces, toNode.interfaces));
}
@override
bool visitImportDirective(ImportDirective node) {
ImportDirective toNode = this._toNode as ImportDirective;
- if (javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.keyword, toNode.keyword)), _isEqualNodes(node.uri, toNode.uri)), _isEqualTokens(node.asToken, toNode.asToken)), _isEqualNodes(node.prefix, toNode.prefix)), _isEqualNodeLists(node.combinators, toNode.combinators)), _isEqualTokens(node.semicolon, toNode.semicolon))) {
+ if (_and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.uri, toNode.uri),
+ _isEqualTokens(node.asToken, toNode.asToken),
+ _isEqualNodes(node.prefix, toNode.prefix),
+ _isEqualNodeLists(node.combinators, toNode.combinators),
+ _isEqualTokens(node.semicolon, toNode.semicolon))) {
toNode.element = node.element;
return true;
}
@@ -8729,7 +8974,11 @@
@override
bool visitIndexExpression(IndexExpression node) {
IndexExpression toNode = this._toNode as IndexExpression;
- if (javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.target, toNode.target), _isEqualTokens(node.leftBracket, toNode.leftBracket)), _isEqualNodes(node.index, toNode.index)), _isEqualTokens(node.rightBracket, toNode.rightBracket))) {
+ if (_and(
+ _isEqualNodes(node.target, toNode.target),
+ _isEqualTokens(node.leftBracket, toNode.leftBracket),
+ _isEqualNodes(node.index, toNode.index),
+ _isEqualTokens(node.rightBracket, toNode.rightBracket))) {
toNode.auxiliaryElements = node.auxiliaryElements;
toNode.propagatedElement = node.propagatedElement;
toNode.propagatedType = node.propagatedType;
@@ -8743,7 +8992,10 @@
@override
bool visitInstanceCreationExpression(InstanceCreationExpression node) {
InstanceCreationExpression toNode = this._toNode as InstanceCreationExpression;
- if (javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.keyword, toNode.keyword), _isEqualNodes(node.constructorName, toNode.constructorName)), _isEqualNodes(node.argumentList, toNode.argumentList))) {
+ if (_and(
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.constructorName, toNode.constructorName),
+ _isEqualNodes(node.argumentList, toNode.argumentList))) {
toNode.propagatedType = node.propagatedType;
toNode.staticElement = node.staticElement;
toNode.staticType = node.staticType;
@@ -8755,7 +9007,9 @@
@override
bool visitIntegerLiteral(IntegerLiteral node) {
IntegerLiteral toNode = this._toNode as IntegerLiteral;
- if (javaBooleanAnd(_isEqualTokens(node.literal, toNode.literal), identical(node.value, toNode.value))) {
+ if (_and(
+ _isEqualTokens(node.literal, toNode.literal),
+ node.value == toNode.value)) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -8766,19 +9020,28 @@
@override
bool visitInterpolationExpression(InterpolationExpression node) {
InterpolationExpression toNode = this._toNode as InterpolationExpression;
- return javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.leftBracket, toNode.leftBracket), _isEqualNodes(node.expression, toNode.expression)), _isEqualTokens(node.rightBracket, toNode.rightBracket));
+ return _and(
+ _isEqualTokens(node.leftBracket, toNode.leftBracket),
+ _isEqualNodes(node.expression, toNode.expression),
+ _isEqualTokens(node.rightBracket, toNode.rightBracket));
}
@override
bool visitInterpolationString(InterpolationString node) {
InterpolationString toNode = this._toNode as InterpolationString;
- return javaBooleanAnd(_isEqualTokens(node.contents, toNode.contents), node.value == toNode.value);
+ return _and(
+ _isEqualTokens(node.contents, toNode.contents),
+ node.value == toNode.value);
}
@override
bool visitIsExpression(IsExpression node) {
IsExpression toNode = this._toNode as IsExpression;
- if (javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.expression, toNode.expression), _isEqualTokens(node.isOperator, toNode.isOperator)), _isEqualTokens(node.notOperator, toNode.notOperator)), _isEqualNodes(node.type, toNode.type))) {
+ if (_and(
+ _isEqualNodes(node.expression, toNode.expression),
+ _isEqualTokens(node.isOperator, toNode.isOperator),
+ _isEqualTokens(node.notOperator, toNode.notOperator),
+ _isEqualNodes(node.type, toNode.type))) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -8789,19 +9052,28 @@
@override
bool visitLabel(Label node) {
Label toNode = this._toNode as Label;
- return javaBooleanAnd(_isEqualNodes(node.label, toNode.label), _isEqualTokens(node.colon, toNode.colon));
+ return _and(
+ _isEqualNodes(node.label, toNode.label),
+ _isEqualTokens(node.colon, toNode.colon));
}
@override
bool visitLabeledStatement(LabeledStatement node) {
LabeledStatement toNode = this._toNode as LabeledStatement;
- return javaBooleanAnd(_isEqualNodeLists(node.labels, toNode.labels), _isEqualNodes(node.statement, toNode.statement));
+ return _and(
+ _isEqualNodeLists(node.labels, toNode.labels),
+ _isEqualNodes(node.statement, toNode.statement));
}
@override
bool visitLibraryDirective(LibraryDirective node) {
LibraryDirective toNode = this._toNode as LibraryDirective;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.libraryToken, toNode.libraryToken)), _isEqualNodes(node.name, toNode.name)), _isEqualTokens(node.semicolon, toNode.semicolon));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.libraryToken, toNode.libraryToken),
+ _isEqualNodes(node.name, toNode.name),
+ _isEqualTokens(node.semicolon, toNode.semicolon));
}
@override
@@ -8818,7 +9090,12 @@
@override
bool visitListLiteral(ListLiteral node) {
ListLiteral toNode = this._toNode as ListLiteral;
- if (javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.constKeyword, toNode.constKeyword), _isEqualNodes(node.typeArguments, toNode.typeArguments)), _isEqualTokens(node.leftBracket, toNode.leftBracket)), _isEqualNodeLists(node.elements, toNode.elements)), _isEqualTokens(node.rightBracket, toNode.rightBracket))) {
+ if (_and(
+ _isEqualTokens(node.constKeyword, toNode.constKeyword),
+ _isEqualNodes(node.typeArguments, toNode.typeArguments),
+ _isEqualTokens(node.leftBracket, toNode.leftBracket),
+ _isEqualNodeLists(node.elements, toNode.elements),
+ _isEqualTokens(node.rightBracket, toNode.rightBracket))) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -8829,7 +9106,12 @@
@override
bool visitMapLiteral(MapLiteral node) {
MapLiteral toNode = this._toNode as MapLiteral;
- if (javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.constKeyword, toNode.constKeyword), _isEqualNodes(node.typeArguments, toNode.typeArguments)), _isEqualTokens(node.leftBracket, toNode.leftBracket)), _isEqualNodeLists(node.entries, toNode.entries)), _isEqualTokens(node.rightBracket, toNode.rightBracket))) {
+ if (_and(
+ _isEqualTokens(node.constKeyword, toNode.constKeyword),
+ _isEqualNodes(node.typeArguments, toNode.typeArguments),
+ _isEqualTokens(node.leftBracket, toNode.leftBracket),
+ _isEqualNodeLists(node.entries, toNode.entries),
+ _isEqualTokens(node.rightBracket, toNode.rightBracket))) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -8840,19 +9122,36 @@
@override
bool visitMapLiteralEntry(MapLiteralEntry node) {
MapLiteralEntry toNode = this._toNode as MapLiteralEntry;
- return javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.key, toNode.key), _isEqualTokens(node.separator, toNode.separator)), _isEqualNodes(node.value, toNode.value));
+ return _and(
+ _isEqualNodes(node.key, toNode.key),
+ _isEqualTokens(node.separator, toNode.separator),
+ _isEqualNodes(node.value, toNode.value));
}
@override
bool visitMethodDeclaration(MethodDeclaration node) {
MethodDeclaration toNode = this._toNode as MethodDeclaration;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.externalKeyword, toNode.externalKeyword)), _isEqualTokens(node.modifierKeyword, toNode.modifierKeyword)), _isEqualNodes(node.returnType, toNode.returnType)), _isEqualTokens(node.propertyKeyword, toNode.propertyKeyword)), _isEqualTokens(node.propertyKeyword, toNode.propertyKeyword)), _isEqualNodes(node.name, toNode.name)), _isEqualNodes(node.parameters, toNode.parameters)), _isEqualNodes(node.body, toNode.body));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.externalKeyword, toNode.externalKeyword),
+ _isEqualTokens(node.modifierKeyword, toNode.modifierKeyword),
+ _isEqualNodes(node.returnType, toNode.returnType),
+ _isEqualTokens(node.propertyKeyword, toNode.propertyKeyword),
+ _isEqualTokens(node.propertyKeyword, toNode.propertyKeyword),
+ _isEqualNodes(node.name, toNode.name),
+ _isEqualNodes(node.parameters, toNode.parameters),
+ _isEqualNodes(node.body, toNode.body));
}
@override
bool visitMethodInvocation(MethodInvocation node) {
MethodInvocation toNode = this._toNode as MethodInvocation;
- if (javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.target, toNode.target), _isEqualTokens(node.period, toNode.period)), _isEqualNodes(node.methodName, toNode.methodName)), _isEqualNodes(node.argumentList, toNode.argumentList))) {
+ if (_and(
+ _isEqualNodes(node.target, toNode.target),
+ _isEqualTokens(node.period, toNode.period),
+ _isEqualNodes(node.methodName, toNode.methodName),
+ _isEqualNodes(node.argumentList, toNode.argumentList))) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -8863,7 +9162,9 @@
@override
bool visitNamedExpression(NamedExpression node) {
NamedExpression toNode = this._toNode as NamedExpression;
- if (javaBooleanAnd(_isEqualNodes(node.name, toNode.name), _isEqualNodes(node.expression, toNode.expression))) {
+ if (_and(
+ _isEqualNodes(node.name, toNode.name),
+ _isEqualNodes(node.expression, toNode.expression))) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -8874,13 +9175,18 @@
@override
bool visitNativeClause(NativeClause node) {
NativeClause toNode = this._toNode as NativeClause;
- return javaBooleanAnd(_isEqualTokens(node.keyword, toNode.keyword), _isEqualNodes(node.name, toNode.name));
+ return _and(
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.name, toNode.name));
}
@override
bool visitNativeFunctionBody(NativeFunctionBody node) {
NativeFunctionBody toNode = this._toNode as NativeFunctionBody;
- return javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.nativeToken, toNode.nativeToken), _isEqualNodes(node.stringLiteral, toNode.stringLiteral)), _isEqualTokens(node.semicolon, toNode.semicolon));
+ return _and(
+ _isEqualTokens(node.nativeToken, toNode.nativeToken),
+ _isEqualNodes(node.stringLiteral, toNode.stringLiteral),
+ _isEqualTokens(node.semicolon, toNode.semicolon));
}
@override
@@ -8897,7 +9203,10 @@
@override
bool visitParenthesizedExpression(ParenthesizedExpression node) {
ParenthesizedExpression toNode = this._toNode as ParenthesizedExpression;
- if (javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), _isEqualNodes(node.expression, toNode.expression)), _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis))) {
+ if (_and(
+ _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
+ _isEqualNodes(node.expression, toNode.expression),
+ _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis))) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -8908,7 +9217,12 @@
@override
bool visitPartDirective(PartDirective node) {
PartDirective toNode = this._toNode as PartDirective;
- if (javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.partToken, toNode.partToken)), _isEqualNodes(node.uri, toNode.uri)), _isEqualTokens(node.semicolon, toNode.semicolon))) {
+ if (_and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.partToken, toNode.partToken),
+ _isEqualNodes(node.uri, toNode.uri),
+ _isEqualTokens(node.semicolon, toNode.semicolon))) {
toNode.element = node.element;
return true;
}
@@ -8918,7 +9232,13 @@
@override
bool visitPartOfDirective(PartOfDirective node) {
PartOfDirective toNode = this._toNode as PartOfDirective;
- if (javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.partToken, toNode.partToken)), _isEqualTokens(node.ofToken, toNode.ofToken)), _isEqualNodes(node.libraryName, toNode.libraryName)), _isEqualTokens(node.semicolon, toNode.semicolon))) {
+ if (_and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.partToken, toNode.partToken),
+ _isEqualTokens(node.ofToken, toNode.ofToken),
+ _isEqualNodes(node.libraryName, toNode.libraryName),
+ _isEqualTokens(node.semicolon, toNode.semicolon))) {
toNode.element = node.element;
return true;
}
@@ -8928,7 +9248,9 @@
@override
bool visitPostfixExpression(PostfixExpression node) {
PostfixExpression toNode = this._toNode as PostfixExpression;
- if (javaBooleanAnd(_isEqualNodes(node.operand, toNode.operand), _isEqualTokens(node.operator, toNode.operator))) {
+ if (_and(
+ _isEqualNodes(node.operand, toNode.operand),
+ _isEqualTokens(node.operator, toNode.operator))) {
toNode.propagatedElement = node.propagatedElement;
toNode.propagatedType = node.propagatedType;
toNode.staticElement = node.staticElement;
@@ -8941,7 +9263,10 @@
@override
bool visitPrefixedIdentifier(PrefixedIdentifier node) {
PrefixedIdentifier toNode = this._toNode as PrefixedIdentifier;
- if (javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.prefix, toNode.prefix), _isEqualTokens(node.period, toNode.period)), _isEqualNodes(node.identifier, toNode.identifier))) {
+ if (_and(
+ _isEqualNodes(node.prefix, toNode.prefix),
+ _isEqualTokens(node.period, toNode.period),
+ _isEqualNodes(node.identifier, toNode.identifier))) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -8952,7 +9277,9 @@
@override
bool visitPrefixExpression(PrefixExpression node) {
PrefixExpression toNode = this._toNode as PrefixExpression;
- if (javaBooleanAnd(_isEqualTokens(node.operator, toNode.operator), _isEqualNodes(node.operand, toNode.operand))) {
+ if (_and(
+ _isEqualTokens(node.operator, toNode.operator),
+ _isEqualNodes(node.operand, toNode.operand))) {
toNode.propagatedElement = node.propagatedElement;
toNode.propagatedType = node.propagatedType;
toNode.staticElement = node.staticElement;
@@ -8965,7 +9292,10 @@
@override
bool visitPropertyAccess(PropertyAccess node) {
PropertyAccess toNode = this._toNode as PropertyAccess;
- if (javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.target, toNode.target), _isEqualTokens(node.operator, toNode.operator)), _isEqualNodes(node.propertyName, toNode.propertyName))) {
+ if (_and(
+ _isEqualNodes(node.target, toNode.target),
+ _isEqualTokens(node.operator, toNode.operator),
+ _isEqualNodes(node.propertyName, toNode.propertyName))) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -8976,7 +9306,11 @@
@override
bool visitRedirectingConstructorInvocation(RedirectingConstructorInvocation node) {
RedirectingConstructorInvocation toNode = this._toNode as RedirectingConstructorInvocation;
- if (javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.keyword, toNode.keyword), _isEqualTokens(node.period, toNode.period)), _isEqualNodes(node.constructorName, toNode.constructorName)), _isEqualNodes(node.argumentList, toNode.argumentList))) {
+ if (_and(
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualTokens(node.period, toNode.period),
+ _isEqualNodes(node.constructorName, toNode.constructorName),
+ _isEqualNodes(node.argumentList, toNode.argumentList))) {
toNode.staticElement = node.staticElement;
return true;
}
@@ -8997,7 +9331,10 @@
@override
bool visitReturnStatement(ReturnStatement node) {
ReturnStatement toNode = this._toNode as ReturnStatement;
- return javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.keyword, toNode.keyword), _isEqualNodes(node.expression, toNode.expression)), _isEqualTokens(node.semicolon, toNode.semicolon));
+ return _and(
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.expression, toNode.expression),
+ _isEqualTokens(node.semicolon, toNode.semicolon));
}
@override
@@ -9009,13 +9346,20 @@
@override
bool visitShowCombinator(ShowCombinator node) {
ShowCombinator toNode = this._toNode as ShowCombinator;
- return javaBooleanAnd(_isEqualTokens(node.keyword, toNode.keyword), _isEqualNodeLists(node.shownNames, toNode.shownNames));
+ return _and(
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodeLists(node.shownNames, toNode.shownNames));
}
@override
bool visitSimpleFormalParameter(SimpleFormalParameter node) {
SimpleFormalParameter toNode = this._toNode as SimpleFormalParameter;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.keyword, toNode.keyword)), _isEqualNodes(node.type, toNode.type)), _isEqualNodes(node.identifier, toNode.identifier));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.type, toNode.type),
+ _isEqualNodes(node.identifier, toNode.identifier));
}
@override
@@ -9035,7 +9379,9 @@
@override
bool visitSimpleStringLiteral(SimpleStringLiteral node) {
SimpleStringLiteral toNode = this._toNode as SimpleStringLiteral;
- if (javaBooleanAnd(_isEqualTokens(node.literal, toNode.literal), identical(node.value, toNode.value))) {
+ if (_and(
+ _isEqualTokens(node.literal, toNode.literal),
+ node.value == toNode.value)) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -9057,7 +9403,11 @@
@override
bool visitSuperConstructorInvocation(SuperConstructorInvocation node) {
SuperConstructorInvocation toNode = this._toNode as SuperConstructorInvocation;
- if (javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.keyword, toNode.keyword), _isEqualTokens(node.period, toNode.period)), _isEqualNodes(node.constructorName, toNode.constructorName)), _isEqualNodes(node.argumentList, toNode.argumentList))) {
+ if (_and(
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualTokens(node.period, toNode.period),
+ _isEqualNodes(node.constructorName, toNode.constructorName),
+ _isEqualNodes(node.argumentList, toNode.argumentList))) {
toNode.staticElement = node.staticElement;
return true;
}
@@ -9078,25 +9428,43 @@
@override
bool visitSwitchCase(SwitchCase node) {
SwitchCase toNode = this._toNode as SwitchCase;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodeLists(node.labels, toNode.labels), _isEqualTokens(node.keyword, toNode.keyword)), _isEqualNodes(node.expression, toNode.expression)), _isEqualTokens(node.colon, toNode.colon)), _isEqualNodeLists(node.statements, toNode.statements));
+ return _and(
+ _isEqualNodeLists(node.labels, toNode.labels),
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.expression, toNode.expression),
+ _isEqualTokens(node.colon, toNode.colon),
+ _isEqualNodeLists(node.statements, toNode.statements));
}
@override
bool visitSwitchDefault(SwitchDefault node) {
SwitchDefault toNode = this._toNode as SwitchDefault;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodeLists(node.labels, toNode.labels), _isEqualTokens(node.keyword, toNode.keyword)), _isEqualTokens(node.colon, toNode.colon)), _isEqualNodeLists(node.statements, toNode.statements));
+ return _and(
+ _isEqualNodeLists(node.labels, toNode.labels),
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualTokens(node.colon, toNode.colon),
+ _isEqualNodeLists(node.statements, toNode.statements));
}
@override
bool visitSwitchStatement(SwitchStatement node) {
SwitchStatement toNode = this._toNode as SwitchStatement;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.keyword, toNode.keyword), _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis)), _isEqualNodes(node.expression, toNode.expression)), _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis)), _isEqualTokens(node.leftBracket, toNode.leftBracket)), _isEqualNodeLists(node.members, toNode.members)), _isEqualTokens(node.rightBracket, toNode.rightBracket));
+ return _and(
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
+ _isEqualNodes(node.expression, toNode.expression),
+ _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis),
+ _isEqualTokens(node.leftBracket, toNode.leftBracket),
+ _isEqualNodeLists(node.members, toNode.members),
+ _isEqualTokens(node.rightBracket, toNode.rightBracket));
}
@override
bool visitSymbolLiteral(SymbolLiteral node) {
SymbolLiteral toNode = this._toNode as SymbolLiteral;
- if (javaBooleanAnd(_isEqualTokens(node.poundSign, toNode.poundSign), _isEqualTokenLists(node.components, toNode.components))) {
+ if (_and(
+ _isEqualTokens(node.poundSign, toNode.poundSign),
+ _isEqualTokenLists(node.components, toNode.components))) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -9118,7 +9486,9 @@
@override
bool visitThrowExpression(ThrowExpression node) {
ThrowExpression toNode = this._toNode as ThrowExpression;
- if (javaBooleanAnd(_isEqualTokens(node.keyword, toNode.keyword), _isEqualNodes(node.expression, toNode.expression))) {
+ if (_and(
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.expression, toNode.expression))) {
toNode.propagatedType = node.propagatedType;
toNode.staticType = node.staticType;
return true;
@@ -9129,25 +9499,39 @@
@override
bool visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
TopLevelVariableDeclaration toNode = this._toNode as TopLevelVariableDeclaration;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualNodes(node.variables, toNode.variables)), _isEqualTokens(node.semicolon, toNode.semicolon));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualNodes(node.variables, toNode.variables),
+ _isEqualTokens(node.semicolon, toNode.semicolon));
}
@override
bool visitTryStatement(TryStatement node) {
TryStatement toNode = this._toNode as TryStatement;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.tryKeyword, toNode.tryKeyword), _isEqualNodes(node.body, toNode.body)), _isEqualNodeLists(node.catchClauses, toNode.catchClauses)), _isEqualTokens(node.finallyKeyword, toNode.finallyKeyword)), _isEqualNodes(node.finallyBlock, toNode.finallyBlock));
+ return _and(
+ _isEqualTokens(node.tryKeyword, toNode.tryKeyword),
+ _isEqualNodes(node.body, toNode.body),
+ _isEqualNodeLists(node.catchClauses, toNode.catchClauses),
+ _isEqualTokens(node.finallyKeyword, toNode.finallyKeyword),
+ _isEqualNodes(node.finallyBlock, toNode.finallyBlock));
}
@override
bool visitTypeArgumentList(TypeArgumentList node) {
TypeArgumentList toNode = this._toNode as TypeArgumentList;
- return javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.leftBracket, toNode.leftBracket), _isEqualNodeLists(node.arguments, toNode.arguments)), _isEqualTokens(node.rightBracket, toNode.rightBracket));
+ return _and(
+ _isEqualTokens(node.leftBracket, toNode.leftBracket),
+ _isEqualNodeLists(node.arguments, toNode.arguments),
+ _isEqualTokens(node.rightBracket, toNode.rightBracket));
}
@override
bool visitTypeName(TypeName node) {
TypeName toNode = this._toNode as TypeName;
- if (javaBooleanAnd(_isEqualNodes(node.name, toNode.name), _isEqualNodes(node.typeArguments, toNode.typeArguments))) {
+ if (_and(
+ _isEqualNodes(node.name, toNode.name),
+ _isEqualNodes(node.typeArguments, toNode.typeArguments))) {
toNode.type = node.type;
return true;
}
@@ -9157,49 +9541,89 @@
@override
bool visitTypeParameter(TypeParameter node) {
TypeParameter toNode = this._toNode as TypeParameter;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualNodes(node.name, toNode.name)), _isEqualTokens(node.keyword, toNode.keyword)), _isEqualNodes(node.bound, toNode.bound));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualNodes(node.name, toNode.name),
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.bound, toNode.bound));
}
@override
bool visitTypeParameterList(TypeParameterList node) {
TypeParameterList toNode = this._toNode as TypeParameterList;
- return javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.leftBracket, toNode.leftBracket), _isEqualNodeLists(node.typeParameters, toNode.typeParameters)), _isEqualTokens(node.rightBracket, toNode.rightBracket));
+ return _and(
+ _isEqualTokens(node.leftBracket, toNode.leftBracket),
+ _isEqualNodeLists(node.typeParameters, toNode.typeParameters),
+ _isEqualTokens(node.rightBracket, toNode.rightBracket));
}
@override
bool visitVariableDeclaration(VariableDeclaration node) {
VariableDeclaration toNode = this._toNode as VariableDeclaration;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualNodes(node.name, toNode.name)), _isEqualTokens(node.equals, toNode.equals)), _isEqualNodes(node.initializer, toNode.initializer));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualNodes(node.name, toNode.name),
+ _isEqualTokens(node.equals, toNode.equals),
+ _isEqualNodes(node.initializer, toNode.initializer));
}
@override
bool visitVariableDeclarationList(VariableDeclarationList node) {
VariableDeclarationList toNode = this._toNode as VariableDeclarationList;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists(node.metadata, toNode.metadata)), _isEqualTokens(node.keyword, toNode.keyword)), _isEqualNodes(node.type, toNode.type)), _isEqualNodeLists(node.variables, toNode.variables));
+ return _and(
+ _isEqualNodes(node.documentationComment, toNode.documentationComment),
+ _isEqualNodeLists(node.metadata, toNode.metadata),
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualNodes(node.type, toNode.type),
+ _isEqualNodeLists(node.variables, toNode.variables));
}
@override
bool visitVariableDeclarationStatement(VariableDeclarationStatement node) {
VariableDeclarationStatement toNode = this._toNode as VariableDeclarationStatement;
- return javaBooleanAnd(_isEqualNodes(node.variables, toNode.variables), _isEqualTokens(node.semicolon, toNode.semicolon));
+ return _and(
+ _isEqualNodes(node.variables, toNode.variables),
+ _isEqualTokens(node.semicolon, toNode.semicolon));
}
@override
bool visitWhileStatement(WhileStatement node) {
WhileStatement toNode = this._toNode as WhileStatement;
- return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.keyword, toNode.keyword), _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis)), _isEqualNodes(node.condition, toNode.condition)), _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis)), _isEqualNodes(node.body, toNode.body));
+ return _and(
+ _isEqualTokens(node.keyword, toNode.keyword),
+ _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
+ _isEqualNodes(node.condition, toNode.condition),
+ _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis),
+ _isEqualNodes(node.body, toNode.body));
}
@override
bool visitWithClause(WithClause node) {
WithClause toNode = this._toNode as WithClause;
- return javaBooleanAnd(_isEqualTokens(node.withKeyword, toNode.withKeyword), _isEqualNodeLists(node.mixinTypes, toNode.mixinTypes));
+ return _and(
+ _isEqualTokens(node.withKeyword, toNode.withKeyword),
+ _isEqualNodeLists(node.mixinTypes, toNode.mixinTypes));
}
@override
bool visitYieldStatement(YieldStatement node) {
YieldStatement toNode = this._toNode as YieldStatement;
- return javaBooleanAnd(javaBooleanAnd(_isEqualTokens(node.yieldKeyword, toNode.yieldKeyword), _isEqualNodes(node.expression, toNode.expression)), _isEqualTokens(node.semicolon, toNode.semicolon));
+ return _and(
+ _isEqualTokens(node.yieldKeyword, toNode.yieldKeyword),
+ _isEqualNodes(node.expression, toNode.expression),
+ _isEqualTokens(node.semicolon, toNode.semicolon));
+ }
+
+ /**
+ * Return `true` if all of the parameters are `true`.
+ */
+ bool _and(bool b1, bool b2, [bool b3 = true, bool b4 = true, bool b5 = true,
+ bool b6 = true, bool b7 = true, bool b8 = true, bool b9 = true,
+ bool b10 = true, bool b11 = true, bool b12 = true, bool b13 = true]) {
+ return b1 && b2 && b3 && b4 && b5 && b6 && b7 && b8 && b9 && b10 && b11
+ && b12 && b13;
}
/**
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 1717d76..c1c4bed 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -8,6 +8,8 @@
library engine.resolver;
import 'dart:collection';
+import "dart:math" as math;
+
import 'java_core.dart';
import 'java_engine.dart';
import 'instrumentation.dart';
@@ -422,10 +424,10 @@
* Parses [AngularPropertyElement]s from [annotation] and [classDeclaration].
*/
List<AngularPropertyElement> _parseComponentProperties() {
- List<AngularPropertyElement> properties = [];
+ List<AngularPropertyElement> properties = <AngularPropertyElement>[];
_parseComponentProperties_fromMap(properties);
_parseComponentProperties_fromFields(properties);
- return new List.from(properties);
+ return properties;
}
/**
@@ -611,9 +613,9 @@
}
List<AngularScopePropertyElement> _parseScopeProperties() {
- List<AngularScopePropertyElement> properties = [];
+ List<AngularScopePropertyElement> properties = <AngularScopePropertyElement>[];
_classDeclaration.accept(new RecursiveAstVisitor_AngularCompilationUnitBuilder_parseScopeProperties(properties));
- return new List.from(properties);
+ return properties;
}
/**
@@ -621,10 +623,10 @@
* where <code>view</code> is <code>ViewFactory</code>.
*/
void _parseViews() {
- List<AngularViewElement> views = [];
+ List<AngularViewElement> views = <AngularViewElement>[];
_unit.accept(new RecursiveAstVisitor_AngularCompilationUnitBuilder_parseViews(views));
if (!views.isEmpty) {
- List<AngularViewElement> viewArray = new List.from(views);
+ List<AngularViewElement> viewArray = views;
(_unit.element as CompilationUnitElementImpl).angularViews = viewArray;
}
}
@@ -976,7 +978,9 @@
}
bool problemReported = false;
for (Expression argument in argumentList.arguments) {
- problemReported = javaBooleanOr(problemReported, _checkForArgumentTypeNotAssignableForArgument(argument));
+ if (_checkForArgumentTypeNotAssignableForArgument(argument)) {
+ problemReported = true;
+ }
}
return problemReported;
}
@@ -999,7 +1003,7 @@
ConstructorElement constructorElement = element;
displayName = constructorElement.enclosingElement.displayName;
if (!constructorElement.displayName.isEmpty) {
- displayName = "${displayName}.${constructorElement.displayName}";
+ displayName = "$displayName.${constructorElement.displayName}";
}
}
_errorReporter.reportErrorForNode(HintCode.DEPRECATED_MEMBER_USE, node, [displayName]);
@@ -3371,17 +3375,17 @@
}
ParameterElement element = parameters == null ? null : _findIdentifier(parameters, parameterName);
if (element == null) {
- PrintStringWriter writer = new PrintStringWriter();
- writer.println("Invalid state found in the Analysis Engine:");
- writer.println("DeclarationResolver.getElementForParameter() is visiting a parameter that does not appear to be in a method or function.");
- writer.println("Ancestors:");
+ StringBuffer buffer = new StringBuffer();
+ buffer.writeln("Invalid state found in the Analysis Engine:");
+ buffer.writeln("DeclarationResolver.getElementForParameter() is visiting a parameter that does not appear to be in a method or function.");
+ buffer.writeln("Ancestors:");
AstNode parent = node.parent;
while (parent != null) {
- writer.println(parent.runtimeType.toString());
- writer.println("---------");
+ buffer.writeln(parent.runtimeType.toString());
+ buffer.writeln("---------");
parent = parent.parent;
}
- AnalysisEngine.instance.logger.logError2(writer.toString(), new CaughtException(new AnalysisException(), null));
+ AnalysisEngine.instance.logger.logError2(buffer.toString(), new CaughtException(new AnalysisException(), null));
}
return element;
}
@@ -3985,13 +3989,13 @@
} catch (ex) {
if (node.name.staticElement == null) {
ClassDeclaration classNode = node.getAncestor((node) => node is ClassDeclaration);
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append("The element for the method ");
- builder.append(node.name);
- builder.append(" in ");
- builder.append(classNode.name);
- builder.append(" was not set while trying to build the element model.");
- AnalysisEngine.instance.logger.logError2(builder.toString(), new AnalysisException(builder.toString(), new CaughtException(ex, null)));
+ StringBuffer buffer = new StringBuffer();
+ buffer.write("The element for the method ");
+ buffer.write(node.name);
+ buffer.write(" in ");
+ buffer.write(classNode.name);
+ buffer.write(" was not set while trying to build the element model.");
+ AnalysisEngine.instance.logger.logError2(buffer.toString(), new AnalysisException(buffer.toString(), new CaughtException(ex, null)));
} else {
String message = "Exception caught in ElementBuilder.visitMethodDeclaration()";
AnalysisEngine.instance.logger.logError2(message, new AnalysisException(message, new CaughtException(ex, null)));
@@ -3999,13 +4003,13 @@
} finally {
if (node.name.staticElement == null) {
ClassDeclaration classNode = node.getAncestor((node) => node is ClassDeclaration);
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append("The element for the method ");
- builder.append(node.name);
- builder.append(" in ");
- builder.append(classNode.name);
- builder.append(" was not set while trying to resolve types.");
- AnalysisEngine.instance.logger.logError2(builder.toString(), new CaughtException(new AnalysisException(builder.toString()), null));
+ StringBuffer buffer = new StringBuffer();
+ buffer.write("The element for the method ");
+ buffer.write(node.name);
+ buffer.write(" in ");
+ buffer.write(classNode.name);
+ buffer.write(" was not set while trying to resolve types.");
+ AnalysisEngine.instance.logger.logError2(buffer.toString(), new CaughtException(new AnalysisException(buffer.toString()), null));
}
}
return null;
@@ -4298,7 +4302,7 @@
List<LabelElement> _labels;
- List<VariableElement> _localVariables;
+ List<LocalVariableElement> _localVariables;
List<MethodElement> _methods;
@@ -4356,7 +4360,7 @@
void addLocalVariable(LocalVariableElement element) {
if (_localVariables == null) {
- _localVariables = new List<VariableElement>();
+ _localVariables = new List<LocalVariableElement>();
}
_localVariables.add(element);
}
@@ -4407,7 +4411,7 @@
if (_accessors == null) {
return PropertyAccessorElementImpl.EMPTY_ARRAY;
}
- List<PropertyAccessorElement> result = new List.from(_accessors);
+ List<PropertyAccessorElement> result = _accessors;
_accessors = null;
return result;
}
@@ -4416,7 +4420,7 @@
if (_constructors == null) {
return ConstructorElementImpl.EMPTY_ARRAY;
}
- List<ConstructorElement> result = new List.from(_constructors);
+ List<ConstructorElement> result = _constructors;
_constructors = null;
return result;
}
@@ -4425,7 +4429,7 @@
if (_enums == null) {
return ClassElementImpl.EMPTY_ARRAY;
}
- List<ClassElement> result = new List.from(_enums);
+ List<ClassElement> result = _enums;
_enums = null;
return result;
}
@@ -4446,7 +4450,7 @@
if (_fields == null) {
return FieldElementImpl.EMPTY_ARRAY;
}
- List<FieldElement> result = new List.from(_fields);
+ List<FieldElement> result = _fields;
_fields = null;
return result;
}
@@ -4455,7 +4459,7 @@
if (_fields == null) {
return FieldElementImpl.EMPTY_ARRAY;
}
- List<FieldElement> result = new List.from(_fields);
+ List<FieldElement> result = _fields;
return result;
}
@@ -4463,7 +4467,7 @@
if (_functions == null) {
return FunctionElementImpl.EMPTY_ARRAY;
}
- List<FunctionElement> result = new List.from(_functions);
+ List<FunctionElement> result = _functions;
_functions = null;
return result;
}
@@ -4472,7 +4476,7 @@
if (_labels == null) {
return LabelElementImpl.EMPTY_ARRAY;
}
- List<LabelElement> result = new List.from(_labels);
+ List<LabelElement> result = _labels;
_labels = null;
return result;
}
@@ -4481,7 +4485,7 @@
if (_localVariables == null) {
return LocalVariableElementImpl.EMPTY_ARRAY;
}
- List<LocalVariableElement> result = new List.from(_localVariables);
+ List<LocalVariableElement> result = _localVariables;
_localVariables = null;
return result;
}
@@ -4490,7 +4494,7 @@
if (_methods == null) {
return MethodElementImpl.EMPTY_ARRAY;
}
- List<MethodElement> result = new List.from(_methods);
+ List<MethodElement> result = _methods;
_methods = null;
return result;
}
@@ -4499,7 +4503,7 @@
if (_parameters == null) {
return ParameterElementImpl.EMPTY_ARRAY;
}
- List<ParameterElement> result = new List.from(_parameters);
+ List<ParameterElement> result = _parameters;
_parameters = null;
return result;
}
@@ -4520,7 +4524,7 @@
if (_topLevelVariables == null) {
return TopLevelVariableElementImpl.EMPTY_ARRAY;
}
- List<TopLevelVariableElement> result = new List.from(_topLevelVariables);
+ List<TopLevelVariableElement> result = _topLevelVariables;
_topLevelVariables = null;
return result;
}
@@ -4529,7 +4533,7 @@
if (_typeAliases == null) {
return FunctionTypeAliasElementImpl.EMPTY_ARRAY;
}
- List<FunctionTypeAliasElement> result = new List.from(_typeAliases);
+ List<FunctionTypeAliasElement> result = _typeAliases;
_typeAliases = null;
return result;
}
@@ -4538,7 +4542,7 @@
if (_typeParameters == null) {
return TypeParameterElementImpl.EMPTY_ARRAY;
}
- List<TypeParameterElement> result = new List.from(_typeParameters);
+ List<TypeParameterElement> result = _typeParameters;
_typeParameters = null;
return result;
}
@@ -4547,96 +4551,96 @@
if (_types == null) {
return ClassElementImpl.EMPTY_ARRAY;
}
- List<ClassElement> result = new List.from(_types);
+ List<ClassElement> result = _types;
_types = null;
return result;
}
void validate() {
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
if (_accessors != null) {
- builder.append(_accessors.length);
- builder.append(" accessors");
+ buffer.write(_accessors.length);
+ buffer.write(" accessors");
}
if (_constructors != null) {
- if (builder.length > 0) {
- builder.append("; ");
+ if (buffer.length > 0) {
+ buffer.write("; ");
}
- builder.append(_constructors.length);
- builder.append(" constructors");
+ buffer.write(_constructors.length);
+ buffer.write(" constructors");
}
if (_fields != null) {
- if (builder.length > 0) {
- builder.append("; ");
+ if (buffer.length > 0) {
+ buffer.write("; ");
}
- builder.append(_fields.length);
- builder.append(" fields");
+ buffer.write(_fields.length);
+ buffer.write(" fields");
}
if (_functions != null) {
- if (builder.length > 0) {
- builder.append("; ");
+ if (buffer.length > 0) {
+ buffer.write("; ");
}
- builder.append(_functions.length);
- builder.append(" functions");
+ buffer.write(_functions.length);
+ buffer.write(" functions");
}
if (_labels != null) {
- if (builder.length > 0) {
- builder.append("; ");
+ if (buffer.length > 0) {
+ buffer.write("; ");
}
- builder.append(_labels.length);
- builder.append(" labels");
+ buffer.write(_labels.length);
+ buffer.write(" labels");
}
if (_localVariables != null) {
- if (builder.length > 0) {
- builder.append("; ");
+ if (buffer.length > 0) {
+ buffer.write("; ");
}
- builder.append(_localVariables.length);
- builder.append(" local variables");
+ buffer.write(_localVariables.length);
+ buffer.write(" local variables");
}
if (_methods != null) {
- if (builder.length > 0) {
- builder.append("; ");
+ if (buffer.length > 0) {
+ buffer.write("; ");
}
- builder.append(_methods.length);
- builder.append(" methods");
+ buffer.write(_methods.length);
+ buffer.write(" methods");
}
if (_parameters != null) {
- if (builder.length > 0) {
- builder.append("; ");
+ if (buffer.length > 0) {
+ buffer.write("; ");
}
- builder.append(_parameters.length);
- builder.append(" parameters");
+ buffer.write(_parameters.length);
+ buffer.write(" parameters");
}
if (_topLevelVariables != null) {
- if (builder.length > 0) {
- builder.append("; ");
+ if (buffer.length > 0) {
+ buffer.write("; ");
}
- builder.append(_topLevelVariables.length);
- builder.append(" top-level variables");
+ buffer.write(_topLevelVariables.length);
+ buffer.write(" top-level variables");
}
if (_types != null) {
- if (builder.length > 0) {
- builder.append("; ");
+ if (buffer.length > 0) {
+ buffer.write("; ");
}
- builder.append(_types.length);
- builder.append(" types");
+ buffer.write(_types.length);
+ buffer.write(" types");
}
if (_typeAliases != null) {
- if (builder.length > 0) {
- builder.append("; ");
+ if (buffer.length > 0) {
+ buffer.write("; ");
}
- builder.append(_typeAliases.length);
- builder.append(" type aliases");
+ buffer.write(_typeAliases.length);
+ buffer.write(" type aliases");
}
if (_typeParameters != null) {
- if (builder.length > 0) {
- builder.append("; ");
+ if (buffer.length > 0) {
+ buffer.write("; ");
}
- builder.append(_typeParameters.length);
- builder.append(" type parameters");
+ buffer.write(_typeParameters.length);
+ buffer.write(" type parameters");
}
- if (builder.length > 0) {
- AnalysisEngine.instance.logger.logError("Failed to capture elements: ${builder.toString()}");
+ if (buffer.length > 0) {
+ AnalysisEngine.instance.logger.logError("Failed to capture elements: $buffer");
}
}
}
@@ -6881,7 +6885,7 @@
String nameStr = name.name;
Element element = namespace.get(nameStr);
if (element == null) {
- element = namespace.get("${nameStr}=");
+ element = namespace.get("$nameStr=");
}
if (element != null) {
// Ensure that the name always resolves to a top-level variable
@@ -6981,7 +6985,7 @@
// Look to see whether the name of the method is really part of a prefixed identifier for an
// imported top-level function or top-level getter that returns a function.
//
- String name = "${target.name}.${methodName}";
+ String name = "${target.name}.$methodName";
Identifier functionName = new ElementResolver_SyntheticIdentifier(name);
Element element = _resolver.nameScope.lookup(functionName, _definingLibrary);
if (element != null) {
@@ -7178,7 +7182,7 @@
}
}
if (!annotationList.isEmpty) {
- (element as ElementImpl).metadata = new List.from(annotationList);
+ (element as ElementImpl).metadata = annotationList;
}
}
@@ -7197,7 +7201,7 @@
List<ElementAnnotationImpl> annotationList = new List<ElementAnnotationImpl>();
_addAnnotations(annotationList, node.metadata);
if (!annotationList.isEmpty) {
- (element as ElementImpl).metadata = new List.from(annotationList);
+ (element as ElementImpl).metadata = annotationList;
}
}
@@ -7401,8 +7405,8 @@
//
// Finish building the enum.
//
- enumElement.fields = new List.from(fields);
- enumElement.accessors = new List.from(getters);
+ enumElement.fields = fields;
+ enumElement.accessors = getters;
// Client code isn't allowed to invoke the constructor, so we do not model it.
return super.visitEnumDeclaration(node);
}
@@ -7417,6 +7421,7 @@
PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.forVariable(field);
getter.getter = true;
getter.returnType = field.type;
+ getter.type = new FunctionTypeImpl.con1(getter);
field.getter = getter;
return getter;
}
@@ -8558,19 +8563,25 @@
}
}
}
- // Visit all of the states in the map to ensure that none were never initialized.
- for (MapEntry<FieldElement, INIT_STATE> entry in getMapEntrySet(fieldElementsMap)) {
- if (entry.getValue() == INIT_STATE.NOT_INIT) {
- FieldElement fieldElement = entry.getKey();
+ // Visit all of the states in the map to ensure that none were never
+ // initialized.
+ fieldElementsMap.forEach((FieldElement fieldElement, INIT_STATE state) {
+ if (state == INIT_STATE.NOT_INIT) {
if (fieldElement.isConst) {
- _errorReporter.reportErrorForNode(CompileTimeErrorCode.CONST_NOT_INITIALIZED, node.returnType, [fieldElement.name]);
+ _errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.CONST_NOT_INITIALIZED,
+ node.returnType,
+ [fieldElement.name]);
foundError = true;
} else if (fieldElement.isFinal) {
- _errorReporter.reportErrorForNode(StaticWarningCode.FINAL_NOT_INITIALIZED, node.returnType, [fieldElement.name]);
+ _errorReporter.reportErrorForNode(
+ StaticWarningCode.FINAL_NOT_INITIALIZED,
+ node.returnType,
+ [fieldElement.name]);
foundError = true;
}
}
- }
+ });
return foundError;
}
@@ -8631,17 +8642,16 @@
overriddenExecutable.enclosingElement.displayName]);
return true;
}
- // For each named parameter in the overridden method, verify that there is the same name in
- // the overriding method, and in the same order.
- Set<String> overridingParameterNameSet = overridingNamedPT.keys.toSet();
- JavaIterator<String> overriddenParameterNameIterator = new JavaIterator(overriddenNamedPT.keys.toSet());
- while (overriddenParameterNameIterator.hasNext) {
- String overriddenParamName = overriddenParameterNameIterator.next();
- if (!overridingParameterNameSet.contains(overriddenParamName)) {
- // The overridden method expected the overriding method to have overridingParamName,
- // but it does not.
- _errorReporter.reportErrorForNode(StaticWarningCode.INVALID_OVERRIDE_NAMED, errorNameTarget, [
- overriddenParamName,
+ // For each named parameter in the overridden method, verify that there is
+ // the same name in the overriding method.
+ for (String overriddenParamName in overriddenNamedPT.keys) {
+ if (!overridingNamedPT.containsKey(overriddenParamName)) {
+ // The overridden method expected the overriding method to have
+ // overridingParamName, but it does not.
+ _errorReporter.reportErrorForNode(
+ StaticWarningCode.INVALID_OVERRIDE_NAMED,
+ errorNameTarget,
+ [overriddenParamName,
overriddenExecutable.enclosingElement.displayName]);
return true;
}
@@ -8681,31 +8691,33 @@
parameterIndex++;
}
// SWC.INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE & SWC.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES
- JavaIterator<MapEntry<String, DartType>> overriddenNamedPTIterator = new JavaIterator(getMapEntrySet(overriddenNamedPT));
- while (overriddenNamedPTIterator.hasNext) {
- MapEntry<String, DartType> overriddenNamedPTEntry = overriddenNamedPTIterator.next();
- DartType overridingType = overridingNamedPT[overriddenNamedPTEntry.getKey()];
+ for (String overriddenName in overriddenNamedPT.keys) {
+ DartType overridingType = overridingNamedPT[overriddenName];
if (overridingType == null) {
- // Error, this is never reached- INVALID_OVERRIDE_NAMED would have been created above if
- // this could be reached.
+ // Error, this is never reached- INVALID_OVERRIDE_NAMED would have been
+ // created above if this could be reached.
continue;
}
- if (!overriddenNamedPTEntry.getValue().isAssignableTo(overridingType)) {
+ DartType overriddenType = overriddenNamedPT[overriddenName];
+ if (!overriddenType.isAssignableTo(overridingType)) {
// lookup the parameter for the error to select
ParameterElement parameterToSelect = null;
AstNode parameterLocationToSelect = null;
for (int i = 0; i < parameters.length; i++) {
ParameterElement parameter = parameters[i];
- if (parameter.parameterKind == ParameterKind.NAMED && overriddenNamedPTEntry.getKey() == parameter.name) {
+ if (parameter.parameterKind == ParameterKind.NAMED
+ && overriddenName == parameter.name) {
parameterToSelect = parameter;
parameterLocationToSelect = parameterLocations[i];
break;
}
}
if (parameterToSelect != null) {
- _errorReporter.reportTypeErrorForNode(StaticWarningCode.INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE, parameterLocationToSelect, [
- overridingType,
- overriddenNamedPTEntry.getValue(),
+ _errorReporter.reportTypeErrorForNode(
+ StaticWarningCode.INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE,
+ parameterLocationToSelect,
+ [overridingType,
+ overriddenType,
overriddenExecutable.enclosingElement.displayName]);
return true;
}
@@ -8849,10 +8861,22 @@
PropertyAccessorElement setter = element.setter;
SimpleIdentifier fieldName = field.name;
if (getter != null) {
- hasProblems = javaBooleanOr(hasProblems, _checkForAllInvalidOverrideErrorCodesForExecutable(getter, ParameterElementImpl.EMPTY_ARRAY, AstNode.EMPTY_ARRAY, fieldName));
+ if (_checkForAllInvalidOverrideErrorCodesForExecutable(
+ getter,
+ ParameterElementImpl.EMPTY_ARRAY,
+ AstNode.EMPTY_ARRAY,
+ fieldName)) {
+ hasProblems = true;
+ }
}
if (setter != null) {
- hasProblems = javaBooleanOr(hasProblems, _checkForAllInvalidOverrideErrorCodesForExecutable(setter, setter.parameters, <AstNode> [fieldName], fieldName));
+ if (_checkForAllInvalidOverrideErrorCodesForExecutable(
+ setter,
+ setter.parameters,
+ <AstNode> [fieldName],
+ fieldName)) {
+ hasProblems = true;
+ }
}
}
return hasProblems;
@@ -8902,14 +8926,26 @@
if (mixinType is! InterfaceType) {
continue;
}
- if (_checkForExtendsOrImplementsDisallowedClass(mixinName, CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS)) {
+ if (_checkForExtendsOrImplementsDisallowedClass(
+ mixinName,
+ CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS)) {
problemReported = true;
} else {
ClassElement mixinElement = (mixinType as InterfaceType).element;
- problemReported = javaBooleanOr(problemReported, _checkForExtendsOrImplementsDeferredClass(mixinName, CompileTimeErrorCode.MIXIN_DEFERRED_CLASS));
- problemReported = javaBooleanOr(problemReported, _checkForMixinDeclaresConstructor(mixinName, mixinElement));
- problemReported = javaBooleanOr(problemReported, _checkForMixinInheritsNotFromObject(mixinName, mixinElement));
- problemReported = javaBooleanOr(problemReported, _checkForMixinReferencesSuper(mixinName, mixinElement));
+ if (_checkForExtendsOrImplementsDeferredClass(
+ mixinName,
+ CompileTimeErrorCode.MIXIN_DEFERRED_CLASS)) {
+ problemReported = true;
+ }
+ if (_checkForMixinDeclaresConstructor(mixinName, mixinElement)) {
+ problemReported = true;
+ }
+ if (_checkForMixinInheritsNotFromObject(mixinName, mixinElement)) {
+ problemReported = true;
+ }
+ if (_checkForMixinReferencesSuper(mixinName, mixinElement)) {
+ problemReported = true;
+ }
}
}
return problemReported;
@@ -9041,9 +9077,8 @@
// check exported names
Namespace namespace = new NamespaceBuilder().createExportNamespaceForDirective(exportElement);
Map<String, Element> definedNames = namespace.definedNames;
- for (MapEntry<String, Element> definedEntry in getMapEntrySet(definedNames)) {
- String name = definedEntry.getKey();
- Element element = definedEntry.getValue();
+ for (String name in definedNames.keys) {
+ Element element = definedNames[name];
Element prevElement = _exportedElements[name];
if (element != null && prevElement != null && prevElement != element) {
_errorReporter.reportErrorForNode(CompileTimeErrorCode.AMBIGUOUS_EXPORT, node, [
@@ -9144,7 +9179,9 @@
}
bool problemReported = false;
for (Expression argument in argumentList.arguments) {
- problemReported = javaBooleanOr(problemReported, _checkForArgumentTypeNotAssignableForArgument(argument));
+ if (_checkForArgumentTypeNotAssignableForArgument(argument)) {
+ problemReported = true;
+ }
}
return problemReported;
}
@@ -9308,8 +9345,8 @@
int lastMember = members.length - 1;
for (int i = 0; i < lastMember; i++) {
SwitchMember member = members[i];
- if (member is SwitchCase) {
- foundError = javaBooleanOr(foundError, _checkForCaseBlockNotTerminated(member));
+ if (member is SwitchCase && _checkForCaseBlockNotTerminated(member)) {
+ foundError = true;
}
}
return foundError;
@@ -9559,7 +9596,7 @@
_enclosingClass.displayName,
name.name,
enclosingElementOfSetter.displayName]);
- foundError = javaBooleanOr(foundError, true);
+ foundError = true;
addThisMemberToTheMap = false;
}
} else if (isSetter) {
@@ -9568,7 +9605,7 @@
if (conflictingMethod != null && conflictingMethod is MethodDeclaration && !conflictingMethod.isGetter) {
// report problem
_errorReporter.reportErrorForNode(StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER2, name, [_enclosingClass.displayName, name.name]);
- foundError = javaBooleanOr(foundError, true);
+ foundError = true;
addThisMemberToTheMap = false;
}
}
@@ -9912,7 +9949,9 @@
if (typeArguments != null) {
bool hasError = false;
for (TypeName argument in typeArguments.arguments) {
- hasError = javaBooleanOr(hasError, _checkForConstWithTypeParameters(argument));
+ if (_checkForConstWithTypeParameters(argument)) {
+ hasError = true;
+ }
}
return hasError;
}
@@ -10056,16 +10095,14 @@
}
bool hasProblem = false;
for (ExecutableElement member in _enclosingClass.methods) {
- if (!member.isStatic) {
- continue;
+ if (member.isStatic && _checkForDuplicateDefinitionOfMember(member)) {
+ hasProblem = true;
}
- hasProblem = javaBooleanOr(hasProblem, _checkForDuplicateDefinitionOfMember(member));
}
for (ExecutableElement member in _enclosingClass.accessors) {
- if (!member.isStatic) {
- continue;
+ if (member.isStatic && _checkForDuplicateDefinitionOfMember(member)) {
+ hasProblem = true;
}
- hasProblem = javaBooleanOr(hasProblem, _checkForDuplicateDefinitionOfMember(member));
}
return hasProblem;
}
@@ -10457,9 +10494,9 @@
}
bool foundError = false;
for (ClassMember classMember in classMembers) {
- if (classMember is FieldDeclaration) {
- FieldDeclaration field = classMember;
- foundError = javaBooleanOr(foundError, _checkForFinalNotInitialized(field.fields));
+ if (classMember is FieldDeclaration
+ && _checkForFinalNotInitialized(classMember.fields)) {
+ foundError = true;
}
}
return foundError;
@@ -10478,7 +10515,11 @@
}
bool foundError = false;
for (TypeName type in node.interfaces) {
- foundError = javaBooleanOr(foundError, _checkForExtendsOrImplementsDeferredClass(type, CompileTimeErrorCode.IMPLEMENTS_DEFERRED_CLASS));
+ if (_checkForExtendsOrImplementsDeferredClass(
+ type,
+ CompileTimeErrorCode.IMPLEMENTS_DEFERRED_CLASS)) {
+ foundError = true;
+ }
}
return foundError;
}
@@ -10497,7 +10538,11 @@
}
bool foundError = false;
for (TypeName type in node.interfaces) {
- foundError = javaBooleanOr(foundError, _checkForExtendsOrImplementsDisallowedClass(type, CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS));
+ if (_checkForExtendsOrImplementsDisallowedClass(
+ type,
+ CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS)) {
+ foundError = true;
+ }
}
return foundError;
}
@@ -10936,11 +10981,21 @@
bool hasProblems = false;
for (Expression element in node.elements) {
if (node.constKeyword != null) {
- // TODO(paulberry): this error should be based on the actual type of the list element, not
- // the static type. See dartbug.com/21119.
- hasProblems = javaBooleanOr(hasProblems, _checkForArgumentTypeNotAssignableWithExpectedTypes(element, listElementType, CheckedModeCompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE));
+ // TODO(paulberry): this error should be based on the actual type of the
+ // list element, not the static type. See dartbug.com/21119.
+ if (_checkForArgumentTypeNotAssignableWithExpectedTypes(
+ element,
+ listElementType,
+ CheckedModeCompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE)) {
+ hasProblems = true;
+ }
}
- hasProblems = javaBooleanOr(hasProblems, _checkForArgumentTypeNotAssignableWithExpectedTypes(element, listElementType, StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE));
+ if (_checkForArgumentTypeNotAssignableWithExpectedTypes(
+ element,
+ listElementType,
+ StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE)) {
+ hasProblems = true;
+ }
}
return hasProblems;
}
@@ -10972,13 +11027,33 @@
Expression key = entry.key;
Expression value = entry.value;
if (node.constKeyword != null) {
- // TODO(paulberry): this error should be based on the actual type of the list element, not
- // the static type. See dartbug.com/21119.
- hasProblems = javaBooleanOr(hasProblems, _checkForArgumentTypeNotAssignableWithExpectedTypes(key, keyType, CheckedModeCompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE));
- hasProblems = javaBooleanOr(hasProblems, _checkForArgumentTypeNotAssignableWithExpectedTypes(value, valueType, CheckedModeCompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE));
+ // TODO(paulberry): this error should be based on the actual type of the
+ // list element, not the static type. See dartbug.com/21119.
+ if (_checkForArgumentTypeNotAssignableWithExpectedTypes(
+ key,
+ keyType,
+ CheckedModeCompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE)) {
+ hasProblems = true;
+ }
+ if (_checkForArgumentTypeNotAssignableWithExpectedTypes(
+ value,
+ valueType,
+ CheckedModeCompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE)) {
+ hasProblems = true;
+ }
}
- hasProblems = javaBooleanOr(hasProblems, _checkForArgumentTypeNotAssignableWithExpectedTypes(key, keyType, StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE));
- hasProblems = javaBooleanOr(hasProblems, _checkForArgumentTypeNotAssignableWithExpectedTypes(value, valueType, StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE));
+ if (_checkForArgumentTypeNotAssignableWithExpectedTypes(
+ key,
+ keyType,
+ StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE)) {
+ hasProblems = true;
+ }
+ if (_checkForArgumentTypeNotAssignableWithExpectedTypes(
+ value,
+ valueType,
+ StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE)) {
+ hasProblems = true;
+ }
}
return hasProblems;
}
@@ -11434,9 +11509,9 @@
}
}
if (enclosingElement != null) {
- newStrMember = "${prefix}'${enclosingElement.displayName}.${missingOverridesArray[i].displayName}'";
+ newStrMember = "$prefix'${enclosingElement.displayName}.${missingOverridesArray[i].displayName}'";
} else {
- newStrMember = "${prefix}'${missingOverridesArray[i].displayName}'";
+ newStrMember = "$prefix'${missingOverridesArray[i].displayName}'";
}
stringMembersArrayListSet.add(newStrMember);
}
@@ -12058,7 +12133,7 @@
// iterate over each bounded type parameter and corresponding argument
NodeList<TypeName> typeNameArgList = node.typeArguments.arguments;
List<DartType> typeArguments = (type as InterfaceType).typeArguments;
- int loopThroughIndex = Math.min(typeNameArgList.length, boundingElts.length);
+ int loopThroughIndex = math.min(typeNameArgList.length, boundingElts.length);
bool foundError = false;
for (int i = 0; i < loopThroughIndex; i++) {
TypeName argTypeName = typeNameArgList[i];
@@ -12709,13 +12784,13 @@
if (size > 1) {
// Construct a string showing the cyclic implements path: "A, B, C, D, A"
String separator = ", ";
- JavaStringBuilder builder = new JavaStringBuilder();
+ StringBuffer buffer = new StringBuffer();
for (int i = 0; i < size; i++) {
- builder.append(path[i].displayName);
- builder.append(separator);
+ buffer.write(path[i].displayName);
+ buffer.write(separator);
}
- builder.append(classElt.displayName);
- _errorReporter.reportErrorForOffset(CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, _enclosingClass.nameOffset, enclosingClassName.length, [enclosingClassName, builder.toString()]);
+ buffer.write(classElt.displayName);
+ _errorReporter.reportErrorForOffset(CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, _enclosingClass.nameOffset, enclosingClassName.length, [enclosingClassName, buffer.toString()]);
return true;
} else {
// RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS or
@@ -13035,8 +13110,7 @@
_enclosingBlockContainsBreak = false;
try {
bool hasDefault = false;
- NodeList<SwitchMember> memberList = node.members;
- List<SwitchMember> members = new List.from(memberList);
+ List<SwitchMember> members = node.members;
for (int i = 0; i < members.length; i++) {
SwitchMember switchMember = members[i];
if (switchMember is SwitchDefault) {
@@ -13259,9 +13333,9 @@
}
class GeneralizingAstVisitor_StaticTypeAnalyzer_computePropagatedReturnTypeOfFunction extends GeneralizingAstVisitor<Object> {
- List<DartType> result;
+ DartType result = null;
- GeneralizingAstVisitor_StaticTypeAnalyzer_computePropagatedReturnTypeOfFunction(this.result) : super();
+ GeneralizingAstVisitor_StaticTypeAnalyzer_computePropagatedReturnTypeOfFunction();
@override
Object visitExpression(Expression node) => null;
@@ -13277,10 +13351,10 @@
type = BottomTypeImpl.instance;
}
// merge types
- if (result[0] == null) {
- result[0] = type;
+ if (result == null) {
+ result = type;
} else {
- result[0] = result[0].getLeastUpperBound(type);
+ result = result.getLeastUpperBound(type);
}
return null;
}
@@ -13634,25 +13708,25 @@
// least once. This code will guard against infinite recursion and might help us identify the
// cause of the issue.
//
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append("Found circularity in XML nodes: ");
+ StringBuffer buffer = new StringBuffer();
+ buffer.write("Found circularity in XML nodes: ");
bool first = true;
for (ht.XmlTagNode pathNode in _parentNodes) {
if (first) {
first = false;
} else {
- builder.append(", ");
+ buffer.write(", ");
}
String tagName = pathNode.tag;
if (identical(pathNode, node)) {
- builder.append("*");
- builder.append(tagName);
- builder.append("*");
+ buffer.write("*");
+ buffer.write(tagName);
+ buffer.write("*");
} else {
- builder.append(tagName);
+ buffer.write(tagName);
}
}
- AnalysisEngine.instance.logger.logError(builder.toString());
+ AnalysisEngine.instance.logger.logError(buffer.toString());
return null;
}
@@ -13765,7 +13839,7 @@
implicitConstructors.add(_createImplicitContructor(classType, explicitConstructor, parameterTypes, argumentTypes));
}
}
- classElement.constructors = new List.from(implicitConstructors);
+ classElement.constructors = implicitConstructors;
}
}
}
@@ -13837,7 +13911,7 @@
}
} else {
NodeList<TypeName> arguments = typeArguments.arguments;
- int argumentCount = Math.min(arguments.length, parameterCount);
+ int argumentCount = math.min(arguments.length, parameterCount);
for (int i = 0; i < argumentCount; i++) {
types[i] = arguments[i].type;
}
@@ -14289,7 +14363,7 @@
bool _elementModelChanged(AstNode node) {
Element element = _getElement(node);
if (element == null) {
- throw new AnalysisException("Cannot resolve node: a ${node.runtimeType.toString()} does not define an element");
+ throw new AnalysisException("Cannot resolve node: a ${node.runtimeType} does not define an element");
}
DeclarationMatcher matcher = new DeclarationMatcher();
return !matcher.matches(node, element);
@@ -15082,9 +15156,7 @@
*/
MemberMap _resolveInheritanceLookup(ClassElement classElt, HashMap<String, List<ExecutableElement>> unionMap) {
MemberMap resultMap = new MemberMap();
- for (MapEntry<String, List<ExecutableElement>> entry in getMapEntrySet(unionMap)) {
- String key = entry.getKey();
- List<ExecutableElement> list = entry.getValue();
+ unionMap.forEach((String key, List<ExecutableElement> list) {
int numOfEltsWithMatchingNames = list.length;
if (numOfEltsWithMatchingNames == 1) {
//
@@ -15181,7 +15253,7 @@
// of the other, we create a warning, and have this class inherit nothing.
//
if (!classHasMember) {
- String firstTwoFuntionTypesStr = "${executableElementTypes[0].toString()}, ${executableElementTypes[1].toString()}";
+ String firstTwoFuntionTypesStr = "${executableElementTypes[0]}, ${executableElementTypes[1]}";
_reportError(classElt, classElt.nameOffset, classElt.displayName.length, StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE, [key, firstTwoFuntionTypesStr]);
}
} else {
@@ -15204,7 +15276,7 @@
_reportError(classElt, classElt.nameOffset, classElt.displayName.length, StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD, [key]);
}
}
- }
+ });
return resultMap;
}
@@ -15465,7 +15537,7 @@
unitArrayList.add(getAST(source));
}
}
- return new List.from(unitArrayList);
+ return unitArrayList;
}
/**
@@ -15740,7 +15812,7 @@
libraryElement.entryPoint = entryPoint;
}
int sourcedUnitCount = sourcedCompilationUnits.length;
- libraryElement.parts = new List.from(sourcedCompilationUnits);
+ libraryElement.parts = sourcedCompilationUnits;
for (Directive directive in directivesToResolve) {
directive.element = libraryElement;
}
@@ -15828,7 +15900,7 @@
libraryElement.entryPoint = entryPoint;
}
int sourcedUnitCount = sourcedCompilationUnits.length;
- libraryElement.parts = new List.from(sourcedCompilationUnits);
+ libraryElement.parts = sourcedCompilationUnits;
for (Directive directive in directivesToResolve) {
directive.element = libraryElement;
}
@@ -16054,20 +16126,19 @@
}
}
int indirectCount = indirectSources.length;
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append(library.definingCompilationUnit.displayName);
+ StringBuffer buffer = new StringBuffer();
+ buffer.write(library.definingCompilationUnit.displayName);
if (indirectCount > 0) {
- builder.append(" (via ");
+ buffer.write(" (via ");
if (indirectCount > 1) {
- List<String> indirectNames = new List.from(indirectSources);
- indirectNames.sort();
- builder.append(StringUtilities.printListOfQuotedNames(indirectNames));
+ indirectSources.sort();
+ buffer.write(StringUtilities.printListOfQuotedNames(indirectSources));
} else {
- builder.append(indirectSources[0]);
+ buffer.write(indirectSources[0]);
}
- builder.append(")");
+ buffer.write(")");
}
- return builder.toString();
+ return buffer.toString();
}
/**
@@ -16105,7 +16176,7 @@
return conflictingMembers[0];
} else if (to == 0) {
// All members were removed
- AnalysisEngine.instance.logger.logInformation("Multiply defined SDK element: ${foundElement}");
+ AnalysisEngine.instance.logger.logInformation("Multiply defined SDK element: $foundElement");
return foundElement;
}
List<Element> remaining = new List<Element>(to);
@@ -16449,7 +16520,7 @@
combinators.add(show);
}
}
- return new List.from(combinators);
+ return combinators;
}
/**
@@ -16541,8 +16612,8 @@
imports.add(importElement);
}
LibraryElementImpl libraryElement = library.libraryElement;
- libraryElement.imports = new List.from(imports);
- libraryElement.exports = new List.from(exports);
+ libraryElement.imports = imports;
+ libraryElement.exports = exports;
if (libraryElement.entryPoint == null) {
Namespace namespace = new NamespaceBuilder().createExportNamespaceForLibrary(libraryElement);
Element element = namespace.get(LibraryElementBuilder.ENTRY_POINT_NAME);
@@ -16756,7 +16827,7 @@
importedLibraries.add(importedLibrary);
}
}
- library.importedLibraries = new List.from(importedLibraries);
+ library.importedLibraries = importedLibraries;
List<Library> exportedLibraries = new List<Library>();
for (Source exportedSource in exportedSources) {
Library exportedLibrary = _libraryMap[exportedSource];
@@ -16770,7 +16841,7 @@
exportedLibraries.add(exportedLibrary);
}
}
- library.exportedLibraries = new List.from(exportedLibraries);
+ library.exportedLibraries = exportedLibraries;
library.explicitlyImportsCore = explicitlyImportsCore;
if (!explicitlyImportsCore && _coreLibrarySource != library.librarySource) {
Library importedLibrary = _libraryMap[_coreLibrarySource];
@@ -17111,7 +17182,7 @@
combinators.add(show);
}
}
- return new List.from(combinators);
+ return combinators;
}
/**
@@ -17207,8 +17278,8 @@
imports.add(importElement);
}
LibraryElementImpl libraryElement = library.libraryElement;
- libraryElement.imports = new List.from(imports);
- libraryElement.exports = new List.from(exports);
+ libraryElement.imports = imports;
+ libraryElement.exports = exports;
if (libraryElement.entryPoint == null) {
Namespace namespace = new NamespaceBuilder().createExportNamespaceForLibrary(libraryElement);
Element element = namespace.get(LibraryElementBuilder.ENTRY_POINT_NAME);
@@ -17828,9 +17899,9 @@
* @param namespace the namespace containing the names to be added to this namespace
*/
void _addAllFromMap(Map<String, Element> definedNames, Map<String, Element> newNames) {
- for (MapEntry<String, Element> entry in getMapEntrySet(newNames)) {
- definedNames[entry.getKey()] = entry.getValue();
- }
+ newNames.forEach((String name, Element element) {
+ definedNames[name] = element;
+ });
}
/**
@@ -17895,7 +17966,7 @@
definedNames = _show(definedNames, combinator.shownNames);
} else {
// Internal error.
- AnalysisEngine.instance.logger.logError("Unknown type of combinator: ${combinator.runtimeType.toString()}");
+ AnalysisEngine.instance.logger.logError("Unknown type of combinator: ${combinator.runtimeType}");
}
}
return definedNames;
@@ -17911,9 +17982,9 @@
if (prefixElement != null) {
String prefix = prefixElement.name;
HashMap<String, Element> newNames = new HashMap<String, Element>();
- for (MapEntry<String, Element> entry in getMapEntrySet(definedNames)) {
- newNames["${prefix}.${entry.getKey()}"] = entry.getValue();
- }
+ definedNames.forEach((String name, Element element) {
+ newNames["$prefix.$name"] = element;
+ });
return newNames;
} else {
return definedNames;
@@ -17960,7 +18031,7 @@
void _hide(HashMap<String, Element> definedNames, List<String> hiddenNames) {
for (String name in hiddenNames) {
definedNames.remove(name);
- definedNames.remove("${name}=");
+ definedNames.remove("$name=");
}
}
@@ -17978,7 +18049,7 @@
if (element != null) {
newNames[name] = element;
}
- String setterName = "${name}=";
+ String setterName = "$name=";
element = definedNames[setterName];
if (element != null) {
newNames[setterName] = element;
@@ -18449,11 +18520,11 @@
}
class RecursiveAstVisitor_ResolverVisitor_isVariableAccessedInClosure extends RecursiveAstVisitor<Object> {
- List<bool> result;
+ final Element variable;
- Element variable;
+ bool result = false;
- RecursiveAstVisitor_ResolverVisitor_isVariableAccessedInClosure(this.result, this.variable) : super();
+ RecursiveAstVisitor_ResolverVisitor_isVariableAccessedInClosure(this.variable);
bool _inClosure = false;
@@ -18470,31 +18541,31 @@
@override
Object visitSimpleIdentifier(SimpleIdentifier node) {
- if (result[0]) {
+ if (result) {
return null;
}
if (_inClosure && identical(node.staticElement, variable)) {
- result[0] = javaBooleanOr(result[0], true);
+ result = true;
}
return null;
}
}
class RecursiveAstVisitor_ResolverVisitor_isVariablePotentiallyMutatedIn extends RecursiveAstVisitor<Object> {
- List<bool> result;
+ final Element variable;
- Element variable;
+ bool result = false;
- RecursiveAstVisitor_ResolverVisitor_isVariablePotentiallyMutatedIn(this.result, this.variable) : super();
+ RecursiveAstVisitor_ResolverVisitor_isVariablePotentiallyMutatedIn(this.variable);
@override
Object visitSimpleIdentifier(SimpleIdentifier node) {
- if (result[0]) {
+ if (result) {
return null;
}
if (identical(node.staticElement, variable)) {
if (node.inSetterContext()) {
- result[0] = javaBooleanOr(result[0], true);
+ result = true;
}
}
return null;
@@ -18815,7 +18886,7 @@
ErrorSeverity get errorSeverity => type.severity;
@override
- String get uniqueName => "${runtimeType.toString()}.${name}";
+ String get uniqueName => "$runtimeType.$name";
}
/**
@@ -19977,9 +20048,10 @@
* @return `true` if this variable is potentially mutated somewhere in the given ASTNode
*/
bool _isVariableAccessedInClosure(Element variable, AstNode target) {
- List<bool> result = [false];
- target.accept(new RecursiveAstVisitor_ResolverVisitor_isVariableAccessedInClosure(result, variable));
- return result[0];
+ RecursiveAstVisitor_ResolverVisitor_isVariableAccessedInClosure visitor
+ = new RecursiveAstVisitor_ResolverVisitor_isVariableAccessedInClosure(variable);
+ target.accept(visitor);
+ return visitor.result;
}
/**
@@ -19991,9 +20063,10 @@
* @return `true` if this variable is potentially mutated somewhere in the given ASTNode
*/
bool _isVariablePotentiallyMutatedIn(Element variable, AstNode target) {
- List<bool> result = [false];
- target.accept(new RecursiveAstVisitor_ResolverVisitor_isVariablePotentiallyMutatedIn(result, variable));
- return result[0];
+ RecursiveAstVisitor_ResolverVisitor_isVariablePotentiallyMutatedIn visitor
+ = new RecursiveAstVisitor_ResolverVisitor_isVariablePotentiallyMutatedIn(variable);
+ target.accept(visitor);
+ return visitor.result;
}
/**
@@ -20667,16 +20740,16 @@
Scope outerScope = _nameScope;
try {
if (constructorElement == null) {
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append("Missing element for constructor ");
- builder.append(node.returnType.name);
+ StringBuffer buffer = new StringBuffer();
+ buffer.write("Missing element for constructor ");
+ buffer.write(node.returnType.name);
if (node.name != null) {
- builder.append(".");
- builder.append(node.name.name);
+ buffer.write(".");
+ buffer.write(node.name.name);
}
- builder.append(" in ");
- builder.append(definingLibrary.source.fullName);
- AnalysisEngine.instance.logger.logInformation2(builder.toString(), new JavaException());
+ buffer.write(" in ");
+ buffer.write(definingLibrary.source.fullName);
+ AnalysisEngine.instance.logger.logInformation2(buffer.toString(), new JavaException());
} else {
_nameScope = new FunctionScope(_nameScope, constructorElement);
}
@@ -20783,19 +20856,19 @@
try {
ExecutableElement functionElement = node.element;
if (functionElement == null) {
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append("Missing element for function ");
+ StringBuffer buffer = new StringBuffer();
+ buffer.write("Missing element for function ");
AstNode parent = node.parent;
while (parent != null) {
if (parent is Declaration) {
Element parentElement = (parent as Declaration).element;
- builder.append(parentElement == null ? "<unknown> " : ("${parentElement.name} "));
+ buffer.write(parentElement == null ? "<unknown> " : "${parentElement.name} ");
}
parent = parent.parent;
}
- builder.append("in ");
- builder.append(definingLibrary.source.fullName);
- AnalysisEngine.instance.logger.logInformation2(builder.toString(), new JavaException());
+ buffer.write("in ");
+ buffer.write(definingLibrary.source.fullName);
+ AnalysisEngine.instance.logger.logInformation2(buffer.toString(), new JavaException());
} else {
_nameScope = new FunctionScope(_nameScope, functionElement);
}
@@ -22366,9 +22439,10 @@
return expressionBody.expression.bestType;
}
if (body is BlockFunctionBody) {
- List<DartType> result = [null];
- body.accept(new GeneralizingAstVisitor_StaticTypeAnalyzer_computePropagatedReturnTypeOfFunction(result));
- return result[0];
+ GeneralizingAstVisitor_StaticTypeAnalyzer_computePropagatedReturnTypeOfFunction visitor
+ = new GeneralizingAstVisitor_StaticTypeAnalyzer_computePropagatedReturnTypeOfFunction();
+ body.accept(visitor);
+ return visitor.result;
}
return null;
}
@@ -23193,9 +23267,9 @@
* @param overrides the overrides to be applied
*/
void applyOverrides(Map<VariableElement, DartType> overrides) {
- for (MapEntry<VariableElement, DartType> entry in getMapEntrySet(overrides)) {
- _overridenTypes[entry.getKey()] = entry.getValue();
- }
+ overrides.forEach((VariableElement element, DartType type) {
+ _overridenTypes[element] = type;
+ });
}
/**
@@ -23705,7 +23779,7 @@
InterfaceType _getType(Namespace namespace, String typeName) {
Element element = namespace.get(typeName);
if (element == null) {
- AnalysisEngine.instance.logger.logInformation("No definition of type ${typeName}");
+ AnalysisEngine.instance.logger.logInformation("No definition of type $typeName");
return null;
}
return (element as ClassElement).type;
@@ -23947,19 +24021,19 @@
ExecutableElementImpl element = node.element as ExecutableElementImpl;
if (element == null) {
ClassDeclaration classNode = node.getAncestor((node) => node is ClassDeclaration);
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append("The element for the constructor ");
- builder.append(node.name == null ? "<unnamed>" : node.name.name);
- builder.append(" in ");
+ StringBuffer buffer = new StringBuffer();
+ buffer.write("The element for the constructor ");
+ buffer.write(node.name == null ? "<unnamed>" : node.name.name);
+ buffer.write(" in ");
if (classNode == null) {
- builder.append("<unknown class>");
+ buffer.write("<unknown class>");
} else {
- builder.append(classNode.name.name);
+ buffer.write(classNode.name.name);
}
- builder.append(" in ");
- builder.append(source.fullName);
- builder.append(" was not set while trying to resolve types.");
- AnalysisEngine.instance.logger.logError2(builder.toString(), new CaughtException(new AnalysisException(), null));
+ buffer.write(" in ");
+ buffer.write(source.fullName);
+ buffer.write(" was not set while trying to resolve types.");
+ AnalysisEngine.instance.logger.logError2(buffer.toString(), new CaughtException(new AnalysisException(), null));
} else {
ClassElement definingClass = element.enclosingElement as ClassElement;
element.returnType = definingClass.type;
@@ -24021,13 +24095,13 @@
super.visitFunctionDeclaration(node);
ExecutableElementImpl element = node.element as ExecutableElementImpl;
if (element == null) {
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append("The element for the top-level function ");
- builder.append(node.name);
- builder.append(" in ");
- builder.append(source.fullName);
- builder.append(" was not set while trying to resolve types.");
- AnalysisEngine.instance.logger.logError2(builder.toString(), new CaughtException(new AnalysisException(), null));
+ StringBuffer buffer = new StringBuffer();
+ buffer.write("The element for the top-level function ");
+ buffer.write(node.name);
+ buffer.write(" in ");
+ buffer.write(source.fullName);
+ buffer.write(" was not set while trying to resolve types.");
+ AnalysisEngine.instance.logger.logError2(buffer.toString(), new CaughtException(new AnalysisException(), null));
}
element.returnType = _computeReturnType(node.returnType);
FunctionTypeImpl type = new FunctionTypeImpl.con1(element);
@@ -24068,19 +24142,19 @@
ExecutableElementImpl element = node.element as ExecutableElementImpl;
if (element == null) {
ClassDeclaration classNode = node.getAncestor((node) => node is ClassDeclaration);
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append("The element for the method ");
- builder.append(node.name.name);
- builder.append(" in ");
+ StringBuffer buffer = new StringBuffer();
+ buffer.write("The element for the method ");
+ buffer.write(node.name.name);
+ buffer.write(" in ");
if (classNode == null) {
- builder.append("<unknown class>");
+ buffer.write("<unknown class>");
} else {
- builder.append(classNode.name.name);
+ buffer.write(classNode.name.name);
}
- builder.append(" in ");
- builder.append(source.fullName);
- builder.append(" was not set while trying to resolve types.");
- AnalysisEngine.instance.logger.logError2(builder.toString(), new CaughtException(new AnalysisException(), null));
+ buffer.write(" in ");
+ buffer.write(source.fullName);
+ buffer.write(" was not set while trying to resolve types.");
+ AnalysisEngine.instance.logger.logError2(buffer.toString(), new CaughtException(new AnalysisException(), null));
}
element.returnType = _computeReturnType(node.returnType);
FunctionTypeImpl type = new FunctionTypeImpl.con1(element);
@@ -24478,7 +24552,7 @@
elements.add(element);
}
}
- return new List.from(elements);
+ return elements;
}
/**
@@ -24700,17 +24774,17 @@
classElement.interfaces = interfaceTypes;
}
// TODO(brianwilkerson) Move the following checks to ErrorVerifier.
- List<TypeName> typeNames = new List.from(interfaces);
- List<bool> detectedRepeatOnIndex = new List<bool>.filled(typeNames.length, false);
+ int count = interfaces.length;
+ List<bool> detectedRepeatOnIndex = new List<bool>.filled(count, false);
for (int i = 0; i < detectedRepeatOnIndex.length; i++) {
detectedRepeatOnIndex[i] = false;
}
- for (int i = 0; i < typeNames.length; i++) {
- TypeName typeName = typeNames[i];
+ for (int i = 0; i < count; i++) {
+ TypeName typeName = interfaces[i];
if (!detectedRepeatOnIndex[i]) {
Element element = typeName.name.staticElement;
- for (int j = i + 1; j < typeNames.length; j++) {
- TypeName typeName2 = typeNames[j];
+ for (int j = i + 1; j < count; j++) {
+ TypeName typeName2 = interfaces[j];
Identifier identifier2 = typeName2.name;
String name2 = identifier2.name;
Element element2 = identifier2.staticElement;
@@ -24772,7 +24846,7 @@
types.add(type);
}
}
- return new List.from(types);
+ return types;
}
void _setElement(Identifier typeName, Element element) {
diff --git a/pkg/analyzer/lib/src/generated/scanner.dart b/pkg/analyzer/lib/src/generated/scanner.dart
index f4a9712..26457d7 100644
--- a/pkg/analyzer/lib/src/generated/scanner.dart
+++ b/pkg/analyzer/lib/src/generated/scanner.dart
@@ -8,6 +8,8 @@
library engine.scanner;
import 'dart:collection';
+import "dart:math" as math;
+
import 'java_core.dart';
import 'java_engine.dart';
import 'source.dart';
@@ -313,10 +315,10 @@
// Compute the range of characters that are known to need to be rescanned. If the index is
// within an existing token, then we need to start at the beginning of the token.
//
- int scanStart = Math.min(oldFirst.offset, index);
+ int scanStart = math.min(oldFirst.offset, index);
int oldEnd = oldLast.end + delta - 1;
int newEnd = index + insertedLength - 1;
- int scanEnd = Math.max(newEnd, oldEnd);
+ int scanEnd = math.max(newEnd, oldEnd);
//
// Starting at the start of the scan region, scan tokens from the modifiedSource until the end
// of the just scanned token is greater than or equal to end of the scan region in the modified
@@ -1925,7 +1927,7 @@
ErrorType get type => ErrorType.SYNTACTIC_ERROR;
@override
- String get uniqueName => "${runtimeType.toString()}.${name}";
+ String get uniqueName => "$runtimeType.$name";
}
/**
diff --git a/pkg/analyzer/lib/src/generated/sdk.dart b/pkg/analyzer/lib/src/generated/sdk.dart
index 046ac5e..494021c 100644
--- a/pkg/analyzer/lib/src/generated/sdk.dart
+++ b/pkg/analyzer/lib/src/generated/sdk.dart
@@ -216,7 +216,7 @@
String libraryName = null;
Expression key = node.key;
if (key is SimpleStringLiteral) {
- libraryName = "${_LIBRARY_PREFIX}${key.value}";
+ libraryName = "$_LIBRARY_PREFIX${key.value}";
}
Expression value = node.value;
if (value is InstanceCreationExpression) {
diff --git a/pkg/analyzer/lib/src/generated/sdk_io.dart b/pkg/analyzer/lib/src/generated/sdk_io.dart
index 974c393..920dccc 100644
--- a/pkg/analyzer/lib/src/generated/sdk_io.dart
+++ b/pkg/analyzer/lib/src/generated/sdk_io.dart
@@ -243,7 +243,7 @@
JavaFile file = new JavaFile.fromUri(uri);
String filePath = file.getAbsolutePath();
String libPath = libraryDirectory.getAbsolutePath();
- if (!filePath.startsWith("${libPath}${JavaFile.separator}")) {
+ if (!filePath.startsWith("$libPath${JavaFile.separator}")) {
return null;
}
filePath = filePath.substring(libPath.length + 1);
@@ -254,17 +254,17 @@
try {
return new FileBasedSource.con2(parseUriWithException(path), file);
} on URISyntaxException catch (exception) {
- AnalysisEngine.instance.logger.logInformation2("Failed to create URI: ${path}", exception);
+ AnalysisEngine.instance.logger.logInformation2("Failed to create URI: $path", exception);
return null;
}
}
libraryPath = new JavaFile(libraryPath).getParent();
- if (filePath.startsWith("${libraryPath}${JavaFile.separator}")) {
+ if (filePath.startsWith("$libraryPath${JavaFile.separator}")) {
String path = "${library.shortName}/${filePath.substring(libraryPath.length + 1)}";
try {
return new FileBasedSource.con2(parseUriWithException(path), file);
} on URISyntaxException catch (exception) {
- AnalysisEngine.instance.logger.logInformation2("Failed to create URI: ${path}", exception);
+ AnalysisEngine.instance.logger.logInformation2("Failed to create URI: $path", exception);
return null;
}
}
@@ -369,7 +369,7 @@
return null;
}
JavaFile libDir = new JavaFile.relative(dir, libraryName);
- JavaFile docFile = new JavaFile.relative(libDir, "${libraryName}${_DOC_FILE_SUFFIX}");
+ JavaFile docFile = new JavaFile.relative(libDir, "$libraryName$_DOC_FILE_SUFFIX");
if (docFile.exists()) {
return docFile;
}
diff --git a/pkg/analyzer/lib/src/generated/source.dart b/pkg/analyzer/lib/src/generated/source.dart
index b4974ae..3b3d79b 100644
--- a/pkg/analyzer/lib/src/generated/source.dart
+++ b/pkg/analyzer/lib/src/generated/source.dart
@@ -8,6 +8,8 @@
library engine.source;
import 'dart:collection';
+import "dart:math" as math;
+
import 'java_core.dart';
import 'sdk.dart' show DartSdk;
import 'engine.dart';
@@ -69,13 +71,17 @@
return _contentMap.remove(source);
} else {
int newStamp = JavaSystem.currentTimeMillis();
- int oldStamp = javaMapPut(_stampMap, source, newStamp);
- // Occasionally, if this method is called in rapid succession, the timestamps are equal.
- // Guard against this by artificially incrementing the new timestamp
+ int oldStamp = _stampMap[source];
+ _stampMap[source] = newStamp;
+ // Occasionally, if this method is called in rapid succession, the
+ // timestamps are equal. Guard against this by artificially incrementing
+ // the new timestamp.
if (newStamp == oldStamp) {
_stampMap[source] = newStamp + 1;
}
- return javaMapPut(_contentMap, source, contents);
+ String oldContent =_contentMap[source];
+ _contentMap[source] = contents;
+ return oldContent;
}
}
}
@@ -516,7 +522,7 @@
return _internalResolveUri(null, uri);
}
} catch (exception) {
- AnalysisEngine.instance.logger.logError2("Could not resolve URI: ${absoluteUri}", exception);
+ AnalysisEngine.instance.logger.logError2("Could not resolve URI: $absoluteUri", exception);
}
return null;
}
@@ -533,7 +539,7 @@
try {
return _internalResolveUri(null, absoluteUri);
} on AnalysisException catch (exception, stackTrace) {
- AnalysisEngine.instance.logger.logError2("Could not resolve URI: ${absoluteUri}", new CaughtException(exception, stackTrace));
+ AnalysisEngine.instance.logger.logError2("Could not resolve URI: $absoluteUri", new CaughtException(exception, stackTrace));
}
}
return null;
@@ -550,7 +556,7 @@
Source fromEncoding(String encoding) {
Source source = forUri(encoding);
if (source == null) {
- throw new IllegalArgumentException("Invalid source encoding: ${encoding}");
+ throw new IllegalArgumentException("Invalid source encoding: $encoding");
}
return source;
}
@@ -598,7 +604,7 @@
// Force the creation of an escaped URI to deal with spaces, etc.
return _internalResolveUri(containingSource, parseUriWithException(containedUri));
} catch (exception) {
- AnalysisEngine.instance.logger.logError2("Could not resolve URI (${containedUri}) relative to source (${containingSource.fullName})", exception);
+ AnalysisEngine.instance.logger.logError2("Could not resolve URI ($containedUri) relative to source (${containingSource.fullName})", exception);
return null;
}
}
@@ -643,7 +649,7 @@
Source _internalResolveUri(Source containingSource, Uri containedUri) {
if (!containedUri.isAbsolute) {
if (containingSource == null) {
- throw new AnalysisException("Cannot resolve a relative URI without a containing source: ${containedUri}");
+ throw new AnalysisException("Cannot resolve a relative URI without a containing source: $containedUri");
}
containedUri = containingSource.resolveRelativeUri(containedUri);
}
@@ -781,8 +787,8 @@
* @return the minimal [SourceRange] that cover this and the given [SourceRange]s.
*/
SourceRange getUnion(SourceRange other) {
- int newOffset = Math.min(offset, other.offset);
- int newEnd = Math.max(offset + length, other.offset + other.length);
+ int newOffset = math.min(offset, other.offset);
+ int newEnd = math.max(offset + length, other.offset + other.length);
return new SourceRange(newOffset, newEnd - newOffset);
}
@@ -806,20 +812,12 @@
}
/**
- * @return `true` if this [SourceRange] starts in <code>otherRange</code>.
+ * Return `true` if this [SourceRange] starts in the [otherRange].
*/
bool startsIn(SourceRange otherRange) => otherRange.contains(offset);
@override
- String toString() {
- JavaStringBuilder builder = new JavaStringBuilder();
- builder.append("[offset=");
- builder.append(offset);
- builder.append(", length=");
- builder.append(length);
- builder.append("]");
- return builder.toString();
- }
+ String toString() => '[offset=$offset, length=$length]';
}
/**
diff --git a/pkg/analyzer/lib/src/generated/source_io.dart b/pkg/analyzer/lib/src/generated/source_io.dart
index a5b4347..60740c1 100644
--- a/pkg/analyzer/lib/src/generated/source_io.dart
+++ b/pkg/analyzer/lib/src/generated/source_io.dart
@@ -32,7 +32,7 @@
if (path == null || path.length <= 0 || path.codeUnitAt(path.length - 1) == JavaFile.separatorChar) {
return path;
}
- return "${path}${JavaFile.separator}";
+ return "$path${JavaFile.separator}";
}
/**
@@ -77,7 +77,7 @@
int get hashCode => _path.hashCode;
@override
- String toString() => "SourceContainer[${_path}]";
+ String toString() => "SourceContainer[$_path]";
}
/**
@@ -175,9 +175,9 @@
String scheme = uri.scheme;
String part = uri.path;
if (scheme == DartUriResolver.DART_SCHEME && part.indexOf('/') < 0) {
- part = "${part}/${part}.dart";
+ part = "$part/$part.dart";
}
- baseUri = parseUriWithException("${scheme}:/${part}");
+ baseUri = parseUriWithException("$scheme:/$part");
}
Uri result = baseUri.resolveUri(containedUri);
if (isOpaque) {
@@ -185,7 +185,7 @@
}
return result;
} catch (exception, stackTrace) {
- throw new AnalysisException("Could not resolve URI (${containedUri}) relative to source (${uri})", new CaughtException(exception, stackTrace));
+ throw new AnalysisException("Could not resolve URI ($containedUri) relative to source ($uri)", new CaughtException(exception, stackTrace));
}
}
@@ -345,6 +345,18 @@
}
}
+ /**
+ * If the list of package directories contains one element, return it.
+ * Otherwise raise an exception. Intended for testing.
+ */
+ String get packagesDirectory_forTesting {
+ int length = _packagesDirectories.length;
+ if (length != 1) {
+ throw new Exception('Expected 1 package directory, found $length');
+ }
+ return _packagesDirectories[0].getPath();
+ }
+
@override
Source resolveAbsolute(Uri uri) {
if (!isPackageUri(uri)) {
@@ -397,7 +409,7 @@
String pkgCanonicalPath = pkgFolder.getCanonicalPath();
if (sourcePath.startsWith(pkgCanonicalPath)) {
String relPath = sourcePath.substring(pkgCanonicalPath.length);
- return parseUriWithException("${PACKAGE_SCHEME}:${pkgFolder.getName()}${relPath}");
+ return parseUriWithException("$PACKAGE_SCHEME:${pkgFolder.getName()}$relPath");
}
} catch (e) {
}
@@ -423,10 +435,10 @@
pkgDir = pkgDir.getCanonicalFile();
} on JavaIOException catch (e) {
if (!e.toString().contains("Required key not available")) {
- AnalysisEngine.instance.logger.logError2("Canonical failed: ${pkgDir}", e);
+ AnalysisEngine.instance.logger.logError2("Canonical failed: $pkgDir", e);
} else if (_CanLogRequiredKeyIoException) {
_CanLogRequiredKeyIoException = false;
- AnalysisEngine.instance.logger.logError2("Canonical failed: ${pkgDir}", e);
+ AnalysisEngine.instance.logger.logError2("Canonical failed: $pkgDir", e);
}
}
return new JavaFile.relative(pkgDir, relPath.replaceAll('/', new String.fromCharCode(JavaFile.separatorChar)));
@@ -443,7 +455,7 @@
}
String rootPath = rootDir.getAbsolutePath();
String filePath = file.getAbsolutePath();
- return filePath.startsWith("${rootPath}/lib");
+ return filePath.startsWith("$rootPath/lib");
}
}
diff --git a/pkg/analyzer/lib/src/generated/testing/ast_factory.dart b/pkg/analyzer/lib/src/generated/testing/ast_factory.dart
index 18490e3..d4328ca 100644
--- a/pkg/analyzer/lib/src/generated/testing/ast_factory.dart
+++ b/pkg/analyzer/lib/src/generated/testing/ast_factory.dart
@@ -340,7 +340,7 @@
static StringInterpolation string(List<InterpolationElement> elements) => new StringInterpolation(list(elements));
- static SimpleStringLiteral string2(String content) => new SimpleStringLiteral(TokenFactory.tokenFromString("'${content}'"), content);
+ static SimpleStringLiteral string2(String content) => new SimpleStringLiteral(TokenFactory.tokenFromString("'$content'"), content);
static SuperConstructorInvocation superConstructorInvocation(List<Expression> arguments) => superConstructorInvocation2(null, arguments);
@@ -363,7 +363,7 @@
for (String component in components) {
identifierList.add(TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, component));
}
- return new SymbolLiteral(TokenFactory.tokenFromType(TokenType.HASH), new List.from(identifierList));
+ return new SymbolLiteral(TokenFactory.tokenFromType(TokenType.HASH), identifierList);
}
static BlockFunctionBody syncBlockFunctionBody(List<Statement> statements) => new BlockFunctionBody(TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "sync"), null, block(statements));
diff --git a/pkg/analyzer/lib/src/generated/testing/element_factory.dart b/pkg/analyzer/lib/src/generated/testing/element_factory.dart
index 60f0fff..44e90c2 100644
--- a/pkg/analyzer/lib/src/generated/testing/element_factory.dart
+++ b/pkg/analyzer/lib/src/generated/testing/element_factory.dart
@@ -65,7 +65,7 @@
int count = argumentTypes.length;
List<ParameterElement> parameters = new List<ParameterElement>(count);
for (int i = 0; i < count; i++) {
- ParameterElementImpl parameter = new ParameterElementImpl("a${i}", i);
+ ParameterElementImpl parameter = new ParameterElementImpl("a$i", i);
parameter.type = argumentTypes[i];
parameter.parameterKind = ParameterKind.REQUIRED;
parameters[i] = parameter;
@@ -128,7 +128,7 @@
//
// Finish building the enum.
//
- enumElement.fields = new List.from(fields);
+ enumElement.fields = fields;
// Client code isn't allowed to invoke the constructor, so we do not model it.
return enumElement;
}
@@ -159,7 +159,7 @@
setter.setter = true;
setter.synthetic = true;
setter.variable = field;
- setter.parameters = <ParameterElement> [requiredParameter2("_${name}", type)];
+ setter.parameters = <ParameterElement> [requiredParameter2("_$name", type)];
setter.returnType = VoidTypeImpl.instance;
setter.type = new FunctionTypeImpl.con1(setter);
field.setter = setter;
@@ -190,7 +190,7 @@
int totalCount = normalCount + optionalCount;
List<ParameterElement> parameters = new List<ParameterElement>(totalCount);
for (int i = 0; i < totalCount; i++) {
- ParameterElementImpl parameter = new ParameterElementImpl("a${i}", i);
+ ParameterElementImpl parameter = new ParameterElementImpl("a$i", i);
if (i < normalCount) {
parameter.type = normalParameters[i].type;
parameter.parameterKind = ParameterKind.REQUIRED;
@@ -220,7 +220,7 @@
List<ParameterElement> parameters = new List<ParameterElement>(totalCount);
for (int i = 0; i < totalCount; i++) {
if (i < normalCount) {
- ParameterElementImpl parameter = new ParameterElementImpl("a${i}", i);
+ ParameterElementImpl parameter = new ParameterElementImpl("a$i", i);
parameter.type = normalParameters[i].type;
parameter.parameterKind = ParameterKind.REQUIRED;
parameters[i] = parameter;
@@ -296,7 +296,7 @@
}
static LibraryElementImpl library(AnalysisContext context, String libraryName) {
- String fileName = "/${libraryName}.dart";
+ String fileName = "/$libraryName.dart";
CompilationUnitElementImpl unit = compilationUnit(fileName);
LibraryElementImpl library = new LibraryElementImpl(context, libraryName, 0);
library.definingCompilationUnit = unit;
@@ -312,7 +312,7 @@
int count = argumentTypes.length;
List<ParameterElement> parameters = new List<ParameterElement>(count);
for (int i = 0; i < count; i++) {
- ParameterElementImpl parameter = new ParameterElementImpl("a${i}", i);
+ ParameterElementImpl parameter = new ParameterElementImpl("a$i", i);
parameter.type = argumentTypes[i];
parameter.parameterKind = ParameterKind.REQUIRED;
parameters[i] = parameter;
@@ -422,7 +422,7 @@
setter.static = true;
setter.synthetic = true;
setter.variable = variable;
- setter.parameters = <ParameterElement> [requiredParameter2("_${name}", type)];
+ setter.parameters = <ParameterElement> [requiredParameter2("_$name", type)];
setter.returnType = VoidTypeImpl.instance;
setter.type = new FunctionTypeImpl.con1(setter);
variable.setter = setter;
diff --git a/pkg/analyzer/lib/src/generated/utilities_collection.dart b/pkg/analyzer/lib/src/generated/utilities_collection.dart
index f89d69f..04d6177 100644
--- a/pkg/analyzer/lib/src/generated/utilities_collection.dart
+++ b/pkg/analyzer/lib/src/generated/utilities_collection.dart
@@ -8,6 +8,8 @@
library engine.utilities.collection;
import 'dart:collection';
+import "dart:math" as math;
+
import 'java_core.dart';
import 'scanner.dart' show Token;
@@ -76,7 +78,7 @@
*/
static void _checkIndex(int index) {
if (index < 0 || index > 30) {
- throw new RangeError("Index not between 0 and 30: ${index}");
+ throw new RangeError("Index not between 0 and 30: $index");
}
}
}
@@ -440,10 +442,10 @@
if (wInfo == null) {
// Successor w has not yet been visited; recurse on it
wInfo = _strongConnect(w);
- vInfo.lowlink = Math.min(vInfo.lowlink, wInfo.lowlink);
+ vInfo.lowlink = math.min(vInfo.lowlink, wInfo.lowlink);
} else if (wInfo.onStack) {
// Successor w is in stack S and hence in the current SCC
- vInfo.lowlink = Math.min(vInfo.lowlink, wInfo.index);
+ vInfo.lowlink = math.min(vInfo.lowlink, wInfo.index);
}
}
}
diff --git a/pkg/analyzer/lib/src/services/formatter_impl.dart b/pkg/analyzer/lib/src/services/formatter_impl.dart
index 0c272f1..d35bd2b 100644
--- a/pkg/analyzer/lib/src/services/formatter_impl.dart
+++ b/pkg/analyzer/lib/src/services/formatter_impl.dart
@@ -51,7 +51,7 @@
//TODO(pquitslund): consider a verbosity flag to add/suppress details
var errorCode = errors[0].errorCode;
var phase = errorCode is ParserErrorCode ? 'parsing' : 'scanning';
- return 'An error occured while ${phase} (${errorCode.name}).';
+ return 'An error occured while $phase (${errorCode.name}).';
}
String toString() => '$message';
@@ -206,7 +206,7 @@
if (!isEOF(token2) &&
!(isCLOSE_CURLY_BRACKET(token2) && isEOF(token2.next))) {
throw new FormatterException(
- 'Expected "EOF" but got "${token2}".');
+ 'Expected "EOF" but got "$token2".');
}
}
@@ -216,7 +216,7 @@
while (comment1 != null) {
if (comment2 == null) {
throw new FormatterException(
- 'Expected comment, "${comment1}", at ${describeLocation(token1)}, '
+ 'Expected comment, "$comment1", at ${describeLocation(token1)}, '
'but got none.');
}
if (!equivalentComments(comment1, comment2)) {
@@ -227,7 +227,7 @@
}
if (comment2 != null) {
throw new FormatterException(
- 'Unexpected comment, "${comment2}", at ${describeLocation(token2)}.');
+ 'Unexpected comment, "$comment2", at ${describeLocation(token2)}.');
}
}
@@ -236,7 +236,7 @@
throwNotEqualException(t1, t2) {
throw new FormatterException(
- 'Expected "${t1}" but got "${t2}", at ${describeLocation(t1)}.');
+ 'Expected "$t1" but got "$t2", at ${describeLocation(t1)}.');
}
String describeLocation(Token token) => lineInfo == null ? '<unknown>' :
diff --git a/pkg/analyzer/lib/src/services/runtime/coverage/models.dart b/pkg/analyzer/lib/src/services/runtime/coverage/models.dart
index 74fc7aa..bf247f3 100644
--- a/pkg/analyzer/lib/src/services/runtime/coverage/models.dart
+++ b/pkg/analyzer/lib/src/services/runtime/coverage/models.dart
@@ -89,7 +89,7 @@
}
// Print source and line ranges.
if (children.isEmpty) {
- sink.write('${prefix} "ranges": [');
+ sink.write('$prefix "ranges": [');
var rangePrinter = new RangePrinter(unit, sink, executedIds);
idToRange.forEach(rangePrinter.handle);
rangePrinter.printRange();
diff --git a/pkg/analyzer/lib/src/services/runtime/log.dart b/pkg/analyzer/lib/src/services/runtime/log.dart
index 48d66d7..6d3c9a6 100644
--- a/pkg/analyzer/lib/src/services/runtime/log.dart
+++ b/pkg/analyzer/lib/src/services/runtime/log.dart
@@ -41,7 +41,7 @@
_logger.onRecord.listen((LogRecord record) {
String levelString = record.level.toString();
while (levelString.length < 6) levelString += ' ';
- print('${record.time}: ${levelString} ${record.message}');
+ print('${record.time}: $levelString ${record.message}');
});
}
diff --git a/pkg/analyzer/lib/src/util/utilities_timing.dart b/pkg/analyzer/lib/src/util/utilities_timing.dart
new file mode 100644
index 0000000..4d07fcd
--- /dev/null
+++ b/pkg/analyzer/lib/src/util/utilities_timing.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+library engine.utilities.timing;
+
+/**
+ * A `CountedStopwatch` is a [Stopwatch] that counts the number of times the
+ * stop method has been invoked.
+ */
+class CountedStopwatch extends Stopwatch {
+ /**
+ * The number of times the [stop] method has been invoked.
+ */
+ int stopCount = 0;
+
+ /**
+ * Initialize a newly created stopwatch.
+ */
+ CountedStopwatch();
+
+ /**
+ * The average number of millisecond that were recorded each time the [start]
+ * and [stop] methods were invoked.
+ */
+ int get averageMilliseconds => elapsedMilliseconds ~/ stopCount;
+
+ @override
+ void stop() {
+ super.stop();
+ stopCount++;
+ }
+
+ @override
+ void reset() {
+ super.reset();
+ stopCount = 0;
+ }
+}
\ No newline at end of file
diff --git a/pkg/analyzer/test/generated/all_the_rest.dart b/pkg/analyzer/test/generated/all_the_rest.dart
index c194f19..7aa42b0 100644
--- a/pkg/analyzer/test/generated/all_the_rest.dart
+++ b/pkg/analyzer/test/generated/all_the_rest.dart
@@ -19,7 +19,6 @@
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/java_engine_io.dart';
import 'package:analyzer/src/generated/java_io.dart';
-import 'package:analyzer/src/generated/java_junit.dart';
import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/scanner.dart';
import 'package:analyzer/src/generated/sdk.dart';
@@ -31,7 +30,7 @@
import 'package:analyzer/src/generated/testing/html_factory.dart';
import 'package:analyzer/src/generated/utilities_collection.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
-import 'package:unittest/unittest.dart' as _ut;
+import 'package:unittest/unittest.dart';
import '../reflective_tests.dart';
import 'parser_test.dart';
@@ -40,7 +39,7 @@
main() {
- _ut.groupSep = ' | ';
+ groupSep = ' | ';
runReflectiveTests(AngularCompilationUnitBuilderTest);
runReflectiveTests(AngularHtmlUnitResolverTest);
runReflectiveTests(AngularHtmlUnitUtilsTest);
@@ -74,7 +73,7 @@
runReflectiveTests(StringScannerTest);
}
-abstract class AbstractScannerTest extends JUnitTestCase {
+abstract class AbstractScannerTest {
ht.AbstractScanner newScanner(String input);
void test_tokenize_attribute() {
@@ -250,11 +249,11 @@
" "],
<int>[0, 9, 21, 25, 28, 38, 49]);
token = token.next;
- JUnitTestCase.assertEquals(1, token.offset);
+ expect(token.offset, 1);
token = token.next;
- JUnitTestCase.assertEquals(3, token.offset);
+ expect(token.offset, 3);
token = token.next;
- JUnitTestCase.assertEquals(10, token.offset);
+ expect(token.offset, 10);
}
void test_tokenize_string() {
@@ -309,7 +308,7 @@
ht.Token token =
_tokenize("<html>", <Object>[ht.TokenType.LT, "html", ht.TokenType.GT]);
token = token.next;
- JUnitTestCase.assertEquals(1, token.offset);
+ expect(token.offset, 1);
}
void test_tokenize_tag_incomplete_with_special_characters() {
@@ -369,8 +368,7 @@
}
return ht.TokenType.TEXT;
}
- JUnitTestCase.fail(
- "Unknown expected token ${count}: ${(expected != null ? expected.runtimeType : "null")}");
+ fail("Unknown expected token $count: ${expected != null ? expected.runtimeType : "null"}");
return null;
}
@@ -397,38 +395,32 @@
ht.Token firstToken = scanner.tokenize();
ht.Token token = firstToken;
ht.Token previousToken = token.previous;
- JUnitTestCase.assertTrue(previousToken.type == ht.TokenType.EOF);
- JUnitTestCase.assertSame(previousToken, previousToken.previous);
- JUnitTestCase.assertEquals(-1, previousToken.offset);
- JUnitTestCase.assertSame(token, previousToken.next);
- JUnitTestCase.assertEquals(0, token.offset);
+ expect(previousToken.type == ht.TokenType.EOF, isTrue);
+ expect(previousToken.previous, same(previousToken));
+ expect(previousToken.offset, -1);
+ expect(previousToken.next, same(token));
+ expect(token.offset, 0);
while (token.type != ht.TokenType.EOF) {
if (count == expectedTokens.length) {
- JUnitTestCase.fail("too many parsed tokens");
+ fail("too many parsed tokens");
}
Object expected = expectedTokens[count];
ht.TokenType expectedTokenType = _getExpectedTokenType(count, expected);
- JUnitTestCase.assertSameMsg(
- "token ${count}",
- expectedTokenType,
- token.type);
+ expect(token.type, same(expectedTokenType), reason: "token $count");
if (expectedTokenType.lexeme != null) {
- JUnitTestCase.assertEqualsMsg(
- "token ${count}",
- expectedTokenType.lexeme,
- token.lexeme);
+ expect(token.lexeme, expectedTokenType.lexeme, reason: "token $count");
} else {
- JUnitTestCase.assertEqualsMsg("token ${count}", expected, token.lexeme);
+ expect(token.lexeme, expected, reason: "token $count");
}
count++;
previousToken = token;
token = token.next;
- JUnitTestCase.assertSame(previousToken, token.previous);
+ expect(token.previous, same(previousToken));
}
- JUnitTestCase.assertSame(token, token.next);
- JUnitTestCase.assertEquals(input.length, token.offset);
+ expect(token.next, same(token));
+ expect(token.offset, input.length);
if (count != expectedTokens.length) {
- JUnitTestCase.assertTrueMsg("not enough parsed tokens", false);
+ expect(false, isTrue, reason: "not enough parsed tokens");
}
List<int> lineStarts = scanner.lineStarts;
bool success = expectedLineStarts.length == lineStarts.length;
@@ -441,18 +433,18 @@
}
}
if (!success) {
- JavaStringBuilder msg = new JavaStringBuilder();
- msg.append("Expected line starts ");
+ StringBuffer buffer = new StringBuffer();
+ buffer.write("Expected line starts ");
for (int start in expectedLineStarts) {
- msg.append(start);
- msg.append(", ");
+ buffer.write(start);
+ buffer.write(", ");
}
- msg.append(" but found ");
+ buffer.write(" but found ");
for (int start in lineStarts) {
- msg.append(start);
- msg.append(", ");
+ buffer.write(start);
+ buffer.write(", ");
}
- JUnitTestCase.fail(msg.toString());
+ fail(buffer.toString());
}
return firstToken;
}
@@ -461,32 +453,31 @@
class AngularCompilationUnitBuilderTest extends AngularTest {
void test_Decorator() {
- String mainContent = _createAngularSource(
- [
- "@Decorator(selector: '[my-dir]',",
- " map: const {",
- " 'my-dir' : '=>myPropA',",
- " '.' : '&myPropB',",
- " })",
- "class MyDirective {",
- " set myPropA(value) {}",
- " set myPropB(value) {}",
- " @NgTwoWay('my-prop-c')",
- " String myPropC;",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Decorator(selector: '[my-dir]',
+ map: const {
+ 'my-dir' : '=>myPropA',
+ '.' : '&myPropB',
+ })
+class MyDirective {
+ set myPropA(value) {}
+ set myPropB(value) {}
+ @NgTwoWay('my-prop-c')
+ String myPropC;
+}''');
resolveMainSourceNoErrors(mainContent);
// prepare AngularDirectiveElement
ClassElement classElement = mainUnitElement.getType("MyDirective");
AngularDecoratorElement directive =
getAngularElement(classElement, (e) => e is AngularDecoratorElement);
- JUnitTestCase.assertNotNull(directive);
+ expect(directive, isNotNull);
// verify
- JUnitTestCase.assertEquals(null, directive.name);
- JUnitTestCase.assertEquals(-1, directive.nameOffset);
+ expect(directive.name, null);
+ expect(directive.nameOffset, -1);
_assertHasAttributeSelector(directive.selector, "my-dir");
// verify properties
List<AngularPropertyElement> properties = directive.properties;
- EngineTestCase.assertLength(3, properties);
+ expect(properties, hasLength(3));
_assertProperty(
properties[0],
"my-dir",
@@ -511,58 +502,60 @@
}
void test_Decorator_bad_cannotParseSelector() {
- String mainContent = _createAngularSource(
- [
- "@Decorator(selector: '~bad-selector',",
- " map: const {",
- " 'my-dir' : '=>myPropA',",
- " '.' : '&myPropB',",
- " })",
- "class MyDirective {",
- " set myPropA(value) {}",
- " set myPropB(value) {}",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Decorator(selector: '~bad-selector',
+ map: const {
+ 'my-dir' : '=>myPropA',
+ '.' : '&myPropB',
+ })
+class MyDirective {
+ set myPropA(value) {}
+ set myPropB(value) {}
+}''');
resolveMainSource(mainContent);
// has error
assertMainErrors([AngularCode.CANNOT_PARSE_SELECTOR]);
}
void test_Decorator_bad_missingSelector() {
- String mainContent = _createAngularSource(
- [
- "@Decorator(/*selector: '[my-dir]',*/",
- " map: const {",
- " 'my-dir' : '=>myPropA',",
- " '.' : '&myPropB',",
- " })",
- "class MyDirective {",
- " set myPropA(value) {}",
- " set myPropB(value) {}",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Decorator(/*selector: '[my-dir]',*/
+ map: const {
+ 'my-dir' : '=>myPropA',
+ '.' : '&myPropB',
+ })
+class MyDirective {
+ set myPropA(value) {}
+ set myPropB(value) {}
+}''');
resolveMainSource(mainContent);
// has error
assertMainErrors([AngularCode.MISSING_SELECTOR]);
}
void test_Formatter() {
- String mainContent = _createAngularSource(
- ["@Formatter(name: 'myFilter')", "class MyFilter {", " call(p1, p2) {}", "}"]);
+ String mainContent = _createAngularSource(r'''
+@Formatter(name: 'myFilter')
+class MyFilter {
+ call(p1, p2) {}
+}''');
resolveMainSourceNoErrors(mainContent);
// prepare AngularFilterElement
ClassElement classElement = mainUnitElement.getType("MyFilter");
AngularFormatterElement filter =
getAngularElement(classElement, (e) => e is AngularFormatterElement);
- JUnitTestCase.assertNotNull(filter);
+ expect(filter, isNotNull);
// verify
- JUnitTestCase.assertEquals("myFilter", filter.name);
- JUnitTestCase.assertEquals(
- AngularTest.findOffset(mainContent, "myFilter'"),
- filter.nameOffset);
+ expect(filter.name, "myFilter");
+ expect(filter.nameOffset, AngularTest.findOffset(mainContent, "myFilter'"));
}
void test_Formatter_missingName() {
- String mainContent = _createAngularSource(
- ["@Formatter()", "class MyFilter {", " call(p1, p2) {}", "}"]);
+ String mainContent = _createAngularSource(r'''
+@Formatter()
+class MyFilter {
+ call(p1, p2) {}
+}''');
resolveMainSource(mainContent);
// has error
assertMainErrors([AngularCode.MISSING_NAME]);
@@ -570,18 +563,17 @@
ClassElement classElement = mainUnitElement.getType("MyFilter");
AngularFormatterElement filter =
getAngularElement(classElement, (e) => e is AngularFormatterElement);
- JUnitTestCase.assertNull(filter);
+ expect(filter, isNull);
}
void test_NgComponent_bad_cannotParseSelector() {
contextHelper.addSource("/my_template.html", "");
contextHelper.addSource("/my_styles.css", "");
- String mainContent = _createAngularSource(
- [
- "@Component(publishAs: 'ctrl', selector: '~myComp',",
- " templateUrl: 'my_template.html', cssUrl: 'my_styles.css')",
- "class MyComponent {",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Component(publishAs: 'ctrl', selector: '~myComp',
+ templateUrl: 'my_template.html', cssUrl: 'my_styles.css')
+class MyComponent {
+}''');
resolveMainSource(mainContent);
// has error
assertMainErrors([AngularCode.CANNOT_PARSE_SELECTOR]);
@@ -590,12 +582,11 @@
void test_NgComponent_bad_missingSelector() {
contextHelper.addSource("/my_template.html", "");
contextHelper.addSource("/my_styles.css", "");
- String mainContent = _createAngularSource(
- [
- "@Component(publishAs: 'ctrl', /*selector: 'myComp',*/",
- " templateUrl: 'my_template.html', cssUrl: 'my_styles.css')",
- "class MyComponent {",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Component(publishAs: 'ctrl', /*selector: 'myComp',*/
+ templateUrl: 'my_template.html', cssUrl: 'my_styles.css')
+class MyComponent {
+}''');
resolveMainSource(mainContent);
// has error
assertMainErrors([AngularCode.MISSING_SELECTOR]);
@@ -609,25 +600,23 @@
contextHelper.addSource("/my_template", "");
contextHelper.addSource("/my_styles.css", "");
addMainSource(
- _createAngularSource(
- [
- "@NgComponent(publishAs: 'ctrl', selector: 'myComp',",
- " templateUrl: 'my_template', cssUrl: 'my_styles.css')",
- "class MyComponent {",
- "}"]));
+ _createAngularSource(r'''
+@NgComponent(publishAs: 'ctrl', selector: 'myComp',
+ templateUrl: 'my_template', cssUrl: 'my_styles.css')
+class MyComponent {
+}'''));
contextHelper.runTasks();
}
void test_NgComponent_bad_properties_invalidBinding() {
contextHelper.addSource("/my_template.html", "");
contextHelper.addSource("/my_styles.css", "");
- String mainContent = _createAngularSource(
- [
- "@Component(publishAs: 'ctrl', selector: 'myComp',",
- " templateUrl: 'my_template.html', cssUrl: 'my_styles.css',",
- " map: const {'name' : '?field'})",
- "class MyComponent {",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Component(publishAs: 'ctrl', selector: 'myComp',
+ templateUrl: 'my_template.html', cssUrl: 'my_styles.css',
+ map: const {'name' : '?field'})
+class MyComponent {
+}''');
resolveMainSource(mainContent);
// has error
assertMainErrors([AngularCode.INVALID_PROPERTY_KIND]);
@@ -636,13 +625,12 @@
void test_NgComponent_bad_properties_nameNotStringLiteral() {
contextHelper.addSource("/my_template.html", "");
contextHelper.addSource("/my_styles.css", "");
- String mainContent = _createAngularSource(
- [
- "@Component(publishAs: 'ctrl', selector: 'myComp',",
- " templateUrl: 'my_template.html', cssUrl: 'my_styles.css',",
- " map: const {null : 'field'})",
- "class MyComponent {",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Component(publishAs: 'ctrl', selector: 'myComp',
+ templateUrl: 'my_template.html', cssUrl: 'my_styles.css',
+ map: const {null : 'field'})
+class MyComponent {
+}''');
resolveMainSource(mainContent);
// has error
assertMainErrors([AngularCode.INVALID_PROPERTY_NAME]);
@@ -651,13 +639,12 @@
void test_NgComponent_bad_properties_noSuchField() {
contextHelper.addSource("/my_template.html", "");
contextHelper.addSource("/my_styles.css", "");
- String mainContent = _createAngularSource(
- [
- "@Component(publishAs: 'ctrl', selector: 'myComp',",
- " templateUrl: 'my_template.html', cssUrl: 'my_styles.css',",
- " map: const {'name' : '=>field'})",
- "class MyComponent {",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Component(publishAs: 'ctrl', selector: 'myComp',
+ templateUrl: 'my_template.html', cssUrl: 'my_styles.css',
+ map: const {'name' : '=>field'})
+class MyComponent {
+}''');
resolveMainSource(mainContent);
// has error
assertMainErrors([AngularCode.INVALID_PROPERTY_FIELD]);
@@ -666,13 +653,12 @@
void test_NgComponent_bad_properties_notMapLiteral() {
contextHelper.addSource("/my_template.html", "");
contextHelper.addSource("/my_styles.css", "");
- String mainContent = _createAngularSource(
- [
- "@Component(publishAs: 'ctrl', selector: 'myComp',",
- " templateUrl: 'my_template.html', cssUrl: 'my_styles.css',",
- " map: null)",
- "class MyComponent {",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Component(publishAs: 'ctrl', selector: 'myComp',
+ templateUrl: 'my_template.html', cssUrl: 'my_styles.css',
+ map: null)
+class MyComponent {
+}''');
resolveMainSource(mainContent);
// has error
assertMainErrors([AngularCode.INVALID_PROPERTY_MAP]);
@@ -681,13 +667,12 @@
void test_NgComponent_bad_properties_specNotStringLiteral() {
contextHelper.addSource("/my_template.html", "");
contextHelper.addSource("/my_styles.css", "");
- String mainContent = _createAngularSource(
- [
- "@Component(publishAs: 'ctrl', selector: 'myComp',",
- " templateUrl: 'my_template.html', cssUrl: 'my_styles.css',",
- " map: const {'name' : null})",
- "class MyComponent {",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Component(publishAs: 'ctrl', selector: 'myComp',
+ templateUrl: 'my_template.html', cssUrl: 'my_styles.css',
+ map: const {'name' : null})
+class MyComponent {
+}''');
resolveMainSource(mainContent);
// has error
assertMainErrors([AngularCode.INVALID_PROPERTY_SPEC]);
@@ -696,62 +681,59 @@
void test_NgComponent_no_cssUrl() {
contextHelper.addSource("/my_template.html", "");
contextHelper.addSource("/my_styles.css", "");
- String mainContent = _createAngularSource(
- [
- "@Component(publishAs: 'ctrl', selector: 'myComp',",
- " templateUrl: 'my_template.html'/*, cssUrl: 'my_styles.css'*/)",
- "class MyComponent {",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Component(publishAs: 'ctrl', selector: 'myComp',
+ templateUrl: 'my_template.html'/*, cssUrl: 'my_styles.css'*/)
+class MyComponent {
+}''');
resolveMainSource(mainContent);
// prepare AngularComponentElement
ClassElement classElement = mainUnitElement.getType("MyComponent");
AngularComponentElement component =
getAngularElement(classElement, (e) => e is AngularComponentElement);
- JUnitTestCase.assertNotNull(component);
+ expect(component, isNotNull);
// no CSS
- JUnitTestCase.assertEquals(null, component.styleUri);
- JUnitTestCase.assertEquals(-1, component.styleUriOffset);
+ expect(component.styleUri, null);
+ expect(component.styleUriOffset, -1);
}
void test_NgComponent_no_publishAs() {
contextHelper.addSource("/my_template.html", "");
contextHelper.addSource("/my_styles.css", "");
- String mainContent = _createAngularSource(
- [
- "@Component(/*publishAs: 'ctrl',*/ selector: 'myComp',",
- " templateUrl: 'my_template.html', cssUrl: 'my_styles.css')",
- "class MyComponent {",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Component(/*publishAs: 'ctrl',*/ selector: 'myComp',
+ templateUrl: 'my_template.html', cssUrl: 'my_styles.css')
+class MyComponent {
+}''');
resolveMainSource(mainContent);
// prepare AngularComponentElement
ClassElement classElement = mainUnitElement.getType("MyComponent");
AngularComponentElement component =
getAngularElement(classElement, (e) => e is AngularComponentElement);
- JUnitTestCase.assertNotNull(component);
+ expect(component, isNotNull);
// no name
- JUnitTestCase.assertEquals(null, component.name);
- JUnitTestCase.assertEquals(-1, component.nameOffset);
+ expect(component.name, null);
+ expect(component.nameOffset, -1);
}
void test_NgComponent_no_templateUrl() {
contextHelper.addSource("/my_template.html", "");
contextHelper.addSource("/my_styles.css", "");
- String mainContent = _createAngularSource(
- [
- "@Component(publishAs: 'ctrl', selector: 'myComp',",
- " /*templateUrl: 'my_template.html',*/ cssUrl: 'my_styles.css')",
- "class MyComponent {",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Component(publishAs: 'ctrl', selector: 'myComp',
+ /*templateUrl: 'my_template.html',*/ cssUrl: 'my_styles.css')
+class MyComponent {
+}''');
resolveMainSource(mainContent);
// prepare AngularComponentElement
ClassElement classElement = mainUnitElement.getType("MyComponent");
AngularComponentElement component =
getAngularElement(classElement, (e) => e is AngularComponentElement);
- JUnitTestCase.assertNotNull(component);
+ expect(component, isNotNull);
// no template
- JUnitTestCase.assertEquals(null, component.templateUri);
- JUnitTestCase.assertEquals(null, component.templateSource);
- JUnitTestCase.assertEquals(-1, component.templateUriOffset);
+ expect(component.templateUri, null);
+ expect(component.templateSource, null);
+ expect(component.templateUriOffset, -1);
}
/**
@@ -760,15 +742,14 @@
void test_NgComponent_notAngular() {
contextHelper.addSource("/my_template.html", "");
contextHelper.addSource("/my_styles.css", "");
- String mainContent = EngineTestCase.createSource(
- [
- "class Component {",
- " const Component(a, b);",
- "}",
- "",
- "@Component('foo', 42)",
- "class MyComponent {",
- "}"]);
+ String mainContent = r'''
+class Component {
+ const Component(a, b);
+}
+
+@Component('foo', 42)
+class MyComponent {
+}''';
resolveMainSource(mainContent);
assertNoMainErrors();
}
@@ -777,29 +758,28 @@
contextHelper.addSource("/my_template.html", "");
contextHelper.addSource("/my_styles.css", "");
resolveMainSourceNoErrors(
- _createAngularSource(
- [
- "class MySuper {",
- " var myPropA;",
- "}",
- "",
- "",
- "",
- "@Component(publishAs: 'ctrl', selector: 'myComp',",
- " templateUrl: 'my_template.html', cssUrl: 'my_styles.css',",
- " map: const {",
- " 'prop-a' : '@myPropA'",
- " })",
- "class MyComponent extends MySuper {",
- "}"]));
+ _createAngularSource(r'''
+class MySuper {
+ var myPropA;
+}
+
+
+
+@Component(publishAs: 'ctrl', selector: 'myComp',
+ templateUrl: 'my_template.html', cssUrl: 'my_styles.css',
+ map: const {
+ 'prop-a' : '@myPropA'
+ })
+class MyComponent extends MySuper {
+}'''));
// prepare AngularComponentElement
ClassElement classElement = mainUnitElement.getType("MyComponent");
AngularComponentElement component =
getAngularElement(classElement, (e) => e is AngularComponentElement);
- JUnitTestCase.assertNotNull(component);
+ expect(component, isNotNull);
// verify
List<AngularPropertyElement> properties = component.properties;
- EngineTestCase.assertLength(1, properties);
+ expect(properties, hasLength(1));
_assertProperty(
properties[0],
"prop-a",
@@ -813,30 +793,29 @@
contextHelper.addSource("/my_template.html", "");
contextHelper.addSource("/my_styles.css", "");
resolveMainSourceNoErrors(
- _createAngularSource(
- [
- "@Component(publishAs: 'ctrl', selector: 'myComp',",
- " templateUrl: 'my_template.html', cssUrl: 'my_styles.css')",
- "class MyComponent {",
- " @NgAttr('prop-a')",
- " var myPropA;",
- " @NgCallback('prop-b')",
- " var myPropB;",
- " @NgOneWay('prop-c')",
- " var myPropC;",
- " @NgOneWayOneTime('prop-d')",
- " var myPropD;",
- " @NgTwoWay('prop-e')",
- " var myPropE;",
- "}"]));
+ _createAngularSource(r'''
+@Component(publishAs: 'ctrl', selector: 'myComp',
+ templateUrl: 'my_template.html', cssUrl: 'my_styles.css')
+class MyComponent {
+ @NgAttr('prop-a')
+ var myPropA;
+ @NgCallback('prop-b')
+ var myPropB;
+ @NgOneWay('prop-c')
+ var myPropC;
+ @NgOneWayOneTime('prop-d')
+ var myPropD;
+ @NgTwoWay('prop-e')
+ var myPropE;
+}'''));
// prepare AngularComponentElement
ClassElement classElement = mainUnitElement.getType("MyComponent");
AngularComponentElement component =
getAngularElement(classElement, (e) => e is AngularComponentElement);
- JUnitTestCase.assertNotNull(component);
+ expect(component, isNotNull);
// verify
List<AngularPropertyElement> properties = component.properties;
- EngineTestCase.assertLength(5, properties);
+ expect(properties, hasLength(5));
_assertProperty(
properties[0],
"prop-a",
@@ -878,32 +857,31 @@
contextHelper.addSource("/my_template.html", "");
contextHelper.addSource("/my_styles.css", "");
resolveMainSourceNoErrors(
- _createAngularSource(
- [
- "@Component(publishAs: 'ctrl', selector: 'myComp',",
- " templateUrl: 'my_template.html', cssUrl: 'my_styles.css',",
- " map: const {",
- " 'prop-a' : '@myPropA',",
- " 'prop-b' : '&myPropB',",
- " 'prop-c' : '=>myPropC',",
- " 'prop-d' : '=>!myPropD',",
- " 'prop-e' : '<=>myPropE'",
- " })",
- "class MyComponent {",
- " var myPropA;",
- " var myPropB;",
- " var myPropC;",
- " var myPropD;",
- " var myPropE;",
- "}"]));
+ _createAngularSource(r'''
+@Component(publishAs: 'ctrl', selector: 'myComp',
+ templateUrl: 'my_template.html', cssUrl: 'my_styles.css',
+ map: const {
+ 'prop-a' : '@myPropA',
+ 'prop-b' : '&myPropB',
+ 'prop-c' : '=>myPropC',
+ 'prop-d' : '=>!myPropD',
+ 'prop-e' : '<=>myPropE'
+ })
+class MyComponent {
+ var myPropA;
+ var myPropB;
+ var myPropC;
+ var myPropD;
+ var myPropE;
+}'''));
// prepare AngularComponentElement
ClassElement classElement = mainUnitElement.getType("MyComponent");
AngularComponentElement component =
getAngularElement(classElement, (e) => e is AngularComponentElement);
- JUnitTestCase.assertNotNull(component);
+ expect(component, isNotNull);
// verify
List<AngularPropertyElement> properties = component.properties;
- EngineTestCase.assertLength(5, properties);
+ expect(properties, hasLength(5));
_assertProperty(
properties[0],
"prop-a",
@@ -944,138 +922,124 @@
void test_NgComponent_properties_no() {
contextHelper.addSource("/my_template.html", "");
contextHelper.addSource("/my_styles.css", "");
- String mainContent = _createAngularSource(
- [
- "@Component(publishAs: 'ctrl', selector: 'myComp',",
- " templateUrl: 'my_template.html', cssUrl: 'my_styles.css')",
- "class MyComponent {",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Component(publishAs: 'ctrl', selector: 'myComp',
+ templateUrl: 'my_template.html', cssUrl: 'my_styles.css')
+class MyComponent {
+}''');
resolveMainSourceNoErrors(mainContent);
// prepare AngularComponentElement
ClassElement classElement = mainUnitElement.getType("MyComponent");
AngularComponentElement component =
getAngularElement(classElement, (e) => e is AngularComponentElement);
- JUnitTestCase.assertNotNull(component);
+ expect(component, isNotNull);
// verify
- JUnitTestCase.assertEquals("ctrl", component.name);
- JUnitTestCase.assertEquals(
- AngularTest.findOffset(mainContent, "ctrl'"),
- component.nameOffset);
+ expect(component.name, "ctrl");
+ expect(component.nameOffset, AngularTest.findOffset(mainContent, "ctrl'"));
_assertIsTagSelector(component.selector, "myComp");
- JUnitTestCase.assertEquals("my_template.html", component.templateUri);
- JUnitTestCase.assertEquals(
- AngularTest.findOffset(mainContent, "my_template.html'"),
- component.templateUriOffset);
- JUnitTestCase.assertEquals("my_styles.css", component.styleUri);
- JUnitTestCase.assertEquals(
- AngularTest.findOffset(mainContent, "my_styles.css'"),
- component.styleUriOffset);
- EngineTestCase.assertLength(0, component.properties);
+ expect(component.templateUri, "my_template.html");
+ expect(component.templateUriOffset, AngularTest.findOffset(mainContent, "my_template.html'"));
+ expect(component.styleUri, "my_styles.css");
+ expect(component.styleUriOffset, AngularTest.findOffset(mainContent, "my_styles.css'"));
+ expect(component.properties, hasLength(0));
}
void test_NgComponent_scopeProperties() {
contextHelper.addSource("/my_template.html", "");
contextHelper.addSource("/my_styles.css", "");
- String mainContent = _createAngularSource(
- [
- "@Component(publishAs: 'ctrl', selector: 'myComp',",
- " templateUrl: 'my_template.html', cssUrl: 'my_styles.css')",
- "class MyComponent {",
- " MyComponent(Scope scope) {",
- " scope.context['boolProp'] = true;",
- " scope.context['intProp'] = 42;",
- " scope.context['stringProp'] = 'foo';",
- " // duplicate is ignored",
- " scope.context['boolProp'] = true;",
- " // LHS is not an IndexExpression",
- " var v1;",
- " v1 = 1;",
- " // LHS is not a Scope access",
- " var v2;",
- " v2['name'] = 2;",
- " }",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Component(publishAs: 'ctrl', selector: 'myComp',
+ templateUrl: 'my_template.html', cssUrl: 'my_styles.css')
+class MyComponent {
+ MyComponent(Scope scope) {
+ scope.context['boolProp'] = true;
+ scope.context['intProp'] = 42;
+ scope.context['stringProp'] = 'foo';
+ // duplicate is ignored
+ scope.context['boolProp'] = true;
+ // LHS is not an IndexExpression
+ var v1;
+ v1 = 1;
+ // LHS is not a Scope access
+ var v2;
+ v2['name'] = 2;
+ }
+}''');
resolveMainSourceNoErrors(mainContent);
// prepare AngularComponentElement
ClassElement classElement = mainUnitElement.getType("MyComponent");
AngularComponentElement component =
getAngularElement(classElement, (e) => e is AngularComponentElement);
- JUnitTestCase.assertNotNull(component);
+ expect(component, isNotNull);
// verify
List<AngularScopePropertyElement> scopeProperties =
component.scopeProperties;
- EngineTestCase.assertLength(3, scopeProperties);
+ expect(scopeProperties, hasLength(3));
{
AngularScopePropertyElement property = scopeProperties[0];
- JUnitTestCase.assertSame(property, findMainElement2("boolProp"));
- JUnitTestCase.assertEquals("boolProp", property.name);
- JUnitTestCase.assertEquals(
- AngularTest.findOffset(mainContent, "boolProp'"),
- property.nameOffset);
- JUnitTestCase.assertEquals("bool", property.type.name);
+ expect(findMainElement2("boolProp"), same(property));
+ expect(property.name, "boolProp");
+ expect(property.nameOffset, AngularTest.findOffset(mainContent, "boolProp'"));
+ expect(property.type.name, "bool");
}
{
AngularScopePropertyElement property = scopeProperties[1];
- JUnitTestCase.assertSame(property, findMainElement2("intProp"));
- JUnitTestCase.assertEquals("intProp", property.name);
- JUnitTestCase.assertEquals(
- AngularTest.findOffset(mainContent, "intProp'"),
- property.nameOffset);
- JUnitTestCase.assertEquals("int", property.type.name);
+ expect(findMainElement2("intProp"), same(property));
+ expect(property.name, "intProp");
+ expect(property.nameOffset, AngularTest.findOffset(mainContent, "intProp'"));
+ expect(property.type.name, "int");
}
{
AngularScopePropertyElement property = scopeProperties[2];
- JUnitTestCase.assertSame(property, findMainElement2("stringProp"));
- JUnitTestCase.assertEquals("stringProp", property.name);
- JUnitTestCase.assertEquals(
- AngularTest.findOffset(mainContent, "stringProp'"),
- property.nameOffset);
- JUnitTestCase.assertEquals("String", property.type.name);
+ expect(findMainElement2("stringProp"), same(property));
+ expect(property.name, "stringProp");
+ expect(property.nameOffset, AngularTest.findOffset(mainContent, "stringProp'"));
+ expect(property.type.name, "String");
}
}
void test_NgController() {
- String mainContent = _createAngularSource(
- [
- "@Controller(publishAs: 'ctrl', selector: '[myApp]')",
- "class MyController {",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Controller(publishAs: 'ctrl', selector: '[myApp]')
+class MyController {
+}''');
resolveMainSourceNoErrors(mainContent);
// prepare AngularControllerElement
ClassElement classElement = mainUnitElement.getType("MyController");
AngularControllerElement controller =
getAngularElement(classElement, (e) => e is AngularControllerElement);
- JUnitTestCase.assertNotNull(controller);
+ expect(controller, isNotNull);
// verify
- JUnitTestCase.assertEquals("ctrl", controller.name);
- JUnitTestCase.assertEquals(
- AngularTest.findOffset(mainContent, "ctrl'"),
- controller.nameOffset);
+ expect(controller.name, "ctrl");
+ expect(controller.nameOffset, AngularTest.findOffset(mainContent, "ctrl'"));
_assertHasAttributeSelector(controller.selector, "myApp");
}
void test_NgController_cannotParseSelector() {
- String mainContent = _createAngularSource(
- [
- "@Controller(publishAs: 'ctrl', selector: '~unknown')",
- "class MyController {",
- "}"]);
+ String mainContent = _createAngularSource(r'''
+@Controller(publishAs: 'ctrl', selector: '~unknown')
+class MyController {
+}''');
resolveMainSource(mainContent);
// has error
assertMainErrors([AngularCode.CANNOT_PARSE_SELECTOR]);
}
void test_NgController_missingPublishAs() {
- String mainContent = _createAngularSource(
- ["@Controller(selector: '[myApp]')", "class MyController {", "}"]);
+ String mainContent = _createAngularSource(r'''
+@Controller(selector: '[myApp]')
+class MyController {
+}''');
resolveMainSource(mainContent);
// has error
assertMainErrors([AngularCode.MISSING_PUBLISH_AS]);
}
void test_NgController_missingSelector() {
- String mainContent = _createAngularSource(
- ["@Controller(publishAs: 'ctrl')", "class MyController {", "}"]);
+ String mainContent = _createAngularSource(r'''
+@Controller(publishAs: 'ctrl')
+class MyController {
+}''');
resolveMainSource(mainContent);
// has error
assertMainErrors([AngularCode.MISSING_SELECTOR]);
@@ -1083,37 +1047,40 @@
void test_NgController_noAnnotationArguments() {
String mainContent =
- _createAngularSource(["@NgController", "class MyController {", "}"]);
+ _createAngularSource(r'''
+@NgController
+class MyController {
+}''');
resolveMainSource(mainContent);
}
void test_bad_notConstructorAnnotation() {
- String mainContent = EngineTestCase.createSource(
- ["const MY_ANNOTATION = null;", "@MY_ANNOTATION()", "class MyFilter {", "}"]);
+ String mainContent = r'''
+const MY_ANNOTATION = null;
+@MY_ANNOTATION()
+class MyFilter {
+}''';
resolveMainSource(mainContent);
// prepare AngularFilterElement
ClassElement classElement = mainUnitElement.getType("MyFilter");
AngularFormatterElement filter =
getAngularElement(classElement, (e) => e is AngularFormatterElement);
- JUnitTestCase.assertNull(filter);
+ expect(filter, isNull);
}
void test_getElement_SimpleStringLiteral_withToolkitElement() {
SimpleStringLiteral literal = AstFactory.string2("foo");
Element element = new AngularScopePropertyElementImpl("foo", 0, null);
literal.toolkitElement = element;
- JUnitTestCase.assertSame(
- element,
- AngularCompilationUnitBuilder.getElement(literal, -1));
+ expect(AngularCompilationUnitBuilder.getElement(literal, -1), same(element));
}
void test_getElement_component_name() {
resolveMainSource(
- _createAngularSource(
- [
- "@Component(publishAs: 'ctrl', selector: 'myComp',",
- " templateUrl: 'my_template.html', cssUrl: 'my_styles.css')",
- "class MyComponent {}"]));
+ _createAngularSource(r'''
+@Component(publishAs: 'ctrl', selector: 'myComp',
+ templateUrl: 'my_template.html', cssUrl: 'my_styles.css')
+class MyComponent {}'''));
SimpleStringLiteral node =
_findMainNode("ctrl'", (n) => n is SimpleStringLiteral);
int offset = node.offset;
@@ -1127,38 +1094,36 @@
void test_getElement_component_property_fromFieldAnnotation() {
resolveMainSource(
- _createAngularSource(
- [
- "@Component(publishAs: 'ctrl', selector: 'myComp',",
- " templateUrl: 'my_template.html', cssUrl: 'my_styles.css')",
- "class MyComponent {",
- " @NgOneWay('prop')",
- " var field;",
- "}"]));
+ _createAngularSource(r'''
+@Component(publishAs: 'ctrl', selector: 'myComp',
+ templateUrl: 'my_template.html', cssUrl: 'my_styles.css')
+class MyComponent {
+ @NgOneWay('prop')
+ var field;
+}'''));
// prepare node
SimpleStringLiteral node =
_findMainNode("prop'", (n) => n is SimpleStringLiteral);
int offset = node.offset;
// prepare Element
Element element = AngularCompilationUnitBuilder.getElement(node, offset);
- JUnitTestCase.assertNotNull(element);
+ expect(element, isNotNull);
// check AngularPropertyElement
AngularPropertyElement property = element as AngularPropertyElement;
- JUnitTestCase.assertEquals("prop", property.name);
+ expect(property.name, "prop");
}
void test_getElement_component_property_fromMap() {
resolveMainSource(
- _createAngularSource(
- [
- "@Component(publishAs: 'ctrl', selector: 'myComp',",
- " templateUrl: 'my_template.html', cssUrl: 'my_styles.css',",
- " map: const {",
- " 'prop' : '@field',",
- " })",
- "class MyComponent {",
- " var field;",
- "}"]));
+ _createAngularSource(r'''
+@Component(publishAs: 'ctrl', selector: 'myComp',
+ templateUrl: 'my_template.html', cssUrl: 'my_styles.css',
+ map: const {
+ 'prop' : '@field',
+ })
+class MyComponent {
+ var field;
+}'''));
// AngularPropertyElement
{
SimpleStringLiteral node =
@@ -1166,10 +1131,10 @@
int offset = node.offset;
// prepare Element
Element element = AngularCompilationUnitBuilder.getElement(node, offset);
- JUnitTestCase.assertNotNull(element);
+ expect(element, isNotNull);
// check AngularPropertyElement
AngularPropertyElement property = element as AngularPropertyElement;
- JUnitTestCase.assertEquals("prop", property.name);
+ expect(property.name, "prop");
}