Semant
Class Type.ARRAY

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

public static class Type.ARRAY
extends Type

An array has an element 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
 Type element
           
 
Fields inherited from class Semant.Type
BOOLEAN, INT, NIL, STRING, SYSTEM, VOID
 
Constructor Summary
Type.ARRAY(Type e)
          An array.
 
Method Summary
 void accept(Type.Visitor v)
          A type must accept a visitor
 boolean coerceTo(Type t)
          Arrays coerce if their element types are equal.
 boolean equals(Type t)
          Arrays are equal if their element types are equal.
 Type field(java.lang.String n)
          Java arrays have one field "length".
 java.lang.String toString()
          A printable representation of this array type.
 
Methods inherited from class Semant.Type
method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

element

public final Type element
Constructor Detail

Type.ARRAY

public Type.ARRAY(Type e)
An array.

Parameters:
e - element type
Method Detail

field

public Type field(java.lang.String n)
Java arrays have one field "length".

Overrides:
field in class Type
Parameters:
n - name of the field
Returns:
type of the field

coerceTo

public boolean coerceTo(Type t)
Arrays coerce if their element types are equal.

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)
Arrays are equal if their element types 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 array 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