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

Side by Side Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 1808123005: First batch of changes to make analyzer package strong mode error free (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.dart.element.element; 5 library analyzer.src.dart.element.element;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' show min; 8 import 'dart:math' show min;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 3167 matching lines...) Expand 10 before | Expand all | Expand 10 after
3178 * the given [name] and [offset]. 3178 * the given [name] and [offset].
3179 */ 3179 */
3180 LibraryElementImpl(this.context, String name, int offset, this.nameLength) 3180 LibraryElementImpl(this.context, String name, int offset, this.nameLength)
3181 : super(name, offset); 3181 : super(name, offset);
3182 3182
3183 /** 3183 /**
3184 * Initialize a newly created library element in the given [context] to have 3184 * Initialize a newly created library element in the given [context] to have
3185 * the given [name]. 3185 * the given [name].
3186 */ 3186 */
3187 LibraryElementImpl.forNode(this.context, LibraryIdentifier name) 3187 LibraryElementImpl.forNode(this.context, LibraryIdentifier name)
3188 : super.forNode(name), 3188 : nameLength = name != null ? name.length : 0,
3189 nameLength = name != null ? name.length : 0; 3189 super.forNode(name);
3190 3190
3191 @override 3191 @override
3192 int get codeLength { 3192 int get codeLength {
3193 if (_definingCompilationUnit is CompilationUnitElementImpl) { 3193 if (_definingCompilationUnit is CompilationUnitElementImpl) {
3194 return (_definingCompilationUnit as CompilationUnitElementImpl) 3194 return (_definingCompilationUnit as CompilationUnitElementImpl)
3195 .codeLength; 3195 .codeLength;
3196 } 3196 }
3197 return null; 3197 return null;
3198 } 3198 }
3199 3199
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
3584 // represents a new back edge. It would be sufficient to invalidate the 3584 // represents a new back edge. It would be sufficient to invalidate the
3585 // cycle information for all nodes that are between the target and the 3585 // cycle information for all nodes that are between the target and the
3586 // node in the topological order. For simplicity, we simply invalidate 3586 // node in the topological order. For simplicity, we simply invalidate
3587 // all nodes which are reachable from the the source node. 3587 // all nodes which are reachable from the the source node.
3588 // Note that in the invalidation phase, we do not cut off when we encounter 3588 // Note that in the invalidation phase, we do not cut off when we encounter
3589 // a node with no library cycle information, since we do not know whether 3589 // a node with no library cycle information, since we do not know whether
3590 // we are in the case where invalidation has already been performed, or we 3590 // we are in the case where invalidation has already been performed, or we
3591 // are in the case where library cycles have simply never been computed from 3591 // are in the case where library cycles have simply never been computed from
3592 // a newly reachable node. 3592 // a newly reachable node.
3593 Set<LibraryElementImpl> active = new HashSet(); 3593 Set<LibraryElementImpl> active = new HashSet();
3594 void invalidate(LibraryElementImpl library) { 3594 void invalidate(LibraryElement library) {
3595 if (!active.add(library)) return; 3595 LibraryElementImpl libraryImpl = library;
3596 if (library._libraryCycle != null) { 3596 if (active.add(libraryImpl)) {
3597 library._libraryCycle.forEach(invalidate); 3597 if (libraryImpl._libraryCycle != null) {
3598 library._libraryCycle = null; 3598 libraryImpl._libraryCycle.forEach(invalidate);
3599 libraryImpl._libraryCycle = null;
3600 }
3601 library.exportedLibraries.forEach(invalidate);
3602 library.importedLibraries.forEach(invalidate);
3599 } 3603 }
3600 library.exportedLibraries.forEach(invalidate);
3601 library.importedLibraries.forEach(invalidate);
3602 } 3604 }
3603 invalidate(this); 3605 invalidate(this);
3604 } 3606 }
3605 3607
3606 @override 3608 @override
3607 bool isUpToDate(int timeStamp) { 3609 bool isUpToDate(int timeStamp) {
3608 Set<LibraryElement> visitedLibraries = new Set(); 3610 Set<LibraryElement> visitedLibraries = new Set();
3609 return _safeIsUpToDate(this, timeStamp, visitedLibraries); 3611 return _safeIsUpToDate(this, timeStamp, visitedLibraries);
3610 } 3612 }
3611 3613
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
4922 4924
4923 @override 4925 @override
4924 void visitElement(Element element) { 4926 void visitElement(Element element) {
4925 int offset = element.nameOffset; 4927 int offset = element.nameOffset;
4926 if (offset != -1) { 4928 if (offset != -1) {
4927 map[offset] = element; 4929 map[offset] = element;
4928 } 4930 }
4929 super.visitElement(element); 4931 super.visitElement(element);
4930 } 4932 }
4931 } 4933 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698