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

Side by Side Diff: pkg/compiler/lib/src/ssa/kernel_string_builder.dart

Issue 2982783003: Use failedAt in more places (Closed)
Patch Set: Created 3 years, 5 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import 'builder_kernel.dart'; 8 import 'builder_kernel.dart';
9 import 'nodes.dart'; 9 import 'nodes.dart';
10 10
11 /// Visits and concatenates the expressions in a string concatenation. 11 /// Visits and concatenates the expressions in a string concatenation.
12 class KernelStringBuilder extends ir.Visitor { 12 class KernelStringBuilder extends ir.Visitor {
13 final KernelSsaGraphBuilder builder; 13 final KernelSsaGraphBuilder builder;
14 14
15 /// The string value generated so far. 15 /// The string value generated so far.
16 HInstruction result = null; 16 HInstruction result = null;
17 17
18 KernelStringBuilder(this.builder); 18 KernelStringBuilder(this.builder);
19 19
20 @override 20 @override
21 void defaultNode(ir.Node node) { 21 void defaultNode(ir.Node node) {
22 throw new SpannableAssertionFailure( 22 failedAt(CURRENT_ELEMENT_SPANNABLE, 'Unexpected node: $node');
23 CURRENT_ELEMENT_SPANNABLE, 'Unexpected node: $node');
24 } 23 }
25 24
26 @override 25 @override
27 void defaultExpression(ir.Expression node) { 26 void defaultExpression(ir.Expression node) {
28 node.accept(builder); 27 node.accept(builder);
29 HInstruction expression = builder.pop(); 28 HInstruction expression = builder.pop();
30 29
31 // We want to use HStringify when: 30 // We want to use HStringify when:
32 // 1. The value is known to be a primitive type, because it might get 31 // 1. The value is known to be a primitive type, because it might get
33 // constant-folded and codegen has some tricks with JavaScript 32 // constant-folded and codegen has some tricks with JavaScript
(...skipping 29 matching lines...) Expand all
63 return instruction; 62 return instruction;
64 } 63 }
65 64
66 HInstruction stringify(HInstruction expression) { 65 HInstruction stringify(HInstruction expression) {
67 HInstruction instruction = 66 HInstruction instruction =
68 new HStringify(expression, builder.commonMasks.stringType); 67 new HStringify(expression, builder.commonMasks.stringType);
69 builder.add(instruction); 68 builder.add(instruction);
70 return instruction; 69 return instruction;
71 } 70 }
72 } 71 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/kernel_impact.dart ('k') | pkg/compiler/lib/src/ssa/locals_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698