OLD | NEW |
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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 import 'dart:async'; | 4 import 'dart:async'; |
5 import 'dart:convert'; | 5 import 'dart:convert'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 | 7 |
8 import 'package:front_end/src/base/instrumentation.dart'; | 8 import 'package:front_end/src/base/instrumentation.dart'; |
9 import 'package:front_end/src/fasta/messages.dart'; | 9 import 'package:front_end/src/fasta/messages.dart'; |
10 import 'package:front_end/src/fasta/scanner.dart'; | 10 import 'package:front_end/src/fasta/scanner.dart'; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 String _escape(String s) { | 193 String _escape(String s) { |
194 s = s.replaceAll(r'\', r'\\'); | 194 s = s.replaceAll(r'\', r'\\'); |
195 if (s.endsWith('/')) { | 195 if (s.endsWith('/')) { |
196 s = '$s '; | 196 s = '$s '; |
197 } | 197 } |
198 return s.replaceAll('/*', r'/\*').replaceAll('*/', r'*\/'); | 198 return s.replaceAll('/*', r'/\*').replaceAll('*/', r'*\/'); |
199 } | 199 } |
200 | 200 |
201 String _formatProblem( | 201 String _formatProblem( |
202 Uri uri, int offset, String desc, StackTrace stackTrace) { | 202 Uri uri, int offset, String desc, StackTrace stackTrace) { |
203 return format( | 203 return deprecated_format( |
204 uri, offset, '$desc${stackTrace == null ? '' : '\n$stackTrace'}'); | 204 uri, offset, '$desc${stackTrace == null ? '' : '\n$stackTrace'}'); |
205 } | 205 } |
206 | 206 |
207 String _makeExpectationComment(String property, InstrumentationValue value) { | 207 String _makeExpectationComment(String property, InstrumentationValue value) { |
208 return '/*@$property=${_escape(value.toString())}*/'; | 208 return '/*@$property=${_escape(value.toString())}*/'; |
209 } | 209 } |
210 | 210 |
211 void _problem(Uri uri, int offset, String desc, _Fix fix) { | 211 void _problem(Uri uri, int offset, String desc, _Fix fix) { |
212 _problems.add(_formatProblem(uri, offset, desc, null)); | 212 _problems.add(_formatProblem(uri, offset, desc, null)); |
213 _fixes.putIfAbsent(uri, () => []).add(fix); | 213 _fixes.putIfAbsent(uri, () => []).add(fix); |
(...skipping 27 matching lines...) Expand all Loading... |
241 this.property, this.value, this.commentOffset, this.commentLength); | 241 this.property, this.value, this.commentOffset, this.commentLength); |
242 } | 242 } |
243 | 243 |
244 class _Fix { | 244 class _Fix { |
245 final int offset; | 245 final int offset; |
246 final int length; | 246 final int length; |
247 final String replacement; | 247 final String replacement; |
248 | 248 |
249 _Fix(this.offset, this.length, this.replacement); | 249 _Fix(this.offset, this.length, this.replacement); |
250 } | 250 } |
OLD | NEW |