| 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 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1816 if (typeAliasImpl.identifier == identifier) { | 1816 if (typeAliasImpl.identifier == identifier) { |
| 1817 return typeAliasImpl; | 1817 return typeAliasImpl; |
| 1818 } | 1818 } |
| 1819 } | 1819 } |
| 1820 for (ClassElement type in types) { | 1820 for (ClassElement type in types) { |
| 1821 ClassElementImpl typeImpl = type; | 1821 ClassElementImpl typeImpl = type; |
| 1822 if (typeImpl.name == identifier) { | 1822 if (typeImpl.name == identifier) { |
| 1823 return typeImpl; | 1823 return typeImpl; |
| 1824 } | 1824 } |
| 1825 } | 1825 } |
| 1826 for (ClassElement type in _enums) { | 1826 for (ClassElement type in enums) { |
| 1827 EnumElementImpl typeImpl = type; | 1827 EnumElementImpl typeImpl = type; |
| 1828 if (typeImpl.identifier == identifier) { | 1828 if (typeImpl.identifier == identifier) { |
| 1829 return typeImpl; | 1829 return typeImpl; |
| 1830 } | 1830 } |
| 1831 } | 1831 } |
| 1832 return null; | 1832 return null; |
| 1833 } | 1833 } |
| 1834 | 1834 |
| 1835 @override | 1835 @override |
| 1836 ClassElement getEnum(String enumName) { | 1836 ClassElement getEnum(String enumName) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 * Initialize a newly created field element to have the given [name]. | 1912 * Initialize a newly created field element to have the given [name]. |
| 1913 */ | 1913 */ |
| 1914 ConstFieldElementImpl.forNode(Identifier name) : super.forNode(name); | 1914 ConstFieldElementImpl.forNode(Identifier name) : super.forNode(name); |
| 1915 | 1915 |
| 1916 /** | 1916 /** |
| 1917 * Initialize using the given serialized information. | 1917 * Initialize using the given serialized information. |
| 1918 */ | 1918 */ |
| 1919 ConstFieldElementImpl.forSerialized( | 1919 ConstFieldElementImpl.forSerialized( |
| 1920 UnlinkedVariable unlinkedVariable, ElementImpl enclosingElement) | 1920 UnlinkedVariable unlinkedVariable, ElementImpl enclosingElement) |
| 1921 : super.forSerialized(unlinkedVariable, enclosingElement); | 1921 : super.forSerialized(unlinkedVariable, enclosingElement); |
| 1922 |
| 1923 /** |
| 1924 * Initialize using the given kernel. |
| 1925 */ |
| 1926 ConstFieldElementImpl.forKernel( |
| 1927 ElementImpl enclosingElement, kernel.Field kernel) |
| 1928 : super.forKernel(enclosingElement, kernel); |
| 1922 } | 1929 } |
| 1923 | 1930 |
| 1924 /** | 1931 /** |
| 1925 * A field element representing an enum constant. | 1932 * A field element representing an enum constant. |
| 1926 */ | 1933 */ |
| 1927 class ConstFieldElementImpl_EnumValue extends ConstFieldElementImpl_ofEnum { | 1934 class ConstFieldElementImpl_EnumValue extends ConstFieldElementImpl_ofEnum { |
| 1928 final UnlinkedEnumValue _unlinkedEnumValue; | 1935 final UnlinkedEnumValue _unlinkedEnumValue; |
| 1929 final int _index; | 1936 final int _index; |
| 1930 | 1937 |
| 1931 ConstFieldElementImpl_EnumValue( | 1938 ConstFieldElementImpl_EnumValue( |
| (...skipping 2398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4330 */ | 4337 */ |
| 4331 class FieldElementImpl extends PropertyInducingElementImpl | 4338 class FieldElementImpl extends PropertyInducingElementImpl |
| 4332 implements FieldElement { | 4339 implements FieldElement { |
| 4333 /** | 4340 /** |
| 4334 * Initialize a newly created synthetic field element to have the given [name] | 4341 * Initialize a newly created synthetic field element to have the given [name] |
| 4335 * at the given [offset]. | 4342 * at the given [offset]. |
| 4336 */ | 4343 */ |
| 4337 FieldElementImpl(String name, int offset) : super(name, offset); | 4344 FieldElementImpl(String name, int offset) : super(name, offset); |
| 4338 | 4345 |
| 4339 /** | 4346 /** |
| 4340 * Initialize using the given serialized information. | 4347 * Initialize using the given kernel. |
| 4341 */ | 4348 */ |
| 4342 FieldElementImpl.forKernel(ElementImpl enclosingElement, kernel.Field kernel) | 4349 FieldElementImpl.forKernel(ElementImpl enclosingElement, kernel.Field kernel) |
| 4343 : super.forKernel(enclosingElement, kernel); | 4350 : super.forKernel(enclosingElement, kernel); |
| 4344 | 4351 |
| 4345 /** | 4352 /** |
| 4346 * Initialize using the given serialized information. | 4353 * Initialize using the given kernel. |
| 4347 */ | 4354 */ |
| 4348 factory FieldElementImpl.forKernelFactory( | 4355 factory FieldElementImpl.forKernelFactory( |
| 4349 ClassElementImpl enclosingClass, kernel.Field kernel) { | 4356 ClassElementImpl enclosingClass, kernel.Field kernel) { |
| 4350 // TODO(scheglov) add support for constants. | 4357 if (kernel.isConst) { |
| 4351 return new FieldElementImpl.forKernel(enclosingClass, kernel); | 4358 return new ConstFieldElementImpl.forKernel(enclosingClass, kernel); |
| 4359 } else { |
| 4360 return new FieldElementImpl.forKernel(enclosingClass, kernel); |
| 4361 } |
| 4352 } | 4362 } |
| 4353 | 4363 |
| 4354 /** | 4364 /** |
| 4355 * Initialize a newly created field element to have the given [name]. | 4365 * Initialize a newly created field element to have the given [name]. |
| 4356 */ | 4366 */ |
| 4357 FieldElementImpl.forNode(Identifier name) : super.forNode(name); | 4367 FieldElementImpl.forNode(Identifier name) : super.forNode(name); |
| 4358 | 4368 |
| 4359 /** | 4369 /** |
| 4360 * Initialize using the given serialized information. | 4370 * Initialize using the given serialized information. |
| 4361 */ | 4371 */ |
| (...skipping 5045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9407 | 9417 |
| 9408 @override | 9418 @override |
| 9409 DartObject computeConstantValue() => null; | 9419 DartObject computeConstantValue() => null; |
| 9410 | 9420 |
| 9411 @override | 9421 @override |
| 9412 void visitChildren(ElementVisitor visitor) { | 9422 void visitChildren(ElementVisitor visitor) { |
| 9413 super.visitChildren(visitor); | 9423 super.visitChildren(visitor); |
| 9414 _initializer?.accept(visitor); | 9424 _initializer?.accept(visitor); |
| 9415 } | 9425 } |
| 9416 } | 9426 } |
| OLD | NEW |