Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Unified Diff: pkg/dev_compiler/lib/src/compiler/code_generator.dart

Issue 2539033004: Fixes #27960 (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/dev_compiler/test/codegen/language/call_function2_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4036c1ae87d562dc99fc6ef69d14cc3cded1ca61 100644
--- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
@@ -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,13 @@ 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]) {
Jennifer Messerly 2016/12/01 23:20:33 do you mind running format?
+ 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);
« no previous file with comments | « no previous file | pkg/dev_compiler/test/codegen/language/call_function2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698