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

Side by Side Diff: pkg/analyzer/lib/src/generated/element.dart

Issue 677303002: Remove unnecessary List creation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.element; 8 library engine.element;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 _toolkitObjects = ArrayUtils.add(_toolkitObjects, toolkitObject); 1295 _toolkitObjects = ArrayUtils.add(_toolkitObjects, toolkitObject);
1296 } 1296 }
1297 1297
1298 @override 1298 @override
1299 List<PropertyAccessorElement> get accessors => _accessors; 1299 List<PropertyAccessorElement> get accessors => _accessors;
1300 1300
1301 @override 1301 @override
1302 List<InterfaceType> get allSupertypes { 1302 List<InterfaceType> get allSupertypes {
1303 List<InterfaceType> list = new List<InterfaceType>(); 1303 List<InterfaceType> list = new List<InterfaceType>();
1304 _collectAllSupertypes(list); 1304 _collectAllSupertypes(list);
1305 return new List.from(list); 1305 return list;
1306 } 1306 }
1307 1307
1308 @override 1308 @override
1309 ElementImpl getChild(String identifier) { 1309 ElementImpl getChild(String identifier) {
1310 // 1310 //
1311 // The casts in this method are safe because the set methods would have thro wn a CCE if any of 1311 // The casts in this method are safe because the set methods would have thro wn a CCE if any of
1312 // the elements in the arrays were not of the expected types. 1312 // the elements in the arrays were not of the expected types.
1313 // 1313 //
1314 for (PropertyAccessorElement accessor in _accessors) { 1314 for (PropertyAccessorElement accessor in _accessors) {
1315 if ((accessor as PropertyAccessorElementImpl).identifier == identifier) { 1315 if ((accessor as PropertyAccessorElementImpl).identifier == identifier) {
(...skipping 2452 matching lines...) Expand 10 before | Expand all | Expand 10 after
3768 * 3768 *
3769 * @param element the element whose location is being represented 3769 * @param element the element whose location is being represented
3770 */ 3770 */
3771 ElementLocationImpl.con1(Element element) { 3771 ElementLocationImpl.con1(Element element) {
3772 List<String> components = new List<String>(); 3772 List<String> components = new List<String>();
3773 Element ancestor = element; 3773 Element ancestor = element;
3774 while (ancestor != null) { 3774 while (ancestor != null) {
3775 components.insert(0, (ancestor as ElementImpl).identifier); 3775 components.insert(0, (ancestor as ElementImpl).identifier);
3776 ancestor = ancestor.enclosingElement; 3776 ancestor = ancestor.enclosingElement;
3777 } 3777 }
3778 this._components = new List.from(components); 3778 this._components = components;
3779 } 3779 }
3780 3780
3781 /** 3781 /**
3782 * Initialize a newly created location from the given encoded form. 3782 * Initialize a newly created location from the given encoded form.
3783 * 3783 *
3784 * @param encoding the encoded form of a location 3784 * @param encoding the encoded form of a location
3785 */ 3785 */
3786 ElementLocationImpl.con2(String encoding) { 3786 ElementLocationImpl.con2(String encoding) {
3787 this._components = _decode(encoding); 3787 this._components = _decode(encoding);
3788 } 3788 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
3868 components.add(builder.toString()); 3868 components.add(builder.toString());
3869 builder.length = 0; 3869 builder.length = 0;
3870 index++; 3870 index++;
3871 } 3871 }
3872 } else { 3872 } else {
3873 builder.appendChar(currentChar); 3873 builder.appendChar(currentChar);
3874 index++; 3874 index++;
3875 } 3875 }
3876 } 3876 }
3877 components.add(builder.toString()); 3877 components.add(builder.toString());
3878 return new List.from(components); 3878 return components;
3879 } 3879 }
3880 3880
3881 /** 3881 /**
3882 * Append an encoded form of the given component to the given builder. 3882 * Append an encoded form of the given component to the given builder.
3883 * 3883 *
3884 * @param builder the builder to which the encoded component is to be appended 3884 * @param builder the builder to which the encoded component is to be appended
3885 * @param component the component to be appended to the builder 3885 * @param component the component to be appended to the builder
3886 */ 3886 */
3887 void _encode(JavaStringBuilder builder, String component) { 3887 void _encode(JavaStringBuilder builder, String component) {
3888 int length = component.length; 3888 int length = component.length;
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
5423 List<DartType> types = new List<DartType>(); 5423 List<DartType> types = new List<DartType>();
5424 for (ParameterElement parameter in parameters) { 5424 for (ParameterElement parameter in parameters) {
5425 if (parameter.parameterKind == ParameterKind.REQUIRED) { 5425 if (parameter.parameterKind == ParameterKind.REQUIRED) {
5426 DartType type = parameter.type; 5426 DartType type = parameter.type;
5427 if (typeArguments.length != 0 && typeArguments.length == typeParameters. length) { 5427 if (typeArguments.length != 0 && typeArguments.length == typeParameters. length) {
5428 type = type.substitute2(typeArguments, typeParameters); 5428 type = type.substitute2(typeArguments, typeParameters);
5429 } 5429 }
5430 types.add(type); 5430 types.add(type);
5431 } 5431 }
5432 } 5432 }
5433 return new List.from(types); 5433 return types;
5434 } 5434 }
5435 5435
5436 @override 5436 @override
5437 List<DartType> get optionalParameterTypes { 5437 List<DartType> get optionalParameterTypes {
5438 List<ParameterElement> parameters = baseParameters; 5438 List<ParameterElement> parameters = baseParameters;
5439 if (parameters.length == 0) { 5439 if (parameters.length == 0) {
5440 return TypeImpl.EMPTY_ARRAY; 5440 return TypeImpl.EMPTY_ARRAY;
5441 } 5441 }
5442 List<DartType> typeParameters = TypeParameterTypeImpl.getTypes(this.typePara meters); 5442 List<DartType> typeParameters = TypeParameterTypeImpl.getTypes(this.typePara meters);
5443 List<DartType> types = new List<DartType>(); 5443 List<DartType> types = new List<DartType>();
5444 for (ParameterElement parameter in parameters) { 5444 for (ParameterElement parameter in parameters) {
5445 if (parameter.parameterKind == ParameterKind.POSITIONAL) { 5445 if (parameter.parameterKind == ParameterKind.POSITIONAL) {
5446 DartType type = parameter.type; 5446 DartType type = parameter.type;
5447 if (typeArguments.length != 0 && typeArguments.length == typeParameters. length) { 5447 if (typeArguments.length != 0 && typeArguments.length == typeParameters. length) {
5448 type = type.substitute2(typeArguments, typeParameters); 5448 type = type.substitute2(typeArguments, typeParameters);
5449 } 5449 }
5450 types.add(type); 5450 types.add(type);
5451 } 5451 }
5452 } 5452 }
5453 return new List.from(types); 5453 return types;
5454 } 5454 }
5455 5455
5456 @override 5456 @override
5457 List<ParameterElement> get parameters { 5457 List<ParameterElement> get parameters {
5458 List<ParameterElement> baseParameters = this.baseParameters; 5458 List<ParameterElement> baseParameters = this.baseParameters;
5459 // no parameters, quick return 5459 // no parameters, quick return
5460 int parameterCount = baseParameters.length; 5460 int parameterCount = baseParameters.length;
5461 if (parameterCount == 0) { 5461 if (parameterCount == 0) {
5462 return baseParameters; 5462 return baseParameters;
5463 } 5463 }
(...skipping 2451 matching lines...) Expand 10 before | Expand all | Expand 10 after
7915 7915
7916 @override 7916 @override
7917 List<ImportElement> getImportsWithPrefix(PrefixElement prefixElement) { 7917 List<ImportElement> getImportsWithPrefix(PrefixElement prefixElement) {
7918 int count = _imports.length; 7918 int count = _imports.length;
7919 List<ImportElement> importList = new List<ImportElement>(); 7919 List<ImportElement> importList = new List<ImportElement>();
7920 for (int i = 0; i < count; i++) { 7920 for (int i = 0; i < count; i++) {
7921 if (identical(_imports[i].prefix, prefixElement)) { 7921 if (identical(_imports[i].prefix, prefixElement)) {
7922 importList.add(_imports[i]); 7922 importList.add(_imports[i]);
7923 } 7923 }
7924 } 7924 }
7925 return new List.from(importList); 7925 return importList;
7926 } 7926 }
7927 7927
7928 @override 7928 @override
7929 ElementKind get kind => ElementKind.LIBRARY; 7929 ElementKind get kind => ElementKind.LIBRARY;
7930 7930
7931 @override 7931 @override
7932 LibraryElement get library => this; 7932 LibraryElement get library => this;
7933 7933
7934 @override 7934 @override
7935 FunctionElement get loadLibraryFunction { 7935 FunctionElement get loadLibraryFunction {
(...skipping 3379 matching lines...) Expand 10 before | Expand all | Expand 10 after
11315 11315
11316 @override 11316 @override
11317 int get hashCode => _types.hashCode; 11317 int get hashCode => _types.hashCode;
11318 11318
11319 @override 11319 @override
11320 DartType substitute2(List<DartType> argumentTypes, List<DartType> parameterTyp es) { 11320 DartType substitute2(List<DartType> argumentTypes, List<DartType> parameterTyp es) {
11321 List<DartType> out = new List<DartType>(); 11321 List<DartType> out = new List<DartType>();
11322 for (DartType t in _types) { 11322 for (DartType t in _types) {
11323 out.add(t.substitute2(argumentTypes, parameterTypes)); 11323 out.add(t.substitute2(argumentTypes, parameterTypes));
11324 } 11324 }
11325 return union(new List.from(out)); 11325 return union(out);
11326 } 11326 }
11327 11327
11328 @override 11328 @override
11329 void appendTo(JavaStringBuilder builder) { 11329 void appendTo(JavaStringBuilder builder) {
11330 String prefix = "{"; 11330 String prefix = "{";
11331 for (DartType t in _types) { 11331 for (DartType t in _types) {
11332 builder.append(prefix); 11332 builder.append(prefix);
11333 (t as TypeImpl).appendTo(builder); 11333 (t as TypeImpl).appendTo(builder);
11334 prefix = ","; 11334 prefix = ",";
11335 } 11335 }
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
11771 if (type is UnionType) { 11771 if (type is UnionType) {
11772 return (type as UnionTypeImpl).internalUnionTypeIsSuperTypeOf(this, visite dTypePairs); 11772 return (type as UnionTypeImpl).internalUnionTypeIsSuperTypeOf(this, visite dTypePairs);
11773 } 11773 }
11774 // The only subtype relations that pertain to void are therefore: 11774 // The only subtype relations that pertain to void are therefore:
11775 // void <: void (by reflexivity) 11775 // void <: void (by reflexivity)
11776 // bottom <: void (as bottom is a subtype of all types). 11776 // bottom <: void (as bottom is a subtype of all types).
11777 // void <: dynamic (as dynamic is a supertype of all types) 11777 // void <: dynamic (as dynamic is a supertype of all types)
11778 return identical(type, this) || type.isDynamic; 11778 return identical(type, this) || type.isDynamic;
11779 } 11779 }
11780 } 11780 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698