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

Side by Side Diff: pkg/front_end/lib/src/fasta/fasta_codes.dart

Issue 2979623002: Use messages for (some) public API errors (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) 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 library fasta.codes; 5 library fasta.codes;
6 6
7 import 'package:front_end/src/scanner/token.dart' show Token; 7 import 'package:front_end/src/scanner/token.dart' show Token;
8 8
9 import 'package:front_end/compilation_error.dart' show CompilationError;
10
11 import 'package:source_span/source_span.dart' show SourceSpan, SourceLocation;
12
9 part 'fasta_codes_generated.dart'; 13 part 'fasta_codes_generated.dart';
10 14
11 class Code<T> { 15 class Code<T> {
12 final String name; 16 final String name;
13 17
14 final Template<T> template; 18 final Template<T> template;
15 19
16 final String analyzerCode; 20 final String analyzerCode;
17 21
18 final String dart2jsCode; 22 final String dart2jsCode;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 class Template<T> { 63 class Template<T> {
60 final String messageTemplate; 64 final String messageTemplate;
61 65
62 final String tipTemplate; 66 final String tipTemplate;
63 67
64 final T withArguments; 68 final T withArguments;
65 69
66 const Template({this.messageTemplate, this.tipTemplate, this.withArguments}); 70 const Template({this.messageTemplate, this.tipTemplate, this.withArguments});
67 } 71 }
68 72
69 class LocatedMessage { 73 class LocatedMessage implements CompilationError {
Siggi Cherem (dart-lang) 2017/07/11 03:57:13 Peter/Paul: a few questions for you here: 1- I wo
Paul Berry 2017/07/11 16:00:59 Wrapping LocationMessage sounds reasonable to me.
ahe 2017/07/12 13:14:43 I agree. In fact, I just sent out CL 2974203002 wh
70 final Uri uri; 74 final Uri uri;
71 75
72 final int charOffset; 76 final int charOffset;
73 77
74 final Message messageObject; 78 final Message messageObject;
75 79
76 const LocatedMessage(this.uri, this.charOffset, this.messageObject); 80 const LocatedMessage(this.uri, this.charOffset, this.messageObject);
77 81
78 Code get code => messageObject.code; 82 Code get code => messageObject.code;
79 83
80 String get message => messageObject.message; 84 String get message => messageObject.message;
81 85
82 String get tip => messageObject.tip; 86 String get tip => messageObject.tip;
83 87
88 SourceSpan get span =>
89 new SourceLocation(charOffset, sourceUrl: uri).pointSpan();
90
84 Map<String, dynamic> get arguments => messageObject.arguments; 91 Map<String, dynamic> get arguments => messageObject.arguments;
85 } 92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698