GeneralizingElementVisitor<R> class

An element visitor that will recursively visit all of the elements in an element model (like instances of the class RecursiveElementVisitor). 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 MethodElement 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 ExecutableElement.

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:

Element
  ClassElement
  CompilationUnitElement
  ExecutableElement
      ConstructorElement
      LocalElement
          FunctionElement
      MethodElement
      PropertyAccessorElement
  ExportElement
  HtmlElement
  ImportElement
  LabelElement
  LibraryElement
  MultiplyDefinedElement
  PrefixElement
  TypeAliasElement
  TypeParameterElement
  UndefinedElement
  VariableElement
      PropertyInducingElement
          FieldElement
          TopLevelVariableElement
      LocalElement
          LocalVariableElement
          ParameterElement
              FieldFormalParameterElement

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

Constructors

GeneralizingElementVisitor()
Initialize a newly created visitor.
const

Properties

hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited
visitClassElement(ClassElement element) → R
override
visitCompilationUnitElement(CompilationUnitElement element) → R
override
visitConstructorElement(ConstructorElement element) → R
override
visitElement(Element element) → R
visitExecutableElement(ExecutableElement element) → R
visitExportElement(ExportElement element) → R
override
visitExtensionElement(ExtensionElement element) → R
override
visitFieldElement(FieldElement element) → R
override
visitFieldFormalParameterElement(FieldFormalParameterElement element) → R
override
visitFunctionElement(FunctionElement element) → R
override
visitFunctionTypeAliasElement(FunctionTypeAliasElement element) → R
override
visitGenericFunctionTypeElement(GenericFunctionTypeElement element) → R
override
visitImportElement(ImportElement element) → R
override
visitLabelElement(LabelElement element) → R
override
visitLibraryElement(LibraryElement element) → R
override
visitLocalElement(LocalElement element) → R
visitLocalVariableElement(LocalVariableElement element) → R
override
visitMethodElement(MethodElement element) → R
override
visitMultiplyDefinedElement(MultiplyDefinedElement element) → R
override
visitParameterElement(ParameterElement element) → R
override
visitPrefixElement(PrefixElement element) → R
override
visitPropertyAccessorElement(PropertyAccessorElement element) → R
override
visitPropertyInducingElement(PropertyInducingElement element) → R
visitTopLevelVariableElement(TopLevelVariableElement element) → R
override
visitTypeParameterElement(TypeParameterElement element) → R
override
visitVariableElement(VariableElement element) → R

Operators

operator ==(Object other) → bool
The equality operator. [...]
inherited