| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * A function element that represents a closure call. The signature is copied | 6 * A function element that represents a closure call. The signature is copied |
| 7 * from the given element. | 7 * from the given element. |
| 8 */ | 8 */ |
| 9 class ClosureInvocationElement extends FunctionElement { | 9 class ClosureInvocationElement extends FunctionElement { |
| 10 ClosureInvocationElement(SourceString name, | 10 ClosureInvocationElement(SourceString name, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 str += "}\\n"; | 168 str += "}\\n"; |
| 169 var newIsolate = new Function(str); | 169 var newIsolate = new Function(str); |
| 170 newIsolate.prototype = isolatePrototype; | 170 newIsolate.prototype = isolatePrototype; |
| 171 isolatePrototype.constructor = newIsolate; | 171 isolatePrototype.constructor = newIsolate; |
| 172 newIsolate.${namer.ISOLATE_PROPERTIES} = isolateProperties; | 172 newIsolate.${namer.ISOLATE_PROPERTIES} = isolateProperties; |
| 173 return newIsolate; | 173 return newIsolate; |
| 174 }"""; | 174 }"""; |
| 175 } | 175 } |
| 176 | 176 |
| 177 void addDefineClassAndFinishClassFunctionsIfNecessary(StringBuffer buffer) { | 177 void addDefineClassAndFinishClassFunctionsIfNecessary(StringBuffer buffer) { |
| 178 String isolate = namer.ISOLATE; | 178 if (needsDefineClass) { |
| 179 buffer.add("$defineClassName = $defineClassFunction;\n"); | 179 String isolate = namer.ISOLATE; |
| 180 buffer.add("$pendingClassesName = {};\n"); | 180 buffer.add("$defineClassName = $defineClassFunction;\n"); |
| 181 buffer.add("$finishClassesName = $finishClassesFunction;\n"); | 181 buffer.add("$pendingClassesName = {};\n"); |
| 182 buffer.add("$finishClassesName = $finishClassesFunction;\n"); |
| 183 } |
| 182 } | 184 } |
| 183 | 185 |
| 184 void emitFinishIsolateConstructor(StringBuffer buffer) { | 186 void emitFinishIsolateConstructor(StringBuffer buffer) { |
| 185 String name = finishIsolateConstructorName; | 187 String name = finishIsolateConstructorName; |
| 186 String value = finishIsolateConstructorFunction; | 188 String value = finishIsolateConstructorFunction; |
| 187 buffer.add("$name = $value;\n"); | 189 buffer.add("$name = $value;\n"); |
| 188 } | 190 } |
| 189 | 191 |
| 190 void emitFinishIsolateConstructorInvocation(StringBuffer buffer) { | 192 void emitFinishIsolateConstructorInvocation(StringBuffer buffer) { |
| 191 String isolate = namer.ISOLATE; | 193 String isolate = namer.ISOLATE; |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 mainBuffer.add('function init() {\n'); | 895 mainBuffer.add('function init() {\n'); |
| 894 mainBuffer.add(' $isolateProperties = {};\n'); | 896 mainBuffer.add(' $isolateProperties = {};\n'); |
| 895 addDefineClassAndFinishClassFunctionsIfNecessary(mainBuffer); | 897 addDefineClassAndFinishClassFunctionsIfNecessary(mainBuffer); |
| 896 emitFinishIsolateConstructor(mainBuffer); | 898 emitFinishIsolateConstructor(mainBuffer); |
| 897 mainBuffer.add('}\n'); | 899 mainBuffer.add('}\n'); |
| 898 compiler.assembledCode = mainBuffer.toString(); | 900 compiler.assembledCode = mainBuffer.toString(); |
| 899 }); | 901 }); |
| 900 return compiler.assembledCode; | 902 return compiler.assembledCode; |
| 901 } | 903 } |
| 902 } | 904 } |
| OLD | NEW |