| Index: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
|
| index 15a0eb770f9fc322a1b85b9b4f17929117795da4..713ed0ef09d7056f83c76b947e58b62975ef2142 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
|
| @@ -231,7 +231,7 @@ class CodeEmitterTask extends CompilerTask {
|
| fun);
|
| }
|
|
|
| - jsAst.Fun get defineClassFunction {
|
| + List get defineClassFunction {
|
| // First the class name, then the field names in an array and the members
|
| // (inside an Object literal).
|
| // The caller can also pass in the constructor as a function if needed.
|
| @@ -247,7 +247,7 @@ class CodeEmitterTask extends CompilerTask {
|
| // });
|
|
|
| // function(cls, fields, prototype) {
|
| - return js.fun(['cls', 'fields', 'prototype'], [
|
| + var defineClass = js.fun(['cls', 'fields', 'prototype'], [
|
| js['var constructor'],
|
|
|
| // if (typeof fields == "function") {
|
| @@ -279,6 +279,13 @@ class CodeEmitterTask extends CompilerTask {
|
| // return constructor;
|
| js.return_('constructor')
|
| ]);
|
| + // Declare a function called "generateAccessor". This is used in
|
| + // defineClassFunction (it's a local declaration in init()).
|
| + return [
|
| + generateAccessorFunction,
|
| + js['$generateAccessorHolder = generateAccessor'],
|
| + new jsAst.FunctionDeclaration(
|
| + new jsAst.VariableDeclaration('defineClass'), defineClass) ];
|
| }
|
|
|
| /** Needs defineClass to be defined. */
|
| @@ -569,17 +576,7 @@ class CodeEmitterTask extends CompilerTask {
|
|
|
| List buildDefineClassAndFinishClassFunctionsIfNecessary() {
|
| if (!needsDefineClass) return [];
|
| - return [
|
| - // Declare a function called "generateAccessor". This is used in
|
| - // defineClassFunction (it's a local declaration in init()).
|
| - generateAccessorFunction,
|
| -
|
| - js['$generateAccessorHolder = generateAccessor'],
|
| -
|
| - // function defineClass ...
|
| - new jsAst.FunctionDeclaration(
|
| - new jsAst.VariableDeclaration('defineClass'), defineClassFunction)
|
| - ]
|
| + return defineClassFunction
|
| ..addAll(buildProtoSupportCheck())
|
| ..addAll([
|
| js[finishClassesName].assign(finishClassesFunction)
|
| @@ -1203,7 +1200,7 @@ class CodeEmitterTask extends CompilerTask {
|
| void emitClassFields(ClassElement classElement,
|
| ClassBuilder builder,
|
| { String superClass: "",
|
| - bool classIsNative: false}) {
|
| + bool classIsNative: false }) {
|
| bool isFirstField = true;
|
| StringBuffer buffer = new StringBuffer();
|
| if (!classIsNative) {
|
|
|