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

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

Issue 10363003: Compute function types together with the parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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 Constant implements Hashable { 5 class Constant implements Hashable {
6 const Constant(); 6 const Constant();
7 7
8 bool isNull() => false; 8 bool isNull() => false;
9 bool isBool() => false; 9 bool isBool() => false;
10 bool isTrue() => false; 10 bool isTrue() => false;
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 return super.visitSend(send); 1038 return super.visitSend(send);
1039 } 1039 }
1040 1040
1041 /** 1041 /**
1042 * Given the arguments (a list of constants) assigns them to the parameters, 1042 * Given the arguments (a list of constants) assigns them to the parameters,
1043 * updating the definitions map. If the constructor has field-initializer 1043 * updating the definitions map. If the constructor has field-initializer
1044 * parameters (like [:this.x:]), also updates the [fieldValues] map. 1044 * parameters (like [:this.x:]), also updates the [fieldValues] map.
1045 */ 1045 */
1046 void assignArgumentsToParameters(List<Constant> arguments) { 1046 void assignArgumentsToParameters(List<Constant> arguments) {
1047 // Assign arguments to parameters. 1047 // Assign arguments to parameters.
1048 FunctionParameters parameters = constructor.computeParameters(compiler); 1048 FunctionSignature parameters = constructor.computeSignature(compiler);
1049 int index = 0; 1049 int index = 0;
1050 parameters.forEachParameter((Element parameter) { 1050 parameters.forEachParameter((Element parameter) {
1051 Constant argument = arguments[index++]; 1051 Constant argument = arguments[index++];
1052 definitions[parameter] = argument; 1052 definitions[parameter] = argument;
1053 if (parameter.kind == ElementKind.FIELD_PARAMETER) { 1053 if (parameter.kind == ElementKind.FIELD_PARAMETER) {
1054 FieldParameterElement fieldParameterElement = parameter; 1054 FieldParameterElement fieldParameterElement = parameter;
1055 fieldValues[fieldParameterElement.fieldElement] = argument; 1055 fieldValues[fieldParameterElement.fieldElement] = argument;
1056 } 1056 }
1057 }); 1057 });
1058 } 1058 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 Constant fieldValue = fieldValues[field]; 1147 Constant fieldValue = fieldValues[field];
1148 if (fieldValue === null) { 1148 if (fieldValue === null) {
1149 // Use the default value. 1149 // Use the default value.
1150 fieldValue = compiler.compileVariable(field); 1150 fieldValue = compiler.compileVariable(field);
1151 } 1151 }
1152 jsNewArguments.add(fieldValue); 1152 jsNewArguments.add(fieldValue);
1153 }); 1153 });
1154 return jsNewArguments; 1154 return jsNewArguments;
1155 } 1155 }
1156 } 1156 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/compiler.dart » ('j') | lib/compiler/implementation/elements/elements.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698