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

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

Issue 3008133002: Handle local invoke in inferrer (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:async'; 5 import 'dart:async';
6 import 'dart:io'; 6 import 'dart:io';
7 7
8 import 'package:compiler/src/common.dart'; 8 import 'package:compiler/src/common.dart';
9 import 'package:compiler/src/common_elements.dart'; 9 import 'package:compiler/src/common_elements.dart';
10 import 'package:compiler/src/compiler.dart'; 10 import 'package:compiler/src/compiler.dart';
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 }); 126 });
127 return withAnnotations(annotations); 127 return withAnnotations(annotations);
128 } 128 }
129 129
130 String get diffCode { 130 String get diffCode {
131 Map<int, List<String>> annotations = <int, List<String>>{}; 131 Map<int, List<String>> annotations = <int, List<String>>{};
132 actualMap.forEach((Id id, ActualData data) { 132 actualMap.forEach((Id id, ActualData data) {
133 IdValue value = expectedMap[id]; 133 IdValue value = expectedMap[id];
134 if (data.value != value || value == null && data.value.value != '') { 134 if (data.value != value || value == null && data.value.value != '') {
135 String expected = value?.toString() ?? ''; 135 String expected = value?.toString() ?? '';
136 int offset = getOffsetFromId(id);
136 annotations 137 annotations
137 .putIfAbsent(data.sourceSpan.begin, () => []) 138 .putIfAbsent(offset, () => [])
138 .add('${expected} | ${data.value}'); 139 .add('${expected} | ${data.value}');
139 } 140 }
140 }); 141 });
141 expectedMap.forEach((Id id, IdValue expected) { 142 expectedMap.forEach((Id id, IdValue expected) {
142 if (!actualMap.containsKey(id)) { 143 if (!actualMap.containsKey(id)) {
143 int offset = compiler.reporter 144 int offset = getOffsetFromId(id);
144 .spanFromSpannable(
145 computeSpannable(elementEnvironment, mainUri, id))
146 .begin;
147 annotations.putIfAbsent(offset, () => []).add('${expected} | ---'); 145 annotations.putIfAbsent(offset, () => []).add('${expected} | ---');
148 } 146 }
149 }); 147 });
150 return withAnnotations(annotations); 148 return withAnnotations(annotations);
151 } 149 }
152 150
153 String computeDiffCodeFor(IdData other) { 151 String computeDiffCodeFor(IdData other) {
154 Map<int, List<String>> annotations = <int, List<String>>{}; 152 Map<int, List<String>> annotations = <int, List<String>>{};
155 actualMap.forEach((Id id, ActualData data1) { 153 actualMap.forEach((Id id, ActualData data1) {
156 ActualData data2 = other.actualMap[id]; 154 ActualData data2 = other.actualMap[id];
157 if (data1.value != data2?.value) { 155 if (data1.value != data2?.value) {
158 annotations 156 annotations
159 .putIfAbsent(data1.sourceSpan.begin, () => []) 157 .putIfAbsent(data1.sourceSpan.begin, () => [])
160 .add('${data1.value} | ${data2?.value ?? '---'}'); 158 .add('${data1.value} | ${data2?.value ?? '---'}');
161 } 159 }
162 }); 160 });
163 other.actualMap.forEach((Id id, ActualData data2) { 161 other.actualMap.forEach((Id id, ActualData data2) {
164 if (!actualMap.containsKey(id)) { 162 if (!actualMap.containsKey(id)) {
165 int offset = compiler.reporter 163 int offset = compiler.reporter
166 .spanFromSpannable( 164 .spanFromSpannable(
167 computeSpannable(elementEnvironment, mainUri, id)) 165 computeSpannable(elementEnvironment, mainUri, id))
168 .begin; 166 .begin;
169 annotations.putIfAbsent(offset, () => []).add('--- | ${data2.value}'); 167 annotations.putIfAbsent(offset, () => []).add('--- | ${data2.value}');
170 } 168 }
171 }); 169 });
172 return withAnnotations(annotations); 170 return withAnnotations(annotations);
173 } 171 }
172
173 int getOffsetFromId(Id id) {
174 return compiler.reporter
175 .spanFromSpannable(computeSpannable(elementEnvironment, mainUri, id))
176 .begin;
177 }
174 } 178 }
175 179
176 /// Check code for all test files int [data] using [computeFromAst] and 180 /// Check code for all test files int [data] using [computeFromAst] and
177 /// [computeFromKernel] from the respective front ends. If [skipForKernel] 181 /// [computeFromKernel] from the respective front ends. If [skipForKernel]
178 /// contains the name of the test file it isn't tested for kernel. 182 /// contains the name of the test file it isn't tested for kernel.
179 Future checkTests(Directory dataDir, ComputeMemberDataFunction computeFromAst, 183 Future checkTests(Directory dataDir, ComputeMemberDataFunction computeFromAst,
180 ComputeMemberDataFunction computeFromKernel, 184 ComputeMemberDataFunction computeFromKernel,
181 {List<String> skipForKernel: const <String>[], 185 {List<String> skipForKernel: const <String>[],
182 List<String> options: const <String>[], 186 List<String> options: const <String>[],
183 List<String> args: const <String>[]}) async { 187 List<String> args: const <String>[]}) async {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 289
286 /// Compute the expectancy map from [code]. 290 /// Compute the expectancy map from [code].
287 Map<Id, IdValue> computeExpectedMap(AnnotatedCode code) { 291 Map<Id, IdValue> computeExpectedMap(AnnotatedCode code) {
288 Map<Id, IdValue> map = <Id, IdValue>{}; 292 Map<Id, IdValue> map = <Id, IdValue>{};
289 for (Annotation annotation in code.annotations) { 293 for (Annotation annotation in code.annotations) {
290 IdValue idValue = IdValue.decode(annotation.offset, annotation.text); 294 IdValue idValue = IdValue.decode(annotation.offset, annotation.text);
291 map[idValue.id] = idValue; 295 map[idValue.id] = idValue;
292 } 296 }
293 return map; 297 return map;
294 } 298 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/types/types.dart ('k') | tests/compiler/dart2js/inference/data/locals.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698