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

Side by Side Diff: frog/leg/universe.dart

Issue 9705025: const constructors with optional arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 class Universe { 5 class Universe {
6 Map<Element, String> generatedCode; 6 Map<Element, String> generatedCode;
7 Map<Element, String> generatedBailoutCode; 7 Map<Element, String> generatedBailoutCode;
8 final Set<ClassElement> instantiatedClasses; 8 final Set<ClassElement> instantiatedClasses;
9 final Set<SourceString> instantiatedClassInstanceFields; 9 final Set<SourceString> instantiatedClassInstanceFields;
10 final Set<FunctionElement> staticFunctionsNeedingGetter; 10 final Set<FunctionElement> staticFunctionsNeedingGetter;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 int positionalArgumentCount = this.positionalArgumentCount; 142 int positionalArgumentCount = this.positionalArgumentCount;
143 for (int i = 0; 143 for (int i = 0;
144 i < positionalArgumentCount; 144 i < positionalArgumentCount;
145 arguments = arguments.tail, i++) { 145 arguments = arguments.tail, i++) {
146 list.add(visitArgument(arguments.head)); 146 list.add(visitArgument(arguments.head));
147 } 147 }
148 148
149 // Visit named arguments and add them into a temporary list. 149 // Visit named arguments and add them into a temporary list.
150 List namedArguments = []; 150 List namedArguments = [];
151 for (; !arguments.isEmpty(); arguments = arguments.tail) { 151 for (; !arguments.isEmpty(); arguments = arguments.tail) {
152 namedArguments.add(visitArgument(arguments.head)); 152 NamedArgument namedArgument = arguments.head;
153 namedArguments.add(visitArgument(namedArgument.expression));
153 } 154 }
154 155
155 Link<Element> remainingNamedParameters = parameters.optionalParameters; 156 Link<Element> remainingNamedParameters = parameters.optionalParameters;
156 // Skip the optional parameters that have been given in the 157 // Skip the optional parameters that have been given in the
157 // positional arguments. 158 // positional arguments.
158 for (int i = parameters.requiredParameterCount; 159 for (int i = parameters.requiredParameterCount;
159 i < positionalArgumentCount; 160 i < positionalArgumentCount;
160 i++) { 161 i++) {
161 remainingNamedParameters = remainingNamedParameters.tail; 162 remainingNamedParameters = remainingNamedParameters.tail;
162 } 163 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 if (!orderedNamedArguments.isEmpty()) return orderedNamedArguments; 223 if (!orderedNamedArguments.isEmpty()) return orderedNamedArguments;
223 224
224 List<SourceString> list = new List<SourceString>.from(namedArguments); 225 List<SourceString> list = new List<SourceString>.from(namedArguments);
225 list.sort((SourceString first, SourceString second) { 226 list.sort((SourceString first, SourceString second) {
226 return first.slowToString().compareTo(second.slowToString()); 227 return first.slowToString().compareTo(second.slowToString());
227 }); 228 });
228 orderedNamedArguments = list; 229 orderedNamedArguments = list;
229 return orderedNamedArguments; 230 return orderedNamedArguments;
230 } 231 }
231 } 232 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698