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

Side by Side Diff: lib/src/summary.dart

Issue 1023893004: Pass through context information in error messages (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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 | « lib/runtime/messages_widget.js ('k') | pubspec.yaml » ('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 /// Summary of error messages produced by a `SummaryReporter`. 5 /// Summary of error messages produced by a `SummaryReporter`.
6 library dev_compiler.src.summary; 6 library dev_compiler.src.summary;
7 7
8 import 'package:source_span/source_span.dart'; 8 import 'package:source_span/source_span.dart';
9 9
10 /// Summary information computed by the DDC checker. 10 /// Summary information computed by the DDC checker.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 final SourceSpan span; 145 final SourceSpan span;
146 final String message; 146 final String message;
147 147
148 MessageSummary(this.kind, this.level, this.span, this.message); 148 MessageSummary(this.kind, this.level, this.span, this.message);
149 149
150 Map toJsonMap() => { 150 Map toJsonMap() => {
151 'kind': kind, 151 'kind': kind,
152 'level': level, 152 'level': level,
153 'message': message, 153 'message': message,
154 'url': '${span.sourceUrl}', 154 'url': '${span.sourceUrl}',
155 'start': span.start.offset, 155 'start': [span.start.offset, span.start.line, span.start.column],
156 'end': span.end.offset, 156 'end': [span.end.offset, span.end.line, span.end.column],
157 'text': span.text, 157 'text': span.text,
158 'contextLine': span is SourceSpanContext
159 ? (span as SourceSpanContext).contextLine
Siggi Cherem (dart-lang) 2015/03/23 22:01:44 it's frustrating that here we are required to put
vsm 2015/03/23 22:11:34 You could file a type promo bug on this.
Siggi Cherem (dart-lang) 2015/03/26 22:20:18 We chatted offline: turns out this is a legitimate
160 : null,
158 }; 161 };
159 162
160 void accept(SummaryVisitor visitor) => visitor.visitMessage(this); 163 void accept(SummaryVisitor visitor) => visitor.visitMessage(this);
161 164
162 static MessageSummary parse(Map json) { 165 static MessageSummary parse(Map json) {
163 var start = new SourceLocation(json['start'], sourceUrl: json['url']); 166 var start = new SourceLocation(json['start'][0],
164 var end = new SourceLocation(json['end'], sourceUrl: json['url']); 167 sourceUrl: json['url'],
165 var span = new SourceSpanBase(start, end, json['text']); 168 line: json['start'][1],
169 column: json['start'][2]);
170 var end = new SourceLocation(json['end'][0],
171 sourceUrl: json['url'], line: json['end'][1], column: json['end'][2]);
172 var context = json['contextLine'];
173 var span = context != null
174 ? new SourceSpanWithContext(start, end, json['text'], context)
175 : new SourceSpanBase(start, end, json['text']);
166 return new MessageSummary( 176 return new MessageSummary(
167 json['kind'], json['level'], span, json['message']); 177 json['kind'], json['level'], span, json['message']);
168 } 178 }
169 } 179 }
170 180
171 /// A visitor of the [Summary] hierarchy. 181 /// A visitor of the [Summary] hierarchy.
172 abstract class SummaryVisitor { 182 abstract class SummaryVisitor {
173 void visitGlobal(GlobalSummary global); 183 void visitGlobal(GlobalSummary global);
174 void visitPackage(PackageSummary package); 184 void visitPackage(PackageSummary package);
175 void visitLibrary(LibrarySummary lib); 185 void visitLibrary(LibrarySummary lib);
(...skipping 27 matching lines...) Expand all
203 } 213 }
204 } 214 }
205 215
206 void visitHtml(HtmlSummary html) { 216 void visitHtml(HtmlSummary html) {
207 for (var msg in html.messages) { 217 for (var msg in html.messages) {
208 msg.accept(this); 218 msg.accept(this);
209 } 219 }
210 } 220 }
211 void visitMessage(MessageSummary message) {} 221 void visitMessage(MessageSummary message) {}
212 } 222 }
OLDNEW
« no previous file with comments | « lib/runtime/messages_widget.js ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698