Interface LexicalScope


  • public interface LexicalScope
    Represents that a lexical scope in the language Note that scopes are changing after variable declaration. For example: void draw() { //scope1 int a; //scope2 int b; //scope3 } See https://en.wikipedia.org/wiki/Scope_(computer_science)#Lexical_scoping
    • Method Detail

      • getScopeElement

        CtElement getScopeElement()
        Returns:
        the CtElement which represents the current scope
      • forEachElementByName

        <T> T forEachElementByName​(String name,
                                   Function<? super CtNamedElement,​T> fnc)
        Parameters:
        name - to be searched simple name
        fnc - is called for each named element with same simple name, which is defined in this or parent LexicalScope. Function `fnc` is called as long as there are some matching elements and `fnc` returns null. If `fnc` returns not null value then searching is stopped and that value is a returned
        Returns:
        the value returned by `fnc` or null