Chromium Code Reviews| Index: lib/compiler/implementation/elements/elements.dart |
| =================================================================== |
| --- lib/compiler/implementation/elements/elements.dart (revision 12897) |
| +++ lib/compiler/implementation/elements/elements.dart (working copy) |
| @@ -945,6 +945,9 @@ |
| final int requiredParameterCount; |
| final int optionalParameterCount; |
| final bool optionalParametersAreNamed; |
| + |
| + List<Element> _orderedOptionalParameters; |
| + |
| FunctionSignature(this.requiredParameters, |
| this.optionalParameters, |
| this.requiredParameterCount, |
| @@ -968,11 +971,31 @@ |
| } |
| } |
| + List<Element> get orderedOptionalParameters { |
| + if (_orderedOptionalParameters != null) return _orderedOptionalParameters; |
| + List<Element> list = <Element>[]; |
| + if (optionalParametersAreNamed) { |
| + optionalParameters.forEach((Element element) { list.add(element); }); |
|
kasperl
2012/09/26 11:53:55
Can you get rid of this and use:
list = new Li
ngeoffray
2012/09/26 12:28:47
Good point. Done.
|
| + list.sort((Element a, Element b) { |
| + return a.name.slowToString().compareTo(b.name.slowToString()); |
| + }); |
| + } else { |
| + optionalParameters.forEach((Element element) { list.add(element); }); |
| + } |
| + _orderedOptionalParameters = list; |
| + return list; |
| + } |
| + |
| void forEachParameter(void function(Element parameter)) { |
| forEachRequiredParameter(function); |
| forEachOptionalParameter(function); |
| } |
| + void orderedForEachParameter(void function(Element parameter)) { |
| + forEachRequiredParameter(function); |
| + orderedOptionalParameters.forEach(function); |
| + } |
| + |
| int get parameterCount => requiredParameterCount + optionalParameterCount; |
| } |