| 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 import 'package:compiler/src/common.dart'; | 8 import 'package:compiler/src/common.dart'; |
| 9 import 'package:compiler/src/common_elements.dart'; | 9 import 'package:compiler/src/common_elements.dart'; |
| 10 import 'package:compiler/src/compiler.dart'; | 10 import 'package:compiler/src/compiler.dart'; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 Map<int, String> annotations = <int, String>{}; | 119 Map<int, String> annotations = <int, String>{}; |
| 120 actualMap.forEach((Id id, ActualData data) { | 120 actualMap.forEach((Id id, ActualData data) { |
| 121 annotations[data.sourceSpan.begin] = data.value; | 121 annotations[data.sourceSpan.begin] = data.value; |
| 122 }); | 122 }); |
| 123 return withAnnotations(annotations); | 123 return withAnnotations(annotations); |
| 124 } | 124 } |
| 125 | 125 |
| 126 String get diffCode { | 126 String get diffCode { |
| 127 Map<int, String> annotations = <int, String>{}; | 127 Map<int, String> annotations = <int, String>{}; |
| 128 actualMap.forEach((Id id, ActualData data) { | 128 actualMap.forEach((Id id, ActualData data) { |
| 129 String expected = expectedMap[id] ?? ''; | 129 String expected = expectedMap[id]; |
| 130 if (data.value != expected) { | 130 if (data.value != expected) { |
| 131 expected ??= '---'; |
| 131 annotations[data.sourceSpan.begin] = '${expected} | ${data.value}'; | 132 annotations[data.sourceSpan.begin] = '${expected} | ${data.value}'; |
| 132 } | 133 } |
| 133 }); | 134 }); |
| 134 expectedMap.forEach((Id id, String expected) { | 135 expectedMap.forEach((Id id, String expected) { |
| 135 if (!actualMap.containsKey(id)) { | 136 if (!actualMap.containsKey(id)) { |
| 136 int offset = compiler.reporter | 137 int offset = compiler.reporter |
| 137 .spanFromSpannable( | 138 .spanFromSpannable( |
| 138 computeSpannable(elementEnvironment, mainUri, id)) | 139 computeSpannable(elementEnvironment, mainUri, id)) |
| 139 .begin; | 140 .begin; |
| 140 annotations[offset] = '${expected} | ---'; | 141 annotations[offset] = '${expected} | ---'; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 id = new NodeId(annotation.offset); | 276 id = new NodeId(annotation.offset); |
| 276 expected = text; | 277 expected = text; |
| 277 } else { | 278 } else { |
| 278 id = new ElementId(text.substring(0, colonPos)); | 279 id = new ElementId(text.substring(0, colonPos)); |
| 279 expected = text.substring(colonPos + 1); | 280 expected = text.substring(colonPos + 1); |
| 280 } | 281 } |
| 281 map[id] = expected; | 282 map[id] = expected; |
| 282 } | 283 } |
| 283 return map; | 284 return map; |
| 284 } | 285 } |
| OLD | NEW |