orc.ast.oil.expression
Class Def

java.lang.Object
  extended by orc.ast.oil.expression.Def
All Implemented Interfaces:
Locatable, Located

public class Def
extends java.lang.Object
implements Locatable

A unit of syntax that encapsulates an expression definition. Groups of mutually recursive definitions are scoped in the simplified abstract syntax tree by a Def.

Author:
dkitchin

Field Summary
 java.util.List<Type> argTypes
           
 int arity
           
 Expression body
           
 SourceLocation location
           
 java.lang.String name
           
 Type resultType
           
 int typeArity
           
 
Constructor Summary
Def(int arity, Expression body, int typeArity, java.util.List<Type> argTypes, Type resultType, SourceLocation location, java.lang.String name)
           
 
Method Summary
 void addIndices(java.util.Set<java.lang.Integer> indices, int depth)
           
 void checkDef(TypingContext ctx)
           
 void checkLambda(TypingContext ctx, ArrowType t)
           
 java.util.Set<Variable> freeVars()
           
 SourceLocation getSourceLocation()
           
 Def marshal()
           
 void setSourceLocation(SourceLocation location)
           
 java.lang.String toString()
           
 ArrowType type(TypingContext ctx)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

arity

public int arity

body

public Expression body

typeArity

public int typeArity

argTypes

public java.util.List<Type> argTypes

resultType

public Type resultType

location

public SourceLocation location

name

public java.lang.String name
Constructor Detail

Def

public Def(int arity,
           Expression body,
           int typeArity,
           java.util.List<Type> argTypes,
           Type resultType,
           SourceLocation location,
           java.lang.String name)
Method Detail

freeVars

public final java.util.Set<Variable> freeVars()

addIndices

public void addIndices(java.util.Set<java.lang.Integer> indices,
                       int depth)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

type

public ArrowType type(TypingContext ctx)
               throws TypeException
Throws:
TypeException

checkDef

public void checkDef(TypingContext ctx)
              throws TypeException
Throws:
TypeException

checkLambda

public void checkLambda(TypingContext ctx,
                        ArrowType t)
                 throws TypeException
Throws:
TypeException

setSourceLocation

public void setSourceLocation(SourceLocation location)
Specified by:
setSourceLocation in interface Locatable

getSourceLocation

public SourceLocation getSourceLocation()
Specified by:
getSourceLocation in interface Located

marshal

public Def marshal()
            throws CompilationException
Throws:
CompilationException