Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Side by Side Diff: pkg/analyzer/lib/src/task/incremental_element_builder.dart

Issue 1125123006: Add a "librarySource" field to CompilationUnitElementImpl. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/lib/src/task/task_dart.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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';
11 import 'package:analyzer/src/generated/resolver.dart'; 11 import 'package:analyzer/src/generated/resolver.dart';
12 import 'package:analyzer/src/generated/scanner.dart'; 12 import 'package:analyzer/src/generated/scanner.dart';
13 import 'package:analyzer/src/generated/source.dart'; 13 import 'package:analyzer/src/generated/source.dart';
14 14
15 /** 15 /**
16 * Incrementally updates the existing [unitElement] and builds elements for 16 * Incrementally updates the existing [unitElement] and builds elements for
17 * the [newUnit]. 17 * the [newUnit].
18 */ 18 */
19 class IncrementalCompilationUnitElementBuilder { 19 class IncrementalCompilationUnitElementBuilder {
20 final Source source; 20 final Source source;
21 final Source librarySource;
21 final CompilationUnit oldUnit; 22 final CompilationUnit oldUnit;
22 final CompilationUnitElementImpl unitElement; 23 final CompilationUnitElementImpl unitElement;
23 final CompilationUnit newUnit; 24 final CompilationUnit newUnit;
24 final ElementHolder holder = new ElementHolder(); 25 final ElementHolder holder = new ElementHolder();
25 26
26 IncrementalCompilationUnitElementBuilder( 27 IncrementalCompilationUnitElementBuilder(
27 CompilationUnit oldUnit, this.newUnit) 28 CompilationUnit oldUnit, this.newUnit)
28 : oldUnit = oldUnit, 29 : oldUnit = oldUnit,
29 unitElement = oldUnit.element, 30 unitElement = oldUnit.element,
30 source = oldUnit.element.source; 31 source = oldUnit.element.source,
32 librarySource = (oldUnit.element as CompilationUnitElementImpl).libraryS ource;
31 33
32 void build() { 34 void build() {
33 new CompilationUnitBuilder().buildCompilationUnit(source, newUnit); 35 new CompilationUnitBuilder().buildCompilationUnit(
36 source, newUnit, librarySource);
34 _processDirectives(); 37 _processDirectives();
35 _processUnitMembers(); 38 _processUnitMembers();
36 newUnit.element = unitElement; 39 newUnit.element = unitElement;
37 } 40 }
38 41
39 void _addElementsToHolder(CompilationUnitMember node) { 42 void _addElementsToHolder(CompilationUnitMember node) {
40 List<Element> elements = _getElements(node); 43 List<Element> elements = _getElements(node);
41 elements.forEach(_addElementToHolder); 44 elements.forEach(_addElementToHolder);
42 } 45 }
43 46
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 286 }
284 int oldOffset = element.nameOffset; 287 int oldOffset = element.nameOffset;
285 int newOffset = map[oldOffset]; 288 int newOffset = map[oldOffset];
286 assert(newOffset != null); 289 assert(newOffset != null);
287 (element as ElementImpl).nameOffset = newOffset; 290 (element as ElementImpl).nameOffset = newOffset;
288 if (element is! LibraryElement) { 291 if (element is! LibraryElement) {
289 super.visitElement(element); 292 super.visitElement(element);
290 } 293 }
291 } 294 }
292 } 295 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/lib/src/task/task_dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698