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

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

Issue 2454173003: fix #27429, html wrapper methods pass incorrect number of arguments (Closed)
Patch Set: Created 4 years, 2 months 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 | « pkg/dev_compiler/lib/js/legacy/dart_sdk.js ('k') | pkg/dev_compiler/test/browser/language_tests.js » ('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 42a72cac83d53d9cf8441007aab7391a2362f62e..d2f3f8f4689f8860fddb74f97947f147fa133d3d 100644
--- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
@@ -2261,22 +2261,18 @@ class CodeGenerator extends GeneralizingAstVisitor
}
JS.Fun _emitNativeFunctionBody(MethodDeclaration node) {
- if (node.isStatic) {
- // TODO(vsm): Do we need to handle this case?
- return null;
- }
-
- var params = visitFormalParameterList(node.parameters, destructure: false);
String name =
getAnnotationName(node.element, isJSAnnotation) ?? node.name.name;
if (node.isGetter) {
- return new JS.Fun(params, js.statement('{ return this.#; }', [name]));
+ return new JS.Fun([], js.statement('{ return this.#; }', [name]));
} else if (node.isSetter) {
+ var params =
+ visitFormalParameterList(node.parameters, destructure: false);
return new JS.Fun(
params, js.statement('{ this.# = #; }', [name, params.last]));
} else {
- return new JS.Fun(
- params, js.statement('{ return this.#(#); }', [name, params]));
+ return js.call(
+ 'function (...args) { return this.#.apply(this, args); }', name);
}
}
@@ -2287,9 +2283,11 @@ class CodeGenerator extends GeneralizingAstVisitor
JS.Fun fn;
if (_externalOrNative(node)) {
+ if (node.isStatic) {
+ // TODO(vsm): Do we need to handle this case?
+ return null;
+ }
fn = _emitNativeFunctionBody(node);
- // TODO(vsm): Remove if / when we handle the static case above.
- if (fn == null) return null;
} else {
fn = _emitFunctionBody(node.element, node.parameters, node.body);
« no previous file with comments | « pkg/dev_compiler/lib/js/legacy/dart_sdk.js ('k') | pkg/dev_compiler/test/browser/language_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698