| Index: pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
|
| diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
|
| index aaca01c2e28b33b22dfbf32cea97acd92639086b..4957edf21eb7c90b524d5e66de18fafe3a227272 100644
|
| --- a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
|
| +++ b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
|
| @@ -324,7 +324,7 @@ class OldEmitter implements Emitter {
|
| bool hasIsolateSupport = compiler.hasIsolateSupport;
|
| String fieldNamesProperty = FIELD_NAMES_PROPERTY_NAME;
|
|
|
| - jsAst.Expression defineClass = js('''
|
| + jsAst.Expression defineClass = js(r'''
|
| function(name, fields) {
|
| var accessors = [];
|
|
|
| @@ -339,23 +339,25 @@ class OldEmitter implements Emitter {
|
| if (#hasIsolateSupport) { fieldNames += "'" + field + "',"; }
|
| var parameter = "parameter_" + field;
|
| str += parameter;
|
| - body += ("this." + field + " = " + parameter + ";\\n");
|
| + body += ("this." + field + " = " + parameter + ";\n");
|
| }
|
| - str += ") {\\n" + body + "}\\n";
|
| - str += name + ".builtin\$cls=\\"" + name + "\\";\\n";
|
| - str += "\$desc=\$collectedClasses." + name + ";\\n";
|
| - str += "if(\$desc instanceof Array) \$desc = \$desc[1];\\n";
|
| - str += name + ".prototype = \$desc;\\n";
|
| + str += ") {\n" + body + "}\n";
|
| + str += name + ".builtin$cls=\"" + name + "\";\n";
|
| + str += "$desc=$collectedClasses." + name + ";\n";
|
| + str += "if($desc instanceof Array) $desc = \$desc[1];\n";
|
| + str += name + ".prototype = $desc;\n";
|
| if (typeof defineClass.name != "string") {
|
| - str += name + ".name=\\"" + name + "\\";\\n";
|
| + str += name + ".name=\"" + name + "\";\n";
|
| }
|
| if (#hasIsolateSupport) {
|
| - str += name + ".$fieldNamesProperty=[" + fieldNames + "];\\n";
|
| + str += name + "." + #fieldNamesProperty + "=[" + fieldNames
|
| + + "];\n";
|
| }
|
| str += accessors.join("");
|
|
|
| return str;
|
| - }''', { 'hasIsolateSupport': hasIsolateSupport });
|
| + }''', { 'hasIsolateSupport': hasIsolateSupport,
|
| + 'fieldNamesProperty': js.string(fieldNamesProperty)});
|
|
|
| // Declare a function called "generateAccessor". This is used in
|
| // defineClassFunction.
|
| @@ -426,6 +428,7 @@ class OldEmitter implements Emitter {
|
| // Fix up the the Dart Object class' prototype.
|
| var prototype = constructor.prototype;
|
| prototype.constructor = constructor;
|
| + prototype.#isObject = constructor;
|
| return prototype;
|
| }
|
| tmp.prototype = superConstructor.prototype;
|
| @@ -436,12 +439,16 @@ class OldEmitter implements Emitter {
|
| object[member] = properties[member];
|
| }
|
| }
|
| + // Use a function for `true` here, as functions are stored in the
|
| + // hidden class and not as properties in the object.
|
| + object[#operatorIsPrefix + constructor.name] = constructor;
|
| object.constructor = constructor;
|
| constructor.prototype = object;
|
| return object;
|
| };
|
| }()
|
| - ''');
|
| + ''', { 'operatorIsPrefix' : js.string(namer.operatorIsPrefix),
|
| + 'isObject' : namer.operatorIs(compiler.objectClass) });
|
| if (compiler.hasIncrementalSupport) {
|
| result = js(
|
| r'#.inheritFrom = #', [namer.accessIncrementalHelper, result]);
|
|
|