OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 * Top level generator object for writing code and keeping track of | 6 * Top level generator object for writing code and keeping track of |
7 * dependencies. | 7 * dependencies. |
8 * | 8 * |
9 * Should have two compilation models, but only one implemented so far. | 9 * Should have two compilation models, but only one implemented so far. |
10 * | 10 * |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } | 317 } |
318 | 318 |
319 _writeProperty(PropertyMember property) { | 319 _writeProperty(PropertyMember property) { |
320 if (property.getter != null) _writeMethod(property.getter); | 320 if (property.getter != null) _writeMethod(property.getter); |
321 if (property.setter != null) _writeMethod(property.setter); | 321 if (property.setter != null) _writeMethod(property.setter); |
322 | 322 |
323 if (property._provideFieldSyntax) { | 323 if (property._provideFieldSyntax) { |
324 writer.enterBlock('Object.defineProperty(' + | 324 writer.enterBlock('Object.defineProperty(' + |
325 '${property.declaringType.jsname}.prototype, "${property.jsname}", {'); | 325 '${property.declaringType.jsname}.prototype, "${property.jsname}", {'); |
326 if (property.getter != null) { | 326 if (property.getter != null) { |
327 writer.writeln( | 327 writer.write( |
328 'get: ${property.declaringType.jsname}.prototype.${property.getter.jsn
ame},'); | 328 'get: ${property.declaringType.jsname}.prototype.${property.getter.jsn
ame}'); |
| 329 // The shenanigan below is to make IE happy -- IE 9 doesn't like a |
| 330 // trailing comma on the last element in a list. |
| 331 writer.writeln(property.setter == null ? '' : ','); |
329 } | 332 } |
330 if (property.setter != null) { | 333 if (property.setter != null) { |
331 writer.writeln( | 334 writer.writeln( |
332 'set: ${property.declaringType.jsname}.prototype.${property.setter.jsn
ame}'); | 335 'set: ${property.declaringType.jsname}.prototype.${property.setter.jsn
ame}'); |
333 } | 336 } |
334 writer.exitBlock('});'); | 337 writer.exitBlock('});'); |
335 } | 338 } |
336 } | 339 } |
337 | 340 |
338 _writeMethod(Member method) { | 341 _writeMethod(Member method) { |
(...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2223 result.add(new Value(world.varType, '\$$i', false, /*needsTemp:*/false)); | 2226 result.add(new Value(world.varType, '\$$i', false, /*needsTemp:*/false)); |
2224 } | 2227 } |
2225 for (int i = bareCount; i < length; i++) { | 2228 for (int i = bareCount; i < length; i++) { |
2226 var name = getName(i); | 2229 var name = getName(i); |
2227 if (name == null) name = '\$$i'; | 2230 if (name == null) name = '\$$i'; |
2228 result.add(new Value(world.varType, name, false, /*needsTemp:*/false)); | 2231 result.add(new Value(world.varType, name, false, /*needsTemp:*/false)); |
2229 } | 2232 } |
2230 return new Arguments(nodes, result); | 2233 return new Arguments(nodes, result); |
2231 } | 2234 } |
2232 } | 2235 } |
OLD | NEW |