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

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

Issue 2539033004: Fixes #27960 (Closed)
Patch Set: Reformat 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..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 {
« 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