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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 /** | 63 /** |
64 * Updates [oldUnit] to have the same directives and declarations, in the | 64 * Updates [oldUnit] to have the same directives and declarations, in the |
65 * same order as in [newUnit]. Existing resolution is kept where possible. | 65 * same order as in [newUnit]. Existing resolution is kept where possible. |
66 * | 66 * |
67 * Updates [unitElement] by adding/removing elements as needed. | 67 * Updates [unitElement] by adding/removing elements as needed. |
68 * | 68 * |
69 * Fills [unitDelta] with added/remove elements. | 69 * Fills [unitDelta] with added/remove elements. |
70 */ | 70 */ |
71 void build() { | 71 void build() { |
72 new CompilationUnitBuilder().buildCompilationUnit( | 72 new CompilationUnitBuilder() |
73 unitSource, newUnit, librarySource); | 73 .buildCompilationUnit(unitSource, newUnit, librarySource); |
74 _processDirectives(); | 74 _processDirectives(); |
75 _processUnitMembers(); | 75 _processUnitMembers(); |
76 newUnit.element = unitElement; | 76 newUnit.element = unitElement; |
77 _replaceUnitContents(oldUnit, newUnit); | 77 _replaceUnitContents(oldUnit, newUnit); |
78 } | 78 } |
79 | 79 |
80 void _addElementToHolder(Element element) { | 80 void _addElementToHolder(Element element) { |
81 if (element is PropertyAccessorElement) { | 81 if (element is PropertyAccessorElement) { |
82 holder.addAccessor(element); | 82 holder.addAccessor(element); |
83 } else if (element is ClassElement) { | 83 } else if (element is ClassElement) { |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 } | 357 } |
358 int oldOffset = element.nameOffset; | 358 int oldOffset = element.nameOffset; |
359 int newOffset = map[oldOffset]; | 359 int newOffset = map[oldOffset]; |
360 assert(newOffset != null); | 360 assert(newOffset != null); |
361 (element as ElementImpl).nameOffset = newOffset; | 361 (element as ElementImpl).nameOffset = newOffset; |
362 if (element is! LibraryElement) { | 362 if (element is! LibraryElement) { |
363 super.visitElement(element); | 363 super.visitElement(element); |
364 } | 364 } |
365 } | 365 } |
366 } | 366 } |
OLD | NEW |