| OLD | NEW |
| 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.generated.incremental_resolver; | 5 library analyzer.src.generated.incremental_resolver; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:math' as math; | 8 import 'dart:math' as math; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 void set test_resolveApiChanges(bool value) { | 41 void set test_resolveApiChanges(bool value) { |
| 42 _resolveApiChanges = value; | 42 _resolveApiChanges = value; |
| 43 } | 43 } |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * Instances of the class [DeclarationMatcher] determine whether the element | 46 * Instances of the class [DeclarationMatcher] determine whether the element |
| 47 * model defined by a given AST structure matches an existing element model. | 47 * model defined by a given AST structure matches an existing element model. |
| 48 */ | 48 */ |
| 49 class DeclarationMatcher extends RecursiveAstVisitor { | 49 class DeclarationMatcher extends RecursiveAstVisitor { |
| 50 /** | 50 /** |
| 51 * The libary containing the AST nodes being visited. | 51 * The library containing the AST nodes being visited. |
| 52 */ | 52 */ |
| 53 LibraryElement _enclosingLibrary; | 53 LibraryElement _enclosingLibrary; |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * The compilation unit containing the AST nodes being visited. | 56 * The compilation unit containing the AST nodes being visited. |
| 57 */ | 57 */ |
| 58 CompilationUnitElement _enclosingUnit; | 58 CompilationUnitElement _enclosingUnit; |
| 59 | 59 |
| 60 /** | 60 /** |
| 61 * The function type alias containing the AST nodes being visited, or `null` i
f we are not | 61 * The function type alias containing the AST nodes being visited, or `null` i
f we are not |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 _hasConstructor = false; | 158 _hasConstructor = false; |
| 159 super.visitClassDeclaration(node); | 159 super.visitClassDeclaration(node); |
| 160 // process default constructor | 160 // process default constructor |
| 161 if (!_hasConstructor) { | 161 if (!_hasConstructor) { |
| 162 ConstructorElement constructor = element.unnamedConstructor; | 162 ConstructorElement constructor = element.unnamedConstructor; |
| 163 _processElement(constructor); | 163 _processElement(constructor); |
| 164 if (!constructor.isSynthetic) { | 164 if (!constructor.isSynthetic) { |
| 165 _assertEquals(constructor.parameters.length, 0); | 165 _assertEquals(constructor.parameters.length, 0); |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 // matches, set the element |
| 169 node.name.staticElement = element; |
| 168 } | 170 } |
| 169 | 171 |
| 170 @override | 172 @override |
| 171 visitClassTypeAlias(ClassTypeAlias node) { | 173 visitClassTypeAlias(ClassTypeAlias node) { |
| 172 String name = node.name.name; | 174 String name = node.name.name; |
| 173 ClassElement element = _findElement(_enclosingUnit.types, name); | 175 ClassElement element = _findElement(_enclosingUnit.types, name); |
| 174 _enclosingClass = element; | 176 _enclosingClass = element; |
| 175 _processElement(element); | 177 _processElement(element); |
| 176 _assertSameTypeParameters(node.typeParameters, element.typeParameters); | 178 _assertSameTypeParameters(node.typeParameters, element.typeParameters); |
| 177 super.visitClassTypeAlias(node); | 179 super.visitClassTypeAlias(node); |
| (...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 @override | 2096 @override |
| 2095 String toString() => name; | 2097 String toString() => name; |
| 2096 } | 2098 } |
| 2097 | 2099 |
| 2098 class _TokenPair { | 2100 class _TokenPair { |
| 2099 final _TokenDifferenceKind kind; | 2101 final _TokenDifferenceKind kind; |
| 2100 final Token oldToken; | 2102 final Token oldToken; |
| 2101 final Token newToken; | 2103 final Token newToken; |
| 2102 _TokenPair(this.kind, this.oldToken, this.newToken); | 2104 _TokenPair(this.kind, this.oldToken, this.newToken); |
| 2103 } | 2105 } |
| OLD | NEW |