| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 // }"; | 167 // }"; |
| 168 // which is then dynamically evaluated: | 168 // which is then dynamically evaluated: |
| 169 // var newIsolate = new Function(str); | 169 // var newIsolate = new Function(str); |
| 170 // | 170 // |
| 171 // We also copy over old values like the prototype, and the | 171 // We also copy over old values like the prototype, and the |
| 172 // isolateProperties themselves. | 172 // isolateProperties themselves. |
| 173 return """function(oldIsolate) { | 173 return """function(oldIsolate) { |
| 174 var isolateProperties = oldIsolate.${namer.ISOLATE_PROPERTIES}; | 174 var isolateProperties = oldIsolate.${namer.ISOLATE_PROPERTIES}; |
| 175 var isolatePrototype = oldIsolate.prototype; | 175 var isolatePrototype = oldIsolate.prototype; |
| 176 var str = "{\\n"; | 176 var str = "{\\n"; |
| 177 str += "var isolateProperties = $isolate.${namer.ISOLATE_PROPERTIES};\\n"; | 177 str += "var properties = $isolate.${namer.ISOLATE_PROPERTIES};\\n"; |
| 178 for (var staticName in isolateProperties) { | 178 for (var staticName in isolateProperties) { |
| 179 if (Object.prototype.hasOwnProperty.call(isolateProperties, staticName)) { | 179 if (Object.prototype.hasOwnProperty.call(isolateProperties, staticName)) { |
| 180 str += "this." + staticName + "= isolateProperties." + staticName + ";\\n"
; | 180 str += "this." + staticName + "= properties." + staticName + ";\\n"; |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 str += "}\\n"; | 183 str += "}\\n"; |
| 184 var newIsolate = new Function(str); | 184 var newIsolate = new Function(str); |
| 185 newIsolate.prototype = isolatePrototype; | 185 newIsolate.prototype = isolatePrototype; |
| 186 isolatePrototype.constructor = newIsolate; | 186 isolatePrototype.constructor = newIsolate; |
| 187 newIsolate.${namer.ISOLATE_PROPERTIES} = isolateProperties; | 187 newIsolate.${namer.ISOLATE_PROPERTIES} = isolateProperties; |
| 188 return newIsolate; | 188 return newIsolate; |
| 189 }"""; | 189 }"""; |
| 190 } | 190 } |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 mainBuffer.add('function init() {\n'); | 898 mainBuffer.add('function init() {\n'); |
| 899 mainBuffer.add(' $isolateProperties = {};\n'); | 899 mainBuffer.add(' $isolateProperties = {};\n'); |
| 900 addDefineClassAndFinishClassFunctionsIfNecessary(mainBuffer); | 900 addDefineClassAndFinishClassFunctionsIfNecessary(mainBuffer); |
| 901 emitFinishIsolateConstructor(mainBuffer); | 901 emitFinishIsolateConstructor(mainBuffer); |
| 902 mainBuffer.add('}\n'); | 902 mainBuffer.add('}\n'); |
| 903 compiler.assembledCode = mainBuffer.toString(); | 903 compiler.assembledCode = mainBuffer.toString(); |
| 904 }); | 904 }); |
| 905 return compiler.assembledCode; | 905 return compiler.assembledCode; |
| 906 } | 906 } |
| 907 } | 907 } |
| OLD | NEW |