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

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

Issue 677303002: Remove unnecessary List creation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/generated/engine.dart
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 654872af46bbf618cbe0291f52f55db63d47e2b0..dddcb8b2fd937c81af60b55db694ef6598722a34 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -1160,7 +1160,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
if (errors.isEmpty) {
return AnalysisError.NO_ERRORS;
}
- return new List.from(errors);
+ return errors;
} else if (sourceEntry is HtmlEntry) {
HtmlEntry htmlEntry = sourceEntry;
try {
@@ -1382,7 +1382,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
if (htmlSources.isEmpty) {
return Source.EMPTY_ARRAY;
}
- return new List.from(htmlSources);
+ return htmlSources;
}
@override
@@ -1413,7 +1413,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
// }
}
}
- return new List.from(sources);
+ return sources;
}
@override
@@ -1432,7 +1432,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
// }
}
}
- return new List.from(sources);
+ return sources;
}
@override
@@ -1462,7 +1462,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
if (dependentLibraries.isEmpty) {
return Source.EMPTY_ARRAY;
}
- return new List.from(dependentLibraries);
+ return dependentLibraries;
}
@override
@@ -3378,7 +3378,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
sources.add(iterator.key);
}
}
- return new List.from(sources);
+ return sources;
}
/**
@@ -4707,7 +4707,7 @@ class AnalysisContextImpl_CycleBuilder {
_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 @@ class AnalysisContextImpl_CycleBuilder {
_dependencyGraph.addEdge(library, exportedLibrary);
}
}
- library.exportedLibraries = new List.from(exportedLibraries);
+ library.exportedLibraries = exportedLibraries;
}
}
@@ -5101,10 +5101,8 @@ class AnalysisContextStatisticsImpl implements AnalysisContextStatistics {
}
@override
- List<AnalysisContextStatistics_CacheRow> get cacheRows {
- Iterable<AnalysisContextStatistics_CacheRow> items = _dataMap.values;
- return new List.from(items);
- }
+ List<AnalysisContextStatistics_CacheRow> get cacheRows
+ => new List.from(_dataMap.values);
scheglov 2014/10/26 04:52:42 Or just _dataMap.values.toList()
sra1 2014/10/26 06:31:39 It is often better to use .toList() since it carri
Brian Wilkerson 2014/10/26 15:15:46 Thanks! I was wondering whether there was a reason
@override
List<CaughtException> get exceptions => new List.from(_exceptions);
@@ -5113,7 +5111,7 @@ class AnalysisContextStatisticsImpl implements AnalysisContextStatistics {
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));
@@ -6740,15 +6738,15 @@ class AngularHtmlUnitResolver extends ht.RecursiveXmlVisitor<Object> {
}
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 +6766,7 @@ class AngularHtmlUnitResolver extends ht.RecursiveXmlVisitor<Object> {
}
token = token.next;
}
- node.expressions = new List.from(expressions);
+ node.expressions = expressions;
}
void _recordDefinedVariable(LocalVariableElementImpl variable) {
@@ -6839,13 +6837,13 @@ class AngularHtmlUnitResolver extends ht.RecursiveXmlVisitor<Object> {
_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;
}
}
@@ -7952,7 +7950,7 @@ class DartEntry extends SourceEntry {
if (errors.length == 0) {
return AnalysisError.NO_ERRORS;
}
- return new List.from(errors);
+ return errors;
}
/**
@@ -8010,7 +8008,7 @@ class DartEntry extends SourceEntry {
}
state = state._nextState;
}
- return new List.from(result);
+ return result;
}
/**
@@ -11336,7 +11334,7 @@ class PolymerHtmlUnitBuilder extends ht.RecursiveXmlVisitor<Object> {
}
}
// 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 +11363,7 @@ class PolymerHtmlUnitBuilder extends ht.RecursiveXmlVisitor<Object> {
}
attribute.field = field;
}
- _htmlElement.attributes = new List.from(attributes);
+ _htmlElement.attributes = attributes;
}
void _createTagHtmlElement(ht.XmlTagNode node) {
@@ -11643,7 +11641,7 @@ class RecordingErrorListener implements AnalysisErrorListener {
for (MapEntry<Source, HashSet<AnalysisError>> entry in entrySet) {
resultList.addAll(entry.getValue());
}
- return new List.from(resultList);
+ return resultList;
}
/**

Powered by Google App Engine
This is Rietveld 408576698