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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 149 } |
150 } | 150 } |
151 } | 151 } |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 @override | 155 @override |
156 void record( | 156 void record( |
157 Uri uri, int offset, String property, InstrumentationValue value) { | 157 Uri uri, int offset, String property, InstrumentationValue value) { |
158 uri = Uri.base.resolveUri(uri); | 158 uri = Uri.base.resolveUri(uri); |
| 159 if (offset == -1) { |
| 160 throw _formatProblem(uri, 0, 'No offset for $property=$value', null); |
| 161 } |
159 var expectationsForUri = _unsatisfiedExpectations[uri]; | 162 var expectationsForUri = _unsatisfiedExpectations[uri]; |
160 if (expectationsForUri == null) return; | 163 if (expectationsForUri == null) return; |
161 var expectationsAtOffset = expectationsForUri[offset]; | 164 var expectationsAtOffset = expectationsForUri[offset]; |
162 if (expectationsAtOffset != null) { | 165 if (expectationsAtOffset != null) { |
163 for (int i = 0; i < expectationsAtOffset.length; i++) { | 166 for (int i = 0; i < expectationsAtOffset.length; i++) { |
164 var expectation = expectationsAtOffset[i]; | 167 var expectation = expectationsAtOffset[i]; |
165 if (expectation.property == property) { | 168 if (expectation.property == property) { |
166 if (!value.matches(expectation.value)) { | 169 if (!value.matches(expectation.value)) { |
167 _problemWithStack( | 170 _problemWithStack( |
168 uri, | 171 uri, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 this.property, this.value, this.commentOffset, this.commentLength); | 241 this.property, this.value, this.commentOffset, this.commentLength); |
239 } | 242 } |
240 | 243 |
241 class _Fix { | 244 class _Fix { |
242 final int offset; | 245 final int offset; |
243 final int length; | 246 final int length; |
244 final String replacement; | 247 final String replacement; |
245 | 248 |
246 _Fix(this.offset, this.length, this.replacement); | 249 _Fix(this.offset, this.length, this.replacement); |
247 } | 250 } |
OLD | NEW |