| 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 ??= '---'; | |
| 132 annotations[data.sourceSpan.begin] = '${expected} | ${data.value}'; | 131 annotations[data.sourceSpan.begin] = '${expected} | ${data.value}'; |
| 133 } | 132 } |
| 134 }); | 133 }); |
| 135 expectedMap.forEach((Id id, String expected) { | 134 expectedMap.forEach((Id id, String expected) { |
| 136 if (!actualMap.containsKey(id)) { | 135 if (!actualMap.containsKey(id)) { |
| 137 int offset = compiler.reporter | 136 int offset = compiler.reporter |
| 138 .spanFromSpannable( | 137 .spanFromSpannable( |
| 139 computeSpannable(elementEnvironment, mainUri, id)) | 138 computeSpannable(elementEnvironment, mainUri, id)) |
| 140 .begin; | 139 .begin; |
| 141 annotations[offset] = '${expected} | ---'; | 140 annotations[offset] = '${expected} | ---'; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 id = new NodeId(annotation.offset); | 275 id = new NodeId(annotation.offset); |
| 277 expected = text; | 276 expected = text; |
| 278 } else { | 277 } else { |
| 279 id = new ElementId(text.substring(0, colonPos)); | 278 id = new ElementId(text.substring(0, colonPos)); |
| 280 expected = text.substring(colonPos + 1); | 279 expected = text.substring(colonPos + 1); |
| 281 } | 280 } |
| 282 map[id] = expected; | 281 map[id] = expected; |
| 283 } | 282 } |
| 284 return map; | 283 return map; |
| 285 } | 284 } |
| OLD | NEW |