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

Unified Diff: sdk/lib/js/dartium/js_dartium.dart

Issue 1431513004: Fix dartium bug handling object literal constructors with zero arguments. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 | tests/html/js_typed_interop_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/js/dartium/js_dartium.dart
diff --git a/sdk/lib/js/dartium/js_dartium.dart b/sdk/lib/js/dartium/js_dartium.dart
index f80c377220c369456f433b0ed36794545e40448f..fde9d4065925aaecb5a113d4587b961cf68c4d1b 100644
--- a/sdk/lib/js/dartium/js_dartium.dart
+++ b/sdk/lib/js/dartium/js_dartium.dart
@@ -410,17 +410,21 @@ List<String> _generateExternalMethods() {
if (declaration is! mirrors.MethodMirror ||
!_isExternal(declaration)) return;
if (declaration.isFactoryConstructor && _isAnonymousClass(clazz)) {
- sbPatch.write(" factory ${className}({");
+ sbPatch.write(" factory ${className}(");
int i = 0;
var args = <String>[];
for (var p in declaration.parameters) {
args.add(mirrors.MirrorSystem.getName(p.simpleName));
i++;
}
- sbPatch
- ..write(
- args.map((name) => '$name:${_UNDEFINED_VAR}').join(", "))
- ..write("}) {\n"
+ if (args.isNotEmpty) {
+ sbPatch
+ ..write('{')
+ ..write(
+ args.map((name) => '$name:${_UNDEFINED_VAR}').join(", "))
+ ..write('}');
+ }
+ sbPatch.write(") {\n"
" var ret = new ${_JS_LIBRARY_PREFIX}.JsObject.jsify({});\n");
i = 0;
for (var p in declaration.parameters) {
« no previous file with comments | « no previous file | tests/html/js_typed_interop_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698