Index: pkg/dev_compiler/lib/src/compiler/code_generator.dart |
diff --git a/pkg/dev_compiler/lib/src/compiler/code_generator.dart b/pkg/dev_compiler/lib/src/compiler/code_generator.dart |
index f1c8f8a18b0bef109627198e288672561d769435..3b9e89e35eb526627161c0b266b5cec3f2aa6237 100644 |
--- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart |
+++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart |
@@ -1315,7 +1315,7 @@ class CodeGenerator extends GeneralizingAstVisitor |
jsMethods.add(new JS.Method( |
_propertyName('constructor'), |
js.call('function(...args) { return this.new.apply(this, args); }') |
- as JS.Fun)); |
+ as JS.Fun)); |
} else if (ctors.isEmpty) { |
jsMethods.add(_emitImplicitConstructor(node, fields, virtualFields)); |
} |
@@ -3396,7 +3396,7 @@ class CodeGenerator extends GeneralizingAstVisitor |
if (targetType is FunctionType) { |
// Call methods on function types should be handled as regular function |
// invocations. |
- return _emitFunctionCall(node); |
+ return _emitFunctionCall(node, node.target); |
} |
if (targetType.isDartCoreFunction || targetType.isDynamic) { |
// TODO(vsm): Can a call method take generic type parameters? |
@@ -3543,10 +3543,14 @@ class CodeGenerator extends GeneralizingAstVisitor |
/// Emits a function call, to a top-level function, local function, or |
/// an expression. |
- JS.Expression _emitFunctionCall(InvocationExpression node) { |
- var fn = _visit(node.function); |
+ JS.Expression _emitFunctionCall(InvocationExpression node, |
+ [Expression function]) { |
+ if (function == null) { |
+ function = node.function; |
+ } |
+ var fn = _visit(function); |
var args = _visit(node.argumentList) as List<JS.Expression>; |
- if (isDynamicInvoke(node.function)) { |
+ if (isDynamicInvoke(function)) { |
return _emitDynamicInvoke(node, fn, args); |
} else { |
return new JS.Call(_applyInvokeTypeArguments(fn, node), args); |
@@ -3968,7 +3972,7 @@ class CodeGenerator extends GeneralizingAstVisitor |
new JS.Method( |
access, |
js.call('function() { return #; }', _visitInitializer(node)) |
- as JS.Fun, |
+ as JS.Fun, |
isGetter: true), |
node, |
_findAccessor(element, getter: true))); |
@@ -4528,7 +4532,7 @@ class CodeGenerator extends GeneralizingAstVisitor |
} |
result = astFactory.prefixedIdentifier( |
_bindValue(scope, 'o', ident.prefix, context: context) |
- as SimpleIdentifier, |
+ as SimpleIdentifier, |
ident.period, |
ident.identifier); |
} else { |