Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(525)

Unified Diff: lib/compiler/implementation/elements/elements.dart

Issue 10991034: Order the parameters of a function at the definition site. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/elements/elements.dart
===================================================================
--- lib/compiler/implementation/elements/elements.dart (revision 12903)
+++ 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,28 @@
}
}
+ List<Element> get orderedOptionalParameters {
+ if (_orderedOptionalParameters != null) return _orderedOptionalParameters;
+ List<Element> list = new List<Element>.from(optionalParameters);
+ if (optionalParametersAreNamed) {
+ list.sort((Element a, Element b) {
+ return a.name.slowToString().compareTo(b.name.slowToString());
+ });
+ }
+ _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;
}
« no previous file with comments | « lib/compiler/implementation/compile_time_constants.dart ('k') | lib/compiler/implementation/js_backend/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698