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

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

Issue 2968383002: Add ConstructorBodyEntity (Closed)
Patch Set: Skip non-live constructor bodies 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 'kernel_ast_adapter.dart';
10 import 'nodes.dart'; 9 import 'nodes.dart';
11 10
12 /// Visits and concatenates the expressions in a string concatenation. 11 /// Visits and concatenates the expressions in a string concatenation.
13 class KernelStringBuilder extends ir.Visitor { 12 class KernelStringBuilder extends ir.Visitor {
14 final KernelSsaGraphBuilder builder; 13 final KernelSsaGraphBuilder builder;
15 KernelAstAdapter get astAdapter => builder.astAdapter;
16 14
17 /// The string value generated so far. 15 /// The string value generated so far.
18 HInstruction result = null; 16 HInstruction result = null;
19 17
20 KernelStringBuilder(this.builder); 18 KernelStringBuilder(this.builder);
21 19
22 @override 20 @override
23 void defaultNode(ir.Node node) { 21 void defaultNode(ir.Node node) {
24 throw new SpannableAssertionFailure( 22 throw new SpannableAssertionFailure(
25 astAdapter.getNode(node), 'Unexpected node.'); 23 CURRENT_ELEMENT_SPANNABLE, 'Unexpected node: $node');
26 } 24 }
27 25
28 @override 26 @override
29 void defaultExpression(ir.Expression node) { 27 void defaultExpression(ir.Expression node) {
30 node.accept(builder); 28 node.accept(builder);
31 HInstruction expression = builder.pop(); 29 HInstruction expression = builder.pop();
32 30
33 // We want to use HStringify when: 31 // We want to use HStringify when:
34 // 1. The value is known to be a primitive type, because it might get 32 // 1. The value is known to be a primitive type, because it might get
35 // constant-folded and codegen has some tricks with JavaScript 33 // constant-folded and codegen has some tricks with JavaScript
(...skipping 29 matching lines...) Expand all
65 return instruction; 63 return instruction;
66 } 64 }
67 65
68 HInstruction stringify(HInstruction expression) { 66 HInstruction stringify(HInstruction expression) {
69 HInstruction instruction = 67 HInstruction instruction =
70 new HStringify(expression, builder.commonMasks.stringType); 68 new HStringify(expression, builder.commonMasks.stringType);
71 builder.add(instruction); 69 builder.add(instruction);
72 return instruction; 70 return instruction;
73 } 71 }
74 } 72 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart ('k') | pkg/compiler/lib/src/ssa/loop_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698