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

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

Issue 677303002: Remove unnecessary List creation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments 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/ast.dart
diff --git a/pkg/analyzer/lib/src/generated/ast.dart b/pkg/analyzer/lib/src/generated/ast.dart
index bb44db5d5b3ccdd49d072ada95d431440bd68955..8be10192d2f312a27606e34b543aacdc639940c9 100644
--- a/pkg/analyzer/lib/src/generated/ast.dart
+++ b/pkg/analyzer/lib/src/generated/ast.dart
@@ -197,12 +197,10 @@ abstract class AnnotatedNode extends AstNode {
* 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);
}
}
@@ -4325,12 +4323,10 @@ class CompilationUnit extends AstNode {
* 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);
}
}
@@ -13231,12 +13227,10 @@ abstract class NormalFormalParameter extends FormalParameter {
* 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);
}
}
« no previous file with comments | « pkg/analysis_server/lib/src/services/generated/completion.dart ('k') | pkg/analyzer/lib/src/generated/constant.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698