| Index: sdk/lib/_internal/compiler/implementation/typechecker.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/typechecker.dart b/sdk/lib/_internal/compiler/implementation/typechecker.dart
|
| index 401645fcd287d1d51df7a2f0f5fe1d4e435fe691..de2f458d0006570b37713937788ef60320ae9c4a 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/typechecker.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/typechecker.dart
|
| @@ -106,7 +106,12 @@ class ResolvedAccess extends ElementAccess {
|
| return functionType.returnType;
|
| } else if (element.isSetter()) {
|
| FunctionType functionType = element.computeType(compiler);
|
| - return functionType.parameterTypes.head;
|
| + if (functionType.parameterTypes.length != 1) {
|
| + // TODO(johnniwinther,karlklose): this happens for malformed static
|
| + // setters. Treat them the same as instance members.
|
| + return compiler.types.dynamicType;
|
| + }
|
| + return functionType.parameterTypes.first;
|
| } else {
|
| return element.computeType(compiler);
|
| }
|
| @@ -798,8 +803,9 @@ class TypeCheckerVisitor extends Visitor<DartType> {
|
| if (identical(unaliasedType.kind, TypeKind.FUNCTION)) {
|
| bool error = false;
|
| FunctionType funType = unaliasedType;
|
| - Link<DartType> parameterTypes = funType.parameterTypes;
|
| - Link<DartType> optionalParameterTypes = funType.optionalParameterTypes;
|
| + Iterator<DartType> parameterTypes = funType.parameterTypes.iterator;
|
| + Iterator<DartType> optionalParameterTypes =
|
| + funType.optionalParameterTypes.iterator;
|
| while (!arguments.isEmpty) {
|
| Node argument = arguments.head;
|
| NamedArgument namedArgument = argument.asNamedArgument();
|
| @@ -825,8 +831,8 @@ class TypeCheckerVisitor extends Visitor<DartType> {
|
| }
|
| }
|
| } else {
|
| - if (parameterTypes.isEmpty) {
|
| - if (optionalParameterTypes.isEmpty) {
|
| + if (!parameterTypes.moveNext()) {
|
| + if (!optionalParameterTypes.moveNext()) {
|
| error = true;
|
| // TODO(johnniwinther): Provide better information on the
|
| // called function.
|
| @@ -838,28 +844,28 @@ class TypeCheckerVisitor extends Visitor<DartType> {
|
| DartType argumentType = analyze(argument);
|
| if (argumentTypes != null) argumentTypes.addLast(argumentType);
|
| if (!checkAssignable(argument,
|
| - argumentType, optionalParameterTypes.head)) {
|
| + argumentType,
|
| + optionalParameterTypes.current)) {
|
| error = true;
|
| }
|
| - optionalParameterTypes = optionalParameterTypes.tail;
|
| }
|
| } else {
|
| DartType argumentType = analyze(argument);
|
| if (argumentTypes != null) argumentTypes.addLast(argumentType);
|
| - if (!checkAssignable(argument, argumentType, parameterTypes.head)) {
|
| + if (!checkAssignable(argument, argumentType,
|
| + parameterTypes.current)) {
|
| error = true;
|
| }
|
| - parameterTypes = parameterTypes.tail;
|
| }
|
| }
|
| arguments = arguments.tail;
|
| }
|
| - if (!parameterTypes.isEmpty) {
|
| + if (parameterTypes.moveNext()) {
|
| error = true;
|
| // TODO(johnniwinther): Provide better information on the called
|
| // function.
|
| reportTypeWarning(send, MessageKind.MISSING_ARGUMENT,
|
| - {'argumentType': parameterTypes.head});
|
| + {'argumentType': parameterTypes.current});
|
| }
|
| if (error) {
|
| // TODO(johnniwinther): Improve access to declaring element and handle
|
| @@ -1231,17 +1237,16 @@ class TypeCheckerVisitor extends Visitor<DartType> {
|
| }
|
|
|
| /// Returns the first type in the list or [:dynamic:] if the list is empty.
|
| - DartType firstType(Link<DartType> link) {
|
| - return link.isEmpty ? types.dynamicType : link.head;
|
| + DartType firstType(List<DartType> list) {
|
| + return list.isEmpty ? types.dynamicType : list.first;
|
| }
|
|
|
| /**
|
| * Returns the second type in the list or [:dynamic:] if the list is too
|
| * short.
|
| */
|
| - DartType secondType(Link<DartType> link) {
|
| - return link.isEmpty || link.tail.isEmpty
|
| - ? types.dynamicType : link.tail.head;
|
| + DartType secondType(List<DartType> list) {
|
| + return list.length < 2 ? types.dynamicType : list[1];
|
| }
|
|
|
| /**
|
|
|