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

Side by Side Diff: lib/compiler/implementation/universe.dart

Issue 9930005: Use default values of named arguments when invoking the default super constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 8 years, 8 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
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | tests/language/language.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 nameSet.remove(name); 112 nameSet.remove(name);
113 } 113 }
114 return true; 114 return true;
115 } 115 }
116 } 116 }
117 117
118 /** 118 /**
119 * Returns [:true:] if the selector and the [element] match; [:false:] 119 * Returns [:true:] if the selector and the [element] match; [:false:]
120 * otherwise. 120 * otherwise.
121 */ 121 */
122 bool addSendArgumentsToList(Send send, 122 bool addArgumentsToList(Link<Node> arguments,
123 List list, 123 List list,
124 FunctionParameters parameters, 124 FunctionParameters parameters,
125 compileArgument(Node argument), 125 compileArgument(Node argument),
126 compileConstant(Element element)) { 126 compileConstant(Element element)) {
127 void addMatchingSendArgumentsToList(Link<Node> link) { 127 void addMatchingSendArgumentsToList(Link<Node> link) {
128 for (; !link.isEmpty(); link = link.tail) { 128 for (; !link.isEmpty(); link = link.tail) {
129 list.add(compileArgument(link.head)); 129 list.add(compileArgument(link.head));
130 } 130 }
131 } 131 }
132 132
133 if (!this.applies(parameters)) return false; 133 if (!this.applies(parameters)) return false;
134 if (this.positionalArgumentCount == parameters.parameterCount) { 134 if (this.positionalArgumentCount == parameters.parameterCount) {
135 addMatchingSendArgumentsToList(send.arguments); 135 addMatchingSendArgumentsToList(arguments);
136 return true; 136 return true;
137 } 137 }
138 138
139 // If there are named arguments, provide them in the order 139 // If there are named arguments, provide them in the order
140 // expected by the called function, which is the source order. 140 // expected by the called function, which is the source order.
141 141
142 // Visit positional arguments and add them to the list. 142 // Visit positional arguments and add them to the list.
143 Link<Node> arguments = send.arguments;
144 int positionalArgumentCount = this.positionalArgumentCount; 143 int positionalArgumentCount = this.positionalArgumentCount;
145 for (int i = 0; 144 for (int i = 0;
146 i < positionalArgumentCount; 145 i < positionalArgumentCount;
147 arguments = arguments.tail, i++) { 146 arguments = arguments.tail, i++) {
148 list.add(compileArgument(arguments.head)); 147 list.add(compileArgument(arguments.head));
149 } 148 }
150 149
151 // Visit named arguments and add them into a temporary list. 150 // Visit named arguments and add them into a temporary list.
152 List namedArguments = []; 151 List namedArguments = [];
153 for (; !arguments.isEmpty(); arguments = arguments.tail) { 152 for (; !arguments.isEmpty(); arguments = arguments.tail) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if (!orderedNamedArguments.isEmpty()) return orderedNamedArguments; 224 if (!orderedNamedArguments.isEmpty()) return orderedNamedArguments;
226 225
227 List<SourceString> list = new List<SourceString>.from(namedArguments); 226 List<SourceString> list = new List<SourceString>.from(namedArguments);
228 list.sort((SourceString first, SourceString second) { 227 list.sort((SourceString first, SourceString second) {
229 return first.slowToString().compareTo(second.slowToString()); 228 return first.slowToString().compareTo(second.slowToString());
230 }); 229 });
231 orderedNamedArguments = list; 230 orderedNamedArguments = list;
232 return orderedNamedArguments; 231 return orderedNamedArguments;
233 } 232 }
234 } 233 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698