Class MostSpecificScope
java.lang.Object
org.ek9lang.compiler.support.MostSpecificScope
THE "whose code is running here?" - used when trying to locate the current class, dynamic class or dynamic function, to
be able to check if access to fields or methods should be allowed, or even resolve methods without 'this' prefix. The
nearest DYNAMIC block first (a dynamic class or function is what
this means inside it), then the nearest
non-block scope (a class, function, ...). Four places walked the enclosing construct by hand, two ways, and they differed
on what to do when there is none and on skipping a construct (front-end rationalisation B-13); they ask here:
get()- along the enclosing SCOPES of the current scope, falling back to the current scope itself;getIfAny()- the same without the fallback: empty when no construct encloses (whatthis/superneed - they say nothing at all outside one);beyond(IScope)- down the scope STACK, optionally only the scopes OUTSIDE a given construct (null: the whole stack): the scope whose code runs around a dynamic construct's capture list or outside it.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe scope whose code runs, from the scope STACK, considering only the scopes outsidebeyond(null: the whole stack): the nearest dynamic block, else the nearest non-block scope.get()getIfAny()The nearest dynamic block, else the nearest non-block scope, of the current scope's enclosing scopes - empty when the code is in neither.
-
Constructor Details
-
MostSpecificScope
-
-
Method Details
-
get
-
getIfAny
The nearest dynamic block, else the nearest non-block scope, of the current scope's enclosing scopes - empty when the code is in neither. -
beyond
-