Semant
Class Type.FUN

java.lang.Object
  extended by Semant.Type
      extended by Semant.Type.FUN
Enclosing class:
Type

public static class Type.FUN
extends Type

A function has formal parameters (represented as a record) and a result type.


Nested Class Summary
 
Nested classes/interfaces inherited from class Semant.Type
Type.ARRAY, Type.CLASS, Type.FUN, Type.INSTANCE, Type.Print, Type.RECORD<T extends Type>, Type.Visitor
 
Field Summary
 java.lang.String external
          External functions associate with some C library function name.
 Type.RECORD<Type> formals
           
 Type result
           
 
Fields inherited from class Semant.Type
BOOLEAN, INT, NIL, STRING, SYSTEM, VOID
 
Constructor Summary
Type.FUN(Type r)
          A function.
Type.FUN(Type r, java.lang.String x)
          An external function.
 
Method Summary
 void accept(Type.Visitor v)
          A type must accept a visitor
 boolean coerceTo(Type t)
          Functions coerce if their parameters are equal and their results coerce.
 boolean equals(Type t)
          Functions are equal if their parameters are equal and their results are equal.
 java.lang.String toString()
          A printable representation of this function type.
 
Methods inherited from class Semant.Type
field, method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

result

public final Type result

formals

public final Type.RECORD<Type> formals

external

public final java.lang.String external
External functions associate with some C library function name.

Constructor Detail

Type.FUN

public Type.FUN(Type r)
A function.

Parameters:
r - result type

Type.FUN

public Type.FUN(Type r,
                java.lang.String x)
An external function.

Parameters:
r - result type
x - external function name
Method Detail

coerceTo

public boolean coerceTo(Type t)
Functions coerce if their parameters are equal and their results coerce.

Specified by:
coerceTo in class Type
Parameters:
t - target type
Returns:
true if this coerces to t, false otherwise

equals

public boolean equals(Type t)
Functions are equal if their parameters are equal and their results are equal.

Specified by:
equals in class Type
Parameters:
t - target type
Returns:
true if types are equivalent, false otherwise

toString

public java.lang.String toString()
A printable representation of this function type.

Overrides:
toString in class java.lang.Object

accept

public void accept(Type.Visitor v)
Description copied from class: Type
A type must accept a visitor

Specified by:
accept in class Type
Parameters:
v - the visitor