| 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 dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Generates the code for all used classes in the program. Static fields (even | 8 * Generates the code for all used classes in the program. Static fields (even |
| 9 * in classes) are ignored, since they can be treated as non-class elements. | 9 * in classes) are ignored, since they can be treated as non-class elements. |
| 10 * | 10 * |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 if (!mangledName.startsWith(namer.setterPrefix)) return '$name='; | 672 if (!mangledName.startsWith(namer.setterPrefix)) return '$name='; |
| 673 String base = mangledName.substring(namer.setterPrefix.length); | 673 String base = mangledName.substring(namer.setterPrefix.length); |
| 674 String getter = '${namer.getterPrefix}$base'; | 674 String getter = '${namer.getterPrefix}$base'; |
| 675 mangledFieldNames[getter] = name; | 675 mangledFieldNames[getter] = name; |
| 676 recordedMangledNames.add(getter); | 676 recordedMangledNames.add(getter); |
| 677 // TODO(karlklose,ahe): we do not actually need to store information | 677 // TODO(karlklose,ahe): we do not actually need to store information |
| 678 // about the name of this setter in the output, but it is needed for | 678 // about the name of this setter in the output, but it is needed for |
| 679 // marking the function as invokable by reflection. | 679 // marking the function as invokable by reflection. |
| 680 return '$name='; | 680 return '$name='; |
| 681 } | 681 } |
| 682 if (elementOrSelector is Element && elementOrSelector.isClosure()) { |
| 683 // Closures are synthesized and their name might conflict with existing |
| 684 // globals. Assign an illegal name, and make sure they don't clash |
| 685 // with each other. |
| 686 return " $mangledName"; |
| 687 } |
| 682 if (elementOrSelector is Selector | 688 if (elementOrSelector is Selector |
| 683 || elementOrSelector.isFunction() | 689 || elementOrSelector.isFunction() |
| 684 || elementOrSelector.isConstructor()) { | 690 || elementOrSelector.isConstructor()) { |
| 685 int requiredParameterCount; | 691 int requiredParameterCount; |
| 686 int optionalParameterCount; | 692 int optionalParameterCount; |
| 687 String namedArguments = ''; | 693 String namedArguments = ''; |
| 688 bool isConstructor = false; | 694 bool isConstructor = false; |
| 689 if (elementOrSelector is Selector) { | 695 if (elementOrSelector is Selector) { |
| 690 Selector selector = elementOrSelector; | 696 Selector selector = elementOrSelector; |
| 691 requiredParameterCount = selector.argumentCount; | 697 requiredParameterCount = selector.argumentCount; |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1644 String sourceMap = buildSourceMap(mainBuffer, compiledFile); | 1650 String sourceMap = buildSourceMap(mainBuffer, compiledFile); |
| 1645 compiler.outputProvider(name, 'js.map') | 1651 compiler.outputProvider(name, 'js.map') |
| 1646 ..add(sourceMap) | 1652 ..add(sourceMap) |
| 1647 ..close(); | 1653 ..close(); |
| 1648 } | 1654 } |
| 1649 | 1655 |
| 1650 void registerReadTypeVariable(TypeVariableElement element) { | 1656 void registerReadTypeVariable(TypeVariableElement element) { |
| 1651 readTypeVariables.add(element); | 1657 readTypeVariables.add(element); |
| 1652 } | 1658 } |
| 1653 } | 1659 } |
| OLD | NEW |