| 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 var typeName = type.jsname != null ? type.jsname : 'top level'; | 270 var typeName = type.jsname != null ? type.jsname : 'top level'; |
| 271 writer.comment('// ********** Code for ${typeName} **************'); | 271 writer.comment('// ********** Code for ${typeName} **************'); |
| 272 if (type.isNative && !type.isTop) { | 272 if (type.isNative && !type.isTop) { |
| 273 var nativeName = type.definition.nativeType.name; | 273 var nativeName = type.definition.nativeType.name; |
| 274 if (nativeName == '') { | 274 if (nativeName == '') { |
| 275 writer.writeln('function ${type.jsname}() {}'); | 275 writer.writeln('function ${type.jsname}() {}'); |
| 276 } else if (type.jsname != nativeName) { | 276 } else if (type.jsname != nativeName) { |
| 277 if (type.isHiddenNativeType) { | 277 if (type.isHiddenNativeType) { |
| 278 // This is a holder for static methods. | 278 // This is a holder for static methods. |
| 279 // TODO(sra): Generate only if used. | 279 // TODO(sra): Generate only if used. |
| 280 writer.writeln('function ${type.jsname}() {}'); | 280 writer.writeln('var ${type.jsname} = {};'); |
| 281 } else { | 281 } else { |
| 282 writer.writeln('${type.jsname} = ${nativeName};'); | 282 writer.writeln('${type.jsname} = ${nativeName};'); |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 } | 285 } |
| 286 | 286 |
| 287 // We need the $inherits function to be declared before factory constructors | 287 // We need the $inherits function to be declared before factory constructors |
| 288 // so that inheritance ($inherits) will work correctly in IE. | 288 // so that inheritance ($inherits) will work correctly in IE. |
| 289 if (!type.isTop) { | 289 if (!type.isTop) { |
| 290 if (type is ConcreteType) { | 290 if (type is ConcreteType) { |
| (...skipping 2260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2551 result.add(new Value(world.varType, '\$$i', null, /*needsTemp:*/false)); | 2551 result.add(new Value(world.varType, '\$$i', null, /*needsTemp:*/false)); |
| 2552 } | 2552 } |
| 2553 for (int i = bareCount; i < length; i++) { | 2553 for (int i = bareCount; i < length; i++) { |
| 2554 var name = getName(i); | 2554 var name = getName(i); |
| 2555 if (name == null) name = '\$$i'; | 2555 if (name == null) name = '\$$i'; |
| 2556 result.add(new Value(world.varType, name, null, /*needsTemp:*/false)); | 2556 result.add(new Value(world.varType, name, null, /*needsTemp:*/false)); |
| 2557 } | 2557 } |
| 2558 return new Arguments(nodes, result); | 2558 return new Arguments(nodes, result); |
| 2559 } | 2559 } |
| 2560 } | 2560 } |
| OLD | NEW |