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 part of js_backend; | 5 part of js_backend; |
6 | 6 |
7 /** | 7 /** |
8 * A function element that represents a closure call. The signature is copied | 8 * A function element that represents a closure call. The signature is copied |
9 * from the given element. | 9 * from the given element. |
10 */ | 10 */ |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 var field = fields[i]; | 163 var field = fields[i]; |
164 field = generateGetterSetter(field, prototype); | 164 field = generateGetterSetter(field, prototype); |
165 str += field; | 165 str += field; |
166 body += "this." + field + " = " + field + ";\\n"; | 166 body += "this." + field + " = " + field + ";\\n"; |
167 } | 167 } |
168 str += ") {" + body + "}\\n"; | 168 str += ") {" + body + "}\\n"; |
169 str += "return " + cls + ";"; | 169 str += "return " + cls + ";"; |
170 constructor = new Function(str)(); | 170 constructor = new Function(str)(); |
171 } | 171 } |
172 constructor.prototype = prototype; | 172 constructor.prototype = prototype; |
173 constructor.builtin\$cls = cls; | |
ngeoffray
2012/11/16 13:47:35
You might want to check with Peter, Kasper or Flor
karlklose
2012/11/20 10:35:26
I talked to Florian and he sees no performance imp
| |
173 return constructor; | 174 return constructor; |
174 }"""; | 175 }"""; |
175 } | 176 } |
176 | 177 |
177 /** Needs defineClass to be defined. */ | 178 /** Needs defineClass to be defined. */ |
178 String get protoSupportCheck { | 179 String get protoSupportCheck { |
179 // On Firefox and Webkit browsers we can manipulate the __proto__ | 180 // On Firefox and Webkit browsers we can manipulate the __proto__ |
180 // directly. Opera claims to have __proto__ support, but it is buggy. | 181 // directly. Opera claims to have __proto__ support, but it is buggy. |
181 // So we have to do more checks. | 182 // So we have to do more checks. |
182 // Opera bug was filed as DSK-370158, and fixed as CORE-47615 | 183 // Opera bug was filed as DSK-370158, and fixed as CORE-47615 |
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1688 const String HOOKS_API_USAGE = """ | 1689 const String HOOKS_API_USAGE = """ |
1689 // Generated by dart2js, the Dart to JavaScript compiler. | 1690 // Generated by dart2js, the Dart to JavaScript compiler. |
1690 // The code supports the following hooks: | 1691 // The code supports the following hooks: |
1691 // dartPrint(message) - if this function is defined it is called | 1692 // dartPrint(message) - if this function is defined it is called |
1692 // instead of the Dart [print] method. | 1693 // instead of the Dart [print] method. |
1693 // dartMainRunner(main) - if this function is defined, the Dart [main] | 1694 // dartMainRunner(main) - if this function is defined, the Dart [main] |
1694 // method will not be invoked directly. | 1695 // method will not be invoked directly. |
1695 // Instead, a closure that will invoke [main] is | 1696 // Instead, a closure that will invoke [main] is |
1696 // passed to [dartMainRunner]. | 1697 // passed to [dartMainRunner]. |
1697 """; | 1698 """; |
OLD | NEW |