| 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 fd5c3f594366f19039b33e4ed91bfcb27c1e4696..2319fceb765cb9960d031946c6d76592fac1a8cc 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);
|
| }
|
| @@ -800,8 +805,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();
|
| @@ -827,8 +833,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.
|
| @@ -840,28 +846,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
|
| @@ -1233,17 +1239,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];
|
| }
|
|
|
| /**
|
|
|