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; |
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 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 const String HOOKS_API_USAGE = """ | 1662 const String HOOKS_API_USAGE = """ |
1662 // Generated by dart2js, the Dart to JavaScript compiler. | 1663 // Generated by dart2js, the Dart to JavaScript compiler. |
1663 // The code supports the following hooks: | 1664 // The code supports the following hooks: |
1664 // dartPrint(message) - if this function is defined it is called | 1665 // dartPrint(message) - if this function is defined it is called |
1665 // instead of the Dart [print] method. | 1666 // instead of the Dart [print] method. |
1666 // dartMainRunner(main) - if this function is defined, the Dart [main] | 1667 // dartMainRunner(main) - if this function is defined, the Dart [main] |
1667 // method will not be invoked directly. | 1668 // method will not be invoked directly. |
1668 // Instead, a closure that will invoke [main] is | 1669 // Instead, a closure that will invoke [main] is |
1669 // passed to [dartMainRunner]. | 1670 // passed to [dartMainRunner]. |
1670 """; | 1671 """; |
OLD | NEW |