| Index: sdk/lib/_internal/compiler/implementation/resolution/members.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
|
| index 05c5c46491a23527e1765b7375f849fd1add0df2..80e1009ea629ff48658217011416a4bae0f313d7 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
|
| @@ -1704,14 +1704,14 @@ class TypeResolver {
|
| DartType type;
|
|
|
| DartType checkNoTypeArguments(DartType type) {
|
| - LinkBuilder<DartType> arguments = new LinkBuilder<DartType>();
|
| + List<DartType> arguments = new List<DartType>();
|
| bool hasTypeArgumentMismatch = resolveTypeArguments(
|
| - visitor, node, const Link<DartType>(), arguments);
|
| + visitor, node, const <DartType>[], arguments);
|
| if (hasTypeArgumentMismatch) {
|
| return new MalformedType(
|
| new ErroneousElementX(MessageKind.TYPE_ARGUMENT_COUNT_MISMATCH,
|
| {'type': node}, typeName.source, visitor.enclosingElement),
|
| - type, arguments.toLink());
|
| + type, arguments);
|
| }
|
| return type;
|
| }
|
| @@ -1755,10 +1755,10 @@ class TypeResolver {
|
| messageKind, messageArguments, typeName.source,
|
| visitor.enclosingElement);
|
| }
|
| - LinkBuilder<DartType> arguments = new LinkBuilder<DartType>();
|
| - resolveTypeArguments(visitor, node, null, arguments);
|
| + List<DartType> arguments = <DartType>[];
|
| + resolveTypeArguments(visitor, node, const <DartType>[], arguments);
|
| return new MalformedType(erroneousElement,
|
| - userProvidedBadType, arguments.toLink());
|
| + userProvidedBadType, arguments);
|
| }
|
|
|
| // Try to construct the type from the element.
|
| @@ -1786,18 +1786,18 @@ class TypeResolver {
|
| // [computeType].
|
| compiler.resolver._ensureClassWillBeResolved(cls);
|
| element.computeType(compiler);
|
| - var arguments = new LinkBuilder<DartType>();
|
| + List<DartType> arguments = <DartType>[];
|
| bool hasTypeArgumentMismatch = resolveTypeArguments(
|
| visitor, node, cls.typeVariables, arguments);
|
| if (hasTypeArgumentMismatch) {
|
| type = new BadInterfaceType(cls.declaration,
|
| new InterfaceType.forUserProvidedBadType(cls.declaration,
|
| - arguments.toLink()));
|
| + arguments));
|
| } else {
|
| if (arguments.isEmpty) {
|
| type = cls.rawType;
|
| } else {
|
| - type = new InterfaceType(cls.declaration, arguments.toLink());
|
| + type = new InterfaceType(cls.declaration, arguments.toList(growable: false));
|
| addTypeVariableBoundsCheck = true;
|
| }
|
| }
|
| @@ -1806,18 +1806,17 @@ class TypeResolver {
|
| // TODO(johnniwinther): [ensureResolved] should imply [computeType].
|
| typdef.ensureResolved(compiler);
|
| element.computeType(compiler);
|
| - var arguments = new LinkBuilder<DartType>();
|
| + List<DartType> arguments = <DartType>[];
|
| bool hasTypeArgumentMismatch = resolveTypeArguments(
|
| visitor, node, typdef.typeVariables, arguments);
|
| if (hasTypeArgumentMismatch) {
|
| type = new BadTypedefType(typdef,
|
| - new TypedefType.forUserProvidedBadType(typdef,
|
| - arguments.toLink()));
|
| + new TypedefType.forUserProvidedBadType(typdef, arguments));
|
| } else {
|
| if (arguments.isEmpty) {
|
| type = typdef.rawType;
|
| } else {
|
| - type = new TypedefType(typdef, arguments.toLink());
|
| + type = new TypedefType(typdef, arguments.toList(growable: false));
|
| addTypeVariableBoundsCheck = true;
|
| }
|
| }
|
| @@ -1878,30 +1877,30 @@ class TypeResolver {
|
| * Returns [: true :] if the number of type arguments did not match the
|
| * number of type variables.
|
| */
|
| - bool resolveTypeArguments(
|
| - MappingVisitor visitor,
|
| - TypeAnnotation node,
|
| - Link<DartType> typeVariables,
|
| - LinkBuilder<DartType> arguments) {
|
| + bool resolveTypeArguments(MappingVisitor visitor,
|
| + TypeAnnotation node,
|
| + List<DartType> typeVariables,
|
| + List<DartType> arguments) {
|
| if (node.typeArguments == null) {
|
| return false;
|
| }
|
| + int expectedVariables = typeVariables.length;
|
| + assert(arguments.length == expectedVariables);
|
| + int index = 0;
|
| bool typeArgumentCountMismatch = false;
|
| for (Link<Node> typeArguments = node.typeArguments.nodes;
|
| !typeArguments.isEmpty;
|
| - typeArguments = typeArguments.tail) {
|
| - if (typeVariables != null && typeVariables.isEmpty) {
|
| + typeArguments = typeArguments.tail, index++) {
|
| + if (index > expectedVariables - 1) {
|
| visitor.warning(
|
| typeArguments.head, MessageKind.ADDITIONAL_TYPE_ARGUMENT);
|
| typeArgumentCountMismatch = true;
|
| }
|
| DartType argType = resolveTypeAnnotation(visitor, typeArguments.head);
|
| - arguments.addLast(argType);
|
| - if (typeVariables != null && !typeVariables.isEmpty) {
|
| - typeVariables = typeVariables.tail;
|
| - }
|
| + // TODO(karlklose): rewrite to not modify [arguments].
|
| + arguments.add(argType);
|
| }
|
| - if (typeVariables != null && !typeVariables.isEmpty) {
|
| + if (index < expectedVariables) {
|
| visitor.warning(node.typeArguments,
|
| MessageKind.MISSING_TYPE_ARGUMENT);
|
| typeArgumentCountMismatch = true;
|
| @@ -3252,8 +3251,7 @@ class ResolverVisitor extends MappingVisitor<Element> {
|
| compiler.reportError(arguments.nodes.head,
|
| MessageKind.TYPE_VARIABLE_IN_CONSTANT);
|
| }
|
| - listType = new InterfaceType(compiler.listClass,
|
| - new Link<DartType>.fromList([typeArgument]));
|
| + listType = new InterfaceType(compiler.listClass, [typeArgument]);
|
| } else {
|
| compiler.listClass.computeType(compiler);
|
| listType = compiler.listClass.rawType;
|
| @@ -3475,7 +3473,7 @@ class ResolverVisitor extends MappingVisitor<Element> {
|
| DartType mapType;
|
| if (valueTypeArgument != null) {
|
| mapType = new InterfaceType(compiler.mapClass,
|
| - new Link<DartType>.fromList([keyTypeArgument, valueTypeArgument]));
|
| + [keyTypeArgument, valueTypeArgument]);
|
| } else {
|
| compiler.mapClass.computeType(compiler);
|
| mapType = compiler.mapClass.rawType;
|
| @@ -3776,12 +3774,13 @@ class TypeDefinitionVisitor extends MappingVisitor<DartType> {
|
| void resolveTypeVariableBounds(NodeList node) {
|
| if (node == null) return;
|
|
|
| - var nameSet = new Setlet<String>();
|
| + Setlet<String> nameSet = new Setlet<String>();
|
| // Resolve the bounds of type variables.
|
| - Link<DartType> typeLink = element.typeVariables;
|
| + Iterator<DartType> types = element.typeVariables.iterator;
|
| Link<Node> nodeLink = node.nodes;
|
| while (!nodeLink.isEmpty) {
|
| - TypeVariableType typeVariable = typeLink.head;
|
| + types.moveNext();
|
| + TypeVariableType typeVariable = types.current;
|
| String typeName = typeVariable.name;
|
| TypeVariable typeNode = nodeLink.head;
|
| registry.useType(typeNode, typeVariable);
|
| @@ -3822,9 +3821,8 @@ class TypeDefinitionVisitor extends MappingVisitor<DartType> {
|
| variableElement.boundCache = objectType;
|
| }
|
| nodeLink = nodeLink.tail;
|
| - typeLink = typeLink.tail;
|
| }
|
| - assert(typeLink.isEmpty);
|
| + assert(!types.moveNext());
|
| }
|
| }
|
|
|
| @@ -4102,23 +4100,22 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
|
| node,
|
| new Modifiers.withFlags(new NodeList.empty(), Modifiers.FLAG_ABSTRACT));
|
| // Create synthetic type variables for the mixin application.
|
| - LinkBuilder<DartType> typeVariablesBuilder = new LinkBuilder<DartType>();
|
| + List<DartType> typeVariables = <DartType>[];
|
| element.typeVariables.forEach((TypeVariableType type) {
|
| TypeVariableElementX typeVariableElement = new TypeVariableElementX(
|
| type.name, mixinApplication, type.element.node);
|
| TypeVariableType typeVariable = new TypeVariableType(typeVariableElement);
|
| - typeVariablesBuilder.addLast(typeVariable);
|
| + typeVariables.add(typeVariable);
|
| });
|
| - Link<DartType> typeVariables = typeVariablesBuilder.toLink();
|
| // Setup bounds on the synthetic type variables.
|
| - Link<DartType> link = typeVariables;
|
| + List<DartType> link = typeVariables;
|
| + int index = 0;
|
| element.typeVariables.forEach((TypeVariableType type) {
|
| - TypeVariableType typeVariable = link.head;
|
| + TypeVariableType typeVariable = typeVariables[index++];
|
| TypeVariableElementX typeVariableElement = typeVariable.element;
|
| typeVariableElement.typeCache = typeVariable;
|
| typeVariableElement.boundCache =
|
| type.element.bound.subst(typeVariables, element.typeVariables);
|
| - link = link.tail;
|
| });
|
| // Setup this and raw type for the mixin application.
|
| mixinApplication.computeThisAndRawType(compiler, typeVariables);
|
|
|