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

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

Issue 10180001: Introduce typed selectors to do better tree shaking based on calls on 'this'. Getters and setters w… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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 | « no previous file | lib/compiler/implementation/elements/elements.dart » ('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 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 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 } 950 }
951 951
952 visitSendSet(SendSet node) { 952 visitSendSet(SendSet node) {
953 error(node); 953 error(node);
954 } 954 }
955 955
956 /** Returns the list of constants that are passed to the static function. */ 956 /** Returns the list of constants that are passed to the static function. */
957 List<Constant> evaluateArgumentsToConstructor(Selector selector, 957 List<Constant> evaluateArgumentsToConstructor(Selector selector,
958 Link<Node> arguments, 958 Link<Node> arguments,
959 FunctionElement target) { 959 FunctionElement target) {
960 FunctionParameters parameters = target.computeParameters(compiler);
961 List<Constant> compiledArguments = <Constant>[]; 960 List<Constant> compiledArguments = <Constant>[];
962 961
963 Function compileArgument = evaluate; 962 Function compileArgument = evaluate;
964 Function compileConstant = compiler.compileVariable; 963 Function compileConstant = compiler.compileVariable;
965 bool succeeded = selector.addArgumentsToList(arguments, compiledArguments, 964 bool succeeded = selector.addArgumentsToList(arguments,
966 parameters, compileArgument, 965 compiledArguments,
967 compileConstant); 966 target,
967 compileArgument,
968 compileConstant,
969 compiler);
968 assert(succeeded); 970 assert(succeeded);
969 return compiledArguments; 971 return compiledArguments;
970 } 972 }
971 973
972 Constant visitNewExpression(NewExpression node) { 974 Constant visitNewExpression(NewExpression node) {
973 if (!node.isConst()) error(node); 975 if (!node.isConst()) error(node);
974 976
975 Send send = node.send; 977 Send send = node.send;
976 FunctionElement constructor = elements[send]; 978 FunctionElement constructor = elements[send];
977 ClassElement classElement = constructor.enclosingElement; 979 ClassElement classElement = constructor.enclosingElement;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 Constant fieldValue = fieldValues[field]; 1144 Constant fieldValue = fieldValues[field];
1143 if (fieldValue === null) { 1145 if (fieldValue === null) {
1144 // Use the default value. 1146 // Use the default value.
1145 fieldValue = compiler.compileVariable(field); 1147 fieldValue = compiler.compileVariable(field);
1146 } 1148 }
1147 jsNewArguments.add(fieldValue); 1149 jsNewArguments.add(fieldValue);
1148 }); 1150 });
1149 return jsNewArguments; 1151 return jsNewArguments;
1150 } 1152 }
1151 } 1153 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/elements/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698