Scala Library
|
|
scala/util/parsing/ast/Binders.scala
]
class
Scope[binderType <: NameElement]
extends
Iterable[binderType]Value Summary | |
val
|
id
: Int
Returns a unique number identifying this Scope (only used for representation purposes).
|
Method Summary | |
def
|
addBinder
(b : binderType) : Unit
Adds a new binder.
(e.g. the variable name in a local variable declaration)
|
def
|
allowForwardRef
: Scope[binderType]
Return a new inheriting scope that won't check whether binding is respected until the scope is left (so as to support forward references)
|
def
|
apply
(i : Int) : binderType
Return the `i'th binder in this scope.
|
def
|
bindersToString
: List[java.lang.String]
Returns a list of strings that represent the binder elements, each tagged with this scope's id.
|
def
|
binds
(b : binderType) : Boolean
Returns true if this container has a binder equal (==) to `b'
|
def
|
canAddBinder
(b : binderType) : Boolean
`canAddElement' indicates whether `b' may be added to this scope.
TODO: strengthen this condition so that no binders may be added after this scope has been
linked to its `UnderBinder' (i.e., while parsing, BoundElements may be added to the Scope
associated to the UnderBinder, but after that, no changes are allowed, except for substitution)?
|
def
|
elements
: Iterator[binderType]
Returns the binders in this scope.
For a typical let-binding, this is just the variable name. For an argument list to a method body,
there is one binder per formal argument.
|
def
|
getElementFor
(b : binderType) : Element
Returns the current value for the bound occurrences of `b'.
|
def
|
indexFor (b : binderType) : Option[Int] |
def
|
nested
: Scope[binderType]
Return a nested scope -- binders entered into it won't be visible in this scope, but if this scope allows forward references,
the binding in the returned scope also does, and thus the check that all variables are bound is deferred until this scope is left
|
def
|
onEnter : Unit |
def
|
onLeft : Unit |
def
|
substitute
(b : binderType, value : Element) : Unit
``Replaces'' the bound occurrences of a contained binder by their new value.
The bound occurrences of `b' are not actually replaced; the scope keeps track
of a substitution that maps every binder to its current value. Since a `BoundElement' is
a proxy for the element it is bound to by its binder, `substitute' may thus be thought of
as replacing all the bound occurrences of the given binder `b' by their new value `value'.
|
override def
|
toString
: java.lang.String
Returns a string representation of the object.
|
Methods inherited from Iterable | |
concat, ++, map, flatMap, filter, partition, takeWhile, dropWhile, take, drop, foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, toSeq, toStream, mkString, mkString, mkString, addString, addString, addString, copyToArray, isEmpty, projection, hasDefiniteSize |
Methods inherited from AnyRef | |
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Value Details |
val
id : Int
Method Details |
def
elements : Iterator[binderType]
def
apply(i : Int) : binderType
def
binds(b : binderType) : Boolean
def
indexFor(b : binderType) : Option[Int]
def
addBinder(b : binderType) : Unit
b -
a new binder that is distinct from the existing binders in this scope, and shares their conceptual scope
def
canAddBinder(b : binderType) : Boolean
def
substitute(b : binderType, value : Element) : Unit
b -
the binder whose bound occurrences should be given a new valuevalue -
the new value for the bound occurrences of `b'
def
getElementFor(b : binderType) : Element
b -
the contained binder whose current value should be returnedoverride
def
toString : java.lang.String
The default representation is platform dependent.
def
bindersToString : List[java.lang.String]
def
allowForwardRef : Scope[binderType]
def
nested : Scope[binderType]
def
onEnter : Unit
def
onLeft : Unit
Scala Library
|
|