| OLD | NEW |
| 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 library analyzer.src.task.incremental_element_builder; | 5 library analyzer.src.task.incremental_element_builder; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 266 } |
| 267 | 267 |
| 268 /** | 268 /** |
| 269 * Updates name offsets of [Element]s according to the [map]. | 269 * Updates name offsets of [Element]s according to the [map]. |
| 270 */ | 270 */ |
| 271 class _UpdateElementOffsetsVisitor extends GeneralizingElementVisitor { | 271 class _UpdateElementOffsetsVisitor extends GeneralizingElementVisitor { |
| 272 final Map<int, int> map; | 272 final Map<int, int> map; |
| 273 | 273 |
| 274 _UpdateElementOffsetsVisitor(this.map); | 274 _UpdateElementOffsetsVisitor(this.map); |
| 275 | 275 |
| 276 visitElement(Element element) { | 276 void visitElement(Element element) { |
| 277 if (element is CompilationUnitElement) { |
| 278 return; |
| 279 } |
| 280 if (element.isSynthetic) { |
| 281 return; |
| 282 } |
| 277 int oldOffset = element.nameOffset; | 283 int oldOffset = element.nameOffset; |
| 278 if (oldOffset != -1) { | 284 int newOffset = map[oldOffset]; |
| 279 int newOffset = map[oldOffset]; | 285 assert(newOffset != null); |
| 280 assert(newOffset != null); | 286 (element as ElementImpl).nameOffset = newOffset; |
| 281 (element as ElementImpl).nameOffset = newOffset; | |
| 282 } | |
| 283 if (element is! LibraryElement) { | 287 if (element is! LibraryElement) { |
| 284 super.visitElement(element); | 288 super.visitElement(element); |
| 285 } | 289 } |
| 286 } | 290 } |
| 287 } | 291 } |
| OLD | NEW |