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.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 3125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3136 ResynthesizerContext context = unit.resynthesizerContext; | 3136 ResynthesizerContext context = unit.resynthesizerContext; |
3137 for (int i = 0; i < length; i++) { | 3137 for (int i = 0; i < length; i++) { |
3138 annotations[i] = context.buildAnnotation(this, unlinkedConsts[i]); | 3138 annotations[i] = context.buildAnnotation(this, unlinkedConsts[i]); |
3139 } | 3139 } |
3140 return annotations; | 3140 return annotations; |
3141 } else { | 3141 } else { |
3142 return const <ElementAnnotation>[]; | 3142 return const <ElementAnnotation>[]; |
3143 } | 3143 } |
3144 } | 3144 } |
3145 | 3145 |
3146 static int _findElementIndexUsingIdentical(List items, Object item) { | 3146 static int findElementIndexUsingIdentical(List items, Object item) { |
3147 int length = items.length; | 3147 int length = items.length; |
3148 for (int i = 0; i < length; i++) { | 3148 for (int i = 0; i < length; i++) { |
3149 if (identical(items[i], item)) { | 3149 if (identical(items[i], item)) { |
3150 return i; | 3150 return i; |
3151 } | 3151 } |
3152 } | 3152 } |
3153 throw new StateError('Unable to find $item in $items'); | 3153 throw new StateError('Unable to find $item in $items'); |
3154 } | 3154 } |
3155 } | 3155 } |
3156 | 3156 |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4380 @override | 4380 @override |
4381 TypeParameterizedElementMixin get enclosingTypeParameterContext { | 4381 TypeParameterizedElementMixin get enclosingTypeParameterContext { |
4382 return (enclosingElement as ElementImpl).typeParameterContext; | 4382 return (enclosingElement as ElementImpl).typeParameterContext; |
4383 } | 4383 } |
4384 | 4384 |
4385 @override | 4385 @override |
4386 String get identifier { | 4386 String get identifier { |
4387 String identifier = super.identifier; | 4387 String identifier = super.identifier; |
4388 Element enclosing = this.enclosingElement; | 4388 Element enclosing = this.enclosingElement; |
4389 if (enclosing is ExecutableElement) { | 4389 if (enclosing is ExecutableElement) { |
4390 int id = ElementImpl._findElementIndexUsingIdentical( | 4390 int id = |
4391 enclosing.functions, this); | 4391 ElementImpl.findElementIndexUsingIdentical(enclosing.functions, this); |
4392 identifier += "@$id"; | 4392 identifier += "@$id"; |
4393 } | 4393 } |
4394 return identifier; | 4394 return identifier; |
4395 } | 4395 } |
4396 | 4396 |
4397 @override | 4397 @override |
4398 bool get isEntryPoint { | 4398 bool get isEntryPoint { |
4399 return isStatic && displayName == FunctionElement.MAIN_FUNCTION_NAME; | 4399 return isStatic && displayName == FunctionElement.MAIN_FUNCTION_NAME; |
4400 } | 4400 } |
4401 | 4401 |
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6039 return new LocalVariableElementImpl.forSerialized( | 6039 return new LocalVariableElementImpl.forSerialized( |
6040 unlinkedVariable, enclosingExecutable); | 6040 unlinkedVariable, enclosingExecutable); |
6041 } | 6041 } |
6042 } | 6042 } |
6043 | 6043 |
6044 @override | 6044 @override |
6045 String get identifier { | 6045 String get identifier { |
6046 String identifier = super.identifier; | 6046 String identifier = super.identifier; |
6047 Element enclosing = this.enclosingElement; | 6047 Element enclosing = this.enclosingElement; |
6048 if (enclosing is ExecutableElement) { | 6048 if (enclosing is ExecutableElement) { |
6049 int id = ElementImpl._findElementIndexUsingIdentical( | 6049 int id = ElementImpl.findElementIndexUsingIdentical( |
6050 enclosing.localVariables, this); | 6050 enclosing.localVariables, this); |
6051 identifier += "@$id"; | 6051 identifier += "@$id"; |
6052 } | 6052 } |
6053 return identifier; | 6053 return identifier; |
6054 } | 6054 } |
6055 | 6055 |
6056 @override | 6056 @override |
6057 bool get isPotentiallyMutatedInClosure => true; | 6057 bool get isPotentiallyMutatedInClosure => true; |
6058 | 6058 |
6059 @override | 6059 @override |
(...skipping 2427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8487 | 8487 |
8488 @override | 8488 @override |
8489 void visitElement(Element element) { | 8489 void visitElement(Element element) { |
8490 int offset = element.nameOffset; | 8490 int offset = element.nameOffset; |
8491 if (offset != -1) { | 8491 if (offset != -1) { |
8492 map[offset] = element; | 8492 map[offset] = element; |
8493 } | 8493 } |
8494 super.visitElement(element); | 8494 super.visitElement(element); |
8495 } | 8495 } |
8496 } | 8496 } |
OLD | NEW |