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

Side by Side Diff: pkg/analyzer2dart/lib/src/cps_generator.dart

Issue 1057483004: Clean up handling of constants in the CPS backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | pkg/compiler/lib/src/cps_ir/cps_ir_builder.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library analyzer2dart.cps_generator; 5 library analyzer2dart.cps_generator;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 8
9 import 'package:compiler/src/dart_types.dart' as dart2js; 9 import 'package:compiler/src/dart_types.dart' as dart2js;
10 import 'package:compiler/src/elements/elements.dart' as dart2js; 10 import 'package:compiler/src/elements/elements.dart' as dart2js;
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 element, 262 element,
263 createCallStructureFromMethodInvocation(node.argumentList), 263 createCallStructureFromMethodInvocation(node.argumentList),
264 type, 264 type,
265 arguments); 265 arguments);
266 } 266 }
267 return giveUp(node, "Unresolved constructor invocation."); 267 return giveUp(node, "Unresolved constructor invocation.");
268 } 268 }
269 269
270 @override 270 @override
271 ir.Constant visitNullLiteral(NullLiteral node) { 271 ir.Constant visitNullLiteral(NullLiteral node) {
272 return irBuilder.buildNullLiteral(); 272 return irBuilder.buildNullConstant();
273 } 273 }
274 274
275 @override 275 @override
276 ir.Constant visitBooleanLiteral(BooleanLiteral node) { 276 ir.Constant visitBooleanLiteral(BooleanLiteral node) {
277 return irBuilder.buildBooleanLiteral(node.value); 277 return irBuilder.buildBooleanConstant(node.value);
278 } 278 }
279 279
280 @override 280 @override
281 ir.Constant visitDoubleLiteral(DoubleLiteral node) { 281 ir.Constant visitDoubleLiteral(DoubleLiteral node) {
282 return irBuilder.buildDoubleLiteral(node.value); 282 return irBuilder.buildDoubleConstant(node.value);
283 } 283 }
284 284
285 @override 285 @override
286 ir.Constant visitIntegerLiteral(IntegerLiteral node) { 286 ir.Constant visitIntegerLiteral(IntegerLiteral node) {
287 return irBuilder.buildIntegerLiteral(node.value); 287 return irBuilder.buildIntegerConstant(node.value);
288 } 288 }
289 289
290 @override 290 @override
291 visitAdjacentStrings(AdjacentStrings node) { 291 visitAdjacentStrings(AdjacentStrings node) {
292 String value = node.stringValue; 292 String value = node.stringValue;
293 if (value != null) { 293 if (value != null) {
294 return irBuilder.buildStringLiteral(value); 294 return irBuilder.buildStringConstant(value);
295 } 295 }
296 giveUp(node, "Non constant adjacent strings."); 296 giveUp(node, "Non constant adjacent strings.");
297 } 297 }
298 298
299 @override 299 @override
300 ir.Constant visitSimpleStringLiteral(SimpleStringLiteral node) { 300 ir.Constant visitSimpleStringLiteral(SimpleStringLiteral node) {
301 return irBuilder.buildStringLiteral(node.value); 301 return irBuilder.buildStringConstant(node.value);
302 } 302 }
303 303
304 @override 304 @override
305 visitStringInterpolation(StringInterpolation node) { 305 visitStringInterpolation(StringInterpolation node) {
306 giveUp(node, "String interpolation."); 306 giveUp(node, "String interpolation.");
307 } 307 }
308 308
309 @override 309 @override
310 visitReturnStatement(ReturnStatement node) { 310 visitReturnStatement(ReturnStatement node) {
311 irBuilder.buildReturn(build(node.expression)); 311 irBuilder.buildReturn(build(node.expression));
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 catchClause.exceptionParameter.staticElement), 580 catchClause.exceptionParameter.staticElement),
581 buildCatchBlock: subbuild(catchClause.body))); 581 buildCatchBlock: subbuild(catchClause.body)));
582 582
583 } 583 }
584 irBuilder.buildTry( 584 irBuilder.buildTry(
585 tryStatementInfo: new TryStatementInfo(), 585 tryStatementInfo: new TryStatementInfo(),
586 buildTryBlock: subbuild(node.body), 586 buildTryBlock: subbuild(node.body),
587 catchClauseInfos: catchClauseInfos); 587 catchClauseInfos: catchClauseInfos);
588 } 588 }
589 } 589 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698