public interface EntityFactory
A factory for producing instances of
Entity, and some related utility
methods.-
Method Summary
Modifier and TypeMethodDescriptionComputes the join of the two scopes in the scope tree and returns it.newBehavior(String name, BehaviorNode behavior) Creates a new behavior entity.newFunction(String name, ProgramEntity.LinkageKind linkage, Type type) Creates a newFunction.newLabel(OrdinaryLabelNode declaration) Creates a new label entity.newScope(Scope.ScopeKind kind, Scope parent, ASTNode root) Creates a new scope.newTypedef(String name, Type type) Creates a newTypedefentity.newVariable(String name, ProgramEntity.LinkageKind linkage, Type type) Creates a newVariable.
-
Method Details
-
newScope
Creates a new scope.- Parameters:
kind- the kind of scope to createparent- the scope immediately containing the new scope; can be null for the root scoperoot- an AST node to associate to the new scope; it is used only for printing to make it easy for the reader to identify where the scope comes from- Returns:
- the new Scope
-
newVariable
Creates a newVariable.- Parameters:
name- the name of the variablelinkage- the kind of linkage the variable hastype- the type of the variable- Returns:
- the new variable
-
newFunction
Creates a newFunction.- Parameters:
name- the name of the functionlinkage- the kind of linkage the function hastype- the type of the function- Returns:
- the new function
-
newTypedef
Creates a newTypedefentity.- Parameters:
name- the name of the typedeftype- the type to which the name is bound in the typedef- Returns:
- the new
Typedefentity
-
newLabel
Creates a new label entity. This corresponds to an ordinary label "declaration" in the code. (The name of the label is followed by a colon and then a statement.)- Parameters:
declaration- the ordinary label declaration- Returns:
- the new label entity
-
join
Computes the join of the two scopes in the scope tree and returns it.- Parameters:
s1- non-null scopes2- non-null scope- Returns:
- the youngest common ancestor of s1 and s2
-
newBehavior
Creates a new behavior entity.- Parameters:
name-behavior-- Returns:
-