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

Side by Side Diff: tests/compiler/dart2js/equivalence/id_equivalence_test.dart

Issue 3007783004: Handle switch continue (Closed)
Patch Set: Updated cf. comment Created 3 years, 3 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 'dart:io'; 5 import 'dart:io';
6 import 'package:async_helper/async_helper.dart'; 6 import 'package:async_helper/async_helper.dart';
7 import 'package:compiler/src/commandline_options.dart'; 7 import 'package:compiler/src/commandline_options.dart';
8 import 'package:compiler/src/common.dart'; 8 import 'package:compiler/src/common.dart';
9 import 'package:compiler/src/compiler.dart'; 9 import 'package:compiler/src/compiler.dart';
10 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; 10 import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return 'get:$propertyName'; 100 return 'get:$propertyName';
101 } 101 }
102 102
103 String computeInvokeName(String propertyName) { 103 String computeInvokeName(String propertyName) {
104 return 'invoke:$propertyName'; 104 return 'invoke:$propertyName';
105 } 105 }
106 106
107 String get loopName => 'loop'; 107 String get loopName => 'loop';
108 108
109 String get gotoName => 'goto'; 109 String get gotoName => 'goto';
110
111 String get switchName => 'switch';
112
113 String get switchCaseName => 'case';
110 } 114 }
111 115
112 /// AST visitor for computing a descriptive mapping of the [Id]s in a member. 116 /// AST visitor for computing a descriptive mapping of the [Id]s in a member.
113 class ResolvedAstComputer extends AstDataExtractor with ComputerMixin { 117 class ResolvedAstComputer extends AstDataExtractor with ComputerMixin {
114 ResolvedAstComputer(DiagnosticReporter reporter, 118 ResolvedAstComputer(DiagnosticReporter reporter,
115 Map<Id, ActualData> actualMap, ResolvedAst resolvedAst) 119 Map<Id, ActualData> actualMap, ResolvedAst resolvedAst)
116 : super(reporter, actualMap, resolvedAst); 120 : super(reporter, actualMap, resolvedAst);
117 121
118 @override 122 @override
119 String computeNodeValue(ast.Node node, AstElement element) { 123 String computeNodeValue(ast.Node node, AstElement element) {
120 if (element != null && element.isLocal) { 124 if (element != null && element.isLocal) {
121 return computeLocalName(element.name); 125 return computeLocalName(element.name);
122 } 126 }
123 if (node is ast.Loop) { 127 if (node is ast.Loop) {
124 return loopName; 128 return loopName;
125 } else if (node is ast.GotoStatement) { 129 } else if (node is ast.GotoStatement) {
126 return gotoName; 130 return gotoName;
131 } else if (node is ast.SwitchStatement) {
132 return switchName;
133 } else if (node is ast.SwitchCase) {
134 return switchCaseName;
127 } 135 }
128 136
129 dynamic sendStructure; 137 dynamic sendStructure;
130 if (node is ast.Send) { 138 if (node is ast.Send) {
131 sendStructure = elements.getSendStructure(node); 139 sendStructure = elements.getSendStructure(node);
132 if (sendStructure == null) return null; 140 if (sendStructure == null) return null;
133 141
134 String getDynamicName() { 142 String getDynamicName() {
135 switch (sendStructure.semantics.kind) { 143 switch (sendStructure.semantics.kind) {
136 case AccessKind.PARAMETER: 144 case AccessKind.PARAMETER:
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } else if (node is ir.DoStatement) { 222 } else if (node is ir.DoStatement) {
215 return loopName; 223 return loopName;
216 } else if (node is ir.ForStatement) { 224 } else if (node is ir.ForStatement) {
217 return loopName; 225 return loopName;
218 } else if (node is ir.ForInStatement) { 226 } else if (node is ir.ForInStatement) {
219 return loopName; 227 return loopName;
220 } else if (node is ir.WhileStatement) { 228 } else if (node is ir.WhileStatement) {
221 return loopName; 229 return loopName;
222 } else if (node is ir.BreakStatement) { 230 } else if (node is ir.BreakStatement) {
223 return gotoName; 231 return gotoName;
232 } else if (node is ir.ContinueSwitchStatement) {
233 return gotoName;
234 } else if (node is ir.SwitchStatement) {
235 return switchName;
236 } else if (node is ir.SwitchCase) {
237 return switchCaseName;
224 } 238 }
225 return '<unknown:$node (${node.runtimeType})>'; 239 return '<unknown:$node (${node.runtimeType})>';
226 } 240 }
227 241
228 @override 242 @override
229 String computeMemberValue(ir.Member member) { 243 String computeMemberValue(ir.Member member) {
230 return computeMemberName(member.enclosingClass?.name, member.name.name); 244 return computeMemberName(member.enclosingClass?.name, member.name.name);
231 } 245 }
232 } 246 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/equivalence/id_equivalence_helper.dart ('k') | tests/compiler/dart2js/inference/inference_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698