GeneralizingElementVisitor2<R> class

An element visitor that will recursively visit all of the elements in an element model (like instances of the class RecursiveElementVisitor2). In addition, when an element of a specific type is visited not only will the visit method for that specific type of element be invoked, but additional methods for the supertypes of that element will also be invoked. For example, using an instance of this class to visit a MethodElement2 will cause the method visitMethodElement to be invoked but will also cause the methods visitExecutableElement and visitElement to be subsequently invoked. This allows visitors to be written that visit all executable elements without needing to override the visit method for each of the specific subclasses of ExecutableElement2.

Note, however, that unlike many visitors, element visitors visit objects based on the interfaces implemented by those elements. Because interfaces form a graph structure rather than a tree structure the way classes do, and because it is generally undesirable for an object to be visited more than once, this class flattens the interface graph into a pseudo-tree. In particular, this class treats elements as if the element types were structured in the following way:

[Element2]
  [ClassElement2]
  [ExecutableElement2]
      [ConstructorElement2]
      [GetterElement]
      [LocalFunctionElement]
      [MethodElement2]
      [SetterElement]
  [LabelElement2]
  [LibraryElement2]
  [MultiplyDefinedElement2]
  [PrefixElement2]
  [TypeAliasElement2]
  [TypeParameterElement2]
  [VariableElement2]
      [PropertyInducingElement2]
          [FieldElement2]
          [TopLevelVariableElement2]
      [PromotableElement2]
          [LocalVariableElement2]
          [FormalParameterElement]
              [FieldFormalParameterElement2]
              [SuperFormalParameterElement2]

Subclasses that override a visit method must either invoke the overridden visit method or explicitly invoke the more general visit method. Failure to do so will cause the visit methods for superclasses of the element to not be invoked and will cause the children of the visited node to not be visited.

Clients may extend this class.

Implemented types

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
visitClassElement(ClassElement2 element) → R?
override
visitConstructorElement(ConstructorElement2 element) → R?
override
visitElement(Element2 element) → R?
visitEnumElement(EnumElement2 element) → R?
override
visitExecutableElement(ExecutableElement2 element) → R?
visitExtensionElement(ExtensionElement2 element) → R?
override
visitExtensionTypeElement(ExtensionTypeElement2 element) → R?
override
visitFieldElement(FieldElement2 element) → R?
override
visitFieldFormalParameterElement(FieldFormalParameterElement2 element) → R?
override
visitFormalParameterElement(FormalParameterElement element) → R?
override
visitGenericFunctionTypeElement(GenericFunctionTypeElement2 element) → R?
override
visitGetterElement(GetterElement element) → R?
override
visitLabelElement(LabelElement2 element) → R?
override
visitLibraryElement(LibraryElement2 element) → R?
override
visitLocalFunctionElement(LocalFunctionElement element) → R?
override
visitLocalVariableElement(LocalVariableElement2 element) → R?
override
visitMethodElement(MethodElement2 element) → R?
override
visitMixinElement(MixinElement2 element) → R?
override
visitMultiplyDefinedElement(MultiplyDefinedElement2 element) → R?
override
visitPrefixElement(PrefixElement2 element) → R?
override
visitPropertyAccessorElement(PropertyAccessorElement2 element) → R?
visitPropertyInducingElement(PropertyInducingElement2 element) → R?
visitSetterElement(SetterElement element) → R?
override
visitSuperFormalParameterElement(SuperFormalParameterElement2 element) → R?
override
visitTopLevelFunctionElement(TopLevelFunctionElement element) → R?
override
visitTopLevelVariableElement(TopLevelVariableElement2 element) → R?
override
visitTypeAliasElement(TypeAliasElement2 element) → R?
override
visitTypeParameterElement(TypeParameterElement2 element) → R?
override
visitVariableElement(VariableElement2 element) → R?

Operators

operator ==(Object other) bool
The equality operator.
inherited