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

Side by Side Diff: tests/compiler/dart2js/diagnostic_helper.dart

Issue 1661853005: Introduce getPrefixEndToken to avoid too big context in messages. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 10 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
« no previous file with comments | « pkg/compiler/lib/src/tree/nodes.dart ('k') | tests/compiler/dart2js/message_span_test.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 dart2js.test.diagnostic_helper; 5 library dart2js.test.diagnostic_helper;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:compiler/compiler_new.dart' show 9 import 'package:compiler/compiler_new.dart' show
10 CompilerDiagnostics, 10 CompilerDiagnostics,
11 Diagnostic; 11 Diagnostic;
12 import 'package:compiler/src/diagnostics/messages.dart' show 12 import 'package:compiler/src/diagnostics/messages.dart' show
13 Message, 13 Message,
14 MessageKind; 14 MessageKind;
15 import 'package:expect/expect.dart'; 15 import 'package:expect/expect.dart';
16 16
17 class CollectedMessage { 17 class CollectedMessage {
18 final Message message; 18 final Message message;
19 final Uri uri; 19 final Uri uri;
20 final int begin; 20 final int begin;
21 final int end; 21 final int end;
22 final String text; 22 final String text;
23 final Diagnostic kind; 23 final Diagnostic kind;
24 24
25 CollectedMessage( 25 CollectedMessage(
26 this.message, this.uri, this.begin, this.end, this.text, this.kind); 26 this.message, this.uri, this.begin, this.end, this.text, this.kind);
27 27
28 MessageKind get messageKind => message.kind; 28 MessageKind get messageKind => message?.kind;
29 29
30 String toString() { 30 String toString() {
31 return '${message != null ? message.kind : ''}' 31 return '${message != null ? message.kind : ''}'
32 ':$uri:$begin:$end:$text:$kind'; 32 ':$uri:$begin:$end:$text:$kind';
33 } 33 }
34 } 34 }
35 35
36 class DiagnosticCollector implements CompilerDiagnostics { 36 class DiagnosticCollector implements CompilerDiagnostics {
37 List<CollectedMessage> messages = <CollectedMessage>[]; 37 List<CollectedMessage> messages = <CollectedMessage>[];
38 38
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 String expectedValue = '${arguments[key]}'; 185 String expectedValue = '${arguments[key]}';
186 String foundValue = '${message.arguments[key]}'; 186 String foundValue = '${message.arguments[key]}';
187 if (expectedValue != foundValue) { 187 if (expectedValue != foundValue) {
188 return 'Expected argument $key with value $expectedValue, ' 188 return 'Expected argument $key with value $expectedValue, '
189 'found $foundValue.'; 189 'found $foundValue.';
190 } 190 }
191 } 191 }
192 return null; 192 return null;
193 }; 193 };
194 } 194 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree/nodes.dart ('k') | tests/compiler/dart2js/message_span_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698