Chromium Code Reviews| Index: pkg/compiler/lib/src/js_backend/runtime_types.dart |
| diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart |
| index bf008f11a7d9822349b3e6c2df3b2edf9e20ad7f..4a95e220177f106a71e63fba8725f084885bfb89 100644 |
| --- a/pkg/compiler/lib/src/js_backend/runtime_types.dart |
| +++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart |
| @@ -32,6 +32,9 @@ class RuntimeTypes { |
| JavaScriptBackend get backend => compiler.backend; |
| + String get getFunctionThatReturnsNullName |
| + => backend.namer.getMappedInstanceName('functionThatReturnsNull'); |
|
karlklose
2015/01/20 10:37:32
Use {} when it does not fit on a line.
How about
|
| + |
| RuntimeTypes(Compiler compiler) |
| : this.compiler = compiler, |
| representationGenerator = new TypeRepresentationGenerator(compiler), |
| @@ -855,6 +858,7 @@ class FunctionArgumentCollector extends DartTypeVisitor { |
| * of the representation consult the documentation of |
| * [getSupertypeSubstitution]. |
| */ |
| +//TODO(floitsch): Remove support for non-function substitutions. |
| class Substitution { |
| final bool isFunction; |
| final List<DartType> arguments; |
| @@ -878,13 +882,17 @@ class Substitution { |
| rti.backend.namer.safeVariableName(variable.name)); |
| } |
| - jsAst.Expression value = |
| - rti.getSubstitutionRepresentation(arguments, use); |
| - if (isFunction) { |
| - Iterable<jsAst.Expression> formals = parameters.map(declaration); |
| - return js('function(#) { return # }', [formals, value]); |
| + if (arguments.every((DartType type) => type.isDynamic)) { |
| + return rti.backend.emitter.emitter.generateFunctionThatReturnsNull(); |
| } else { |
| - return js('function() { return # }', value); |
| + jsAst.Expression value = |
| + rti.getSubstitutionRepresentation(arguments, use); |
| + if (isFunction) { |
| + Iterable<jsAst.Expression> formals = parameters.map(declaration); |
| + return js('function(#) { return # }', [formals, value]); |
| + } else { |
| + return js('function() { return # }', value); |
| + } |
| } |
| } |
| } |