Next: SOFTWARE-EVOLUTION-LIBRARY/SOFTWARE/LLVM, Previous: SOFTWARE-EVOLUTION-LIBRARY/SOFTWARE/IR, Up: Software Evolution Library Index [Contents][Index]
Class precedence list: lisp, parseable, software, oid-object, file, standard-object, slot-object, t
Common Lisp source represented naturally as lists of code.
Class precedence list: lisp-ast, functional-tree-ast, node, identity-ordering-mixin, ast, stored-hash, standard-object, slot-object, t
Slots:
children
— initargs: functional-trees:children
, :children
The list of children of the node, which may be more nodes, or other values.
Class of Common Lisp ASTs.
A special variable that modifies the functionality of get-functions-from-binding-form. If set to a non-nil value, macros will be returned as if they were functions.
A special variable that modifies the functionality of get-vars-from-binding-form. If set to a non-nil value, symbol macros will be returned as if they were variables.
A special variable that modifies the functionality of bindings. If set to a non-nil value,top level variable definitions will be included.
A special variable that modifies the functionality of functions that get bindings such that the returned information is marked as a macro.
Return bindings that are local to obj
and
in scope of AST. This method calls get-vars-from-binding-form
and get-functions-from-binding-form. All of the special variables
that modify the behavior of these methods can be utilized by
this method.
Creates a fun-body method that specializes the
parameter car-of-form on car-of-form-alias
. The method immediately calls
the specialization for car-of-form
.
Creates a get-function-from-binding-form method that specializes the
parameter car-of-form on binding-form-alias
. The method immediately calls
the specialization for binding-form
.
Defines a specialization of get-vars-from-binding-form that specializes
on binding-form-name
. The keyword arguments allow for explicit naming of the
parameters of the method.
A convenience local function, handle-as, is defined for the method body which allows for easy transferring to another specialization to handle the form. For exmaple, if a ’let* form has a reference ast that is inside it but after its definitions,it can transfer control to ’let by calling handle-as: (handle-as ’let). handle-as has a :reference-ast keyword which serves the same purpose as in get-vars-from-binding-form. It also has a :macro-p keyword which adds a cons to the returned list that shows that the symbol is a macro.
A convenience local function, collect-var-info, is defined for the method body which collects info on a form in a format that can be returned.
Creates a lambda-list method that specializes the
parameter car-of-form on car-of-form-alias
. The method immediately calls
the specialization for car-of-form
.
Creates a get-vars-from-binding-form method that specializes the
parameter car-of-form on binding-form-alias
. The method immediately calls
the specialization for binding-form
.
Return the binding for symbol
if it is in bindings
.
Return the binding for symbol
if it is in bindings
.
Return t
if AST is the car of its enclosing form in obj
.
Returns a list of the children of AST that are of type type
.
Collect the symbols in AST into a hash table. The hash table maps symbol asts to their possible usage. This can be in the form of any of the following:
(:special-form) (:function-declaration) (:macro) (:macro binding-information) (:function) (:function binding-information) (:variable-declaration) (:symbol-macro) (:symbol-macro binding-information) (:variable) (:variable binding-information) (:literal) (:keyword) (:symbol)
binding-information will be in the same form as returned by #’bindings and will contain all information gathered for that specific symbol.
If the AST is a compound form, return the car of the form. If name
is
provided, return t
if the car of the form is eq to name
.
If the AST is a compound form, return the AST in the car of the form.
Test feature-expression
against the features in *features*
.
The global value of ‘*features*‘ is ignored.
Returns the ast in defining-form
that defines name
.
If referencing-ast
is supplied, the returned ast must
occur before it.
Return the ast of the local function named function-name
which is in scope of enclosed-form
.
Retrieve the function body of function-declaration
as
though it were defined in a car-of-form
form. The trailing parenthesis
should be removed. *bindings-allows-macros-p* can be set to get the body
from macros.
Return the args to the compound form represented by AST.
Retrieves the functions defined by binding-form
.
car-of-form
can be used as an ’eql specializer to dispatch to a specific
method for the form. reference-ast
is a reference point for the method
to filter out variables that aren’t in scope of it. This is useful for
forms like ’let* or for forms at the top-level which reference-ast
may
not be in the body of, such as ’defun.
Methods for this generic shouldn’t check if car-of-form
is
what is expected as there are different forms that
can have their variables retrieved in the exact same way,
such as let and when-let.
Retrieves the variables defined by binding-form
.
car-of-form
can be used as an ’eql specializer to dispatch to a specific
method for the form. reference-ast
is a reference point for the method
to filter out variables that aren’t in scope of it. This is useful for
forms like ’let* or for forms at the top-level which reference-ast
may
not be in the body of, such as ’defun.
Methods for this generic shouldn’t check if car-of-form
is
what is expected as there are different forms that
can have their variables retrieved in the exact same way,
such as let and when-let.
Retrieve the lambda list of function-declaration
as
though it were defined in a car-of-form
form. *bindings-allows-macros-p*
can be set to retrieve lambda lists from macros.
Return t
if AST likely represents a literal.
Build a new ast by calling fun
, a function, on each feature
expression in AST, substituting the old feature expression with the
return value of fn
.
remove-empty
and remove-not-empty
have the same meaning as for
‘map-reader-conditionals’.
Build a new ast by calling fn
, an function, on each reader
conditional in AST (as if by ‘transform-reader-conditional’) and
substituting the old reader conditional with the new one.
If :remove-empty
is true, remove any reader conditionals where the
feature expression is empty. If the sign is +
, the entire reader
conditional is removed. If the sign is -
, then only the guarded
expression is retained.
If :remove-newly-empty
is true, reader conditionals are removed if the
new feature expression is empty, but reader conditionals that were
already empty are retained.
Return the quoted form if AST represents a quasiquote ast.
Return the quoted form if AST represents a quote ast.
Return the quoted form if the AST is quoted.
Remove features
from feature-expression
.
If there are no features left, ‘nil’ is returned.
Remove support for features
from AST.
Each feature in features
will be removed from all feature expressions,
and if any of the resulting expressions are empty their guards (and
possibly expressions) will be omitted according to the sign of the guard.
Return the binding for symbol
in a list if it is in scope
.
Return the binding for symbol
in a list if it is in scope
.
Call fn
, a function, on each feature in feature-expression
.
Substitute the return value of fn
for the existing feature.
If fn
returns nil, the feature is removed.
fn
may return any feature expression, not just a symbol.
Build a new reader condition by calling fn
on reader-conditional
.
fn
is called with three arguments: the sign, as a character (+ or -)
;
the feature expresion (as a list); and the guarded expression.
fn
should return three values -
a new sign, a new test, and a new
expression -
which are used to build a new reader conditional.
If the sign, the test, and the expression are unchanged,
reader-conditional
is returned unchanged and a second value of t is
returned.
Call fn
, a function, on each feature expression in AST.
Call fn
, a function, on each reader conditional in AST.
fn
is called with three arguments: the sign of the reader conditional
(+ or -)
, the feature expression (as a list), and the guarded
expression.