shadow:standard

Class Class

Parent class

shadow:standard@Object

Interfaces

shadow:standard@CanHash

immutable class Class

Class objects are used to hold the type information in all Shadow objects. Methods on Class objects are used for internal functionality such as checking type-casts and performing allocations.

Create Summary

Modifiers Return Types Method and Description
protected () create(String name, int flags, int size, immutable nullable Class parent, immutable Class[] interfaces, immutable MethodTable[] interfaceTables)

Creates a new Class object with the given name, flags, size, parent, interfaces, and interface method tables.

Destroy Summary

Modifiers Return Types Method and Description
public () destroy()

Method Summary

Modifiers Return Types Method and Description
public readonly (Class) copy(AddressMap addresses)
public readonly (boolean) equal(Class other)

Compares the current class to another Class, returning true if they are the same.

protected readonly locked (immutable MethodTable) interfaceData(Class interfaceClass)

Retrieves method table associated with the given interface.

public readonly locked (boolean) isArray()

Checks whether or not the class is an array type.

public readonly locked (boolean) isGeneric()

Checks whether or not the class is a generic type.

public readonly locked (boolean) isInterface()

Checks whether or not the class is an interface type.

public readonly locked (boolean) isMethod()

Checks whether or not the class is a method type.

public readonly locked (boolean) isPrimitive()

Checks whether or not the class is a primitive type.

public readonly locked (boolean) isSingleton()

Checks whether or not the class is a singleton type.

public readonly locked (boolean) isSubtype(Class other)

Checks to see if the current Class object is the subtype of another Class object, returning true if it is.

public readonly locked (int) pointerSize()
public readonly (String) toString()

Returns the name of the current class.

Property Summary

Modifiers Return Types Method and Description
public readonly get (immutable int) flags()
public readonly get locked (ulong) hash()

Finds a hash value for the current class, based on its name.

public readonly get (immutable MethodTable[]) interfaceTables()
public readonly get (immutable Class[]) interfaces()
public readonly get (immutable String) name()
public readonly get (immutable nullable Class) parent()
public readonly get locked (int) size()

For normal types, returns the size required for an object whose type is given by this class.

public readonly get locked (int) width()

Returns the width needed to store an object whose type is given by this class in an array.

Create Detail

create

protected create(String name, int flags, int size, immutable nullable Class parent, immutable Class[] interfaces, immutable MethodTable[] interfaceTables) => ()

Creates a new Class object with the given name, flags, size, parent, interfaces, and interface method tables. This method should only be called by GenericClass.

Parameters

name - name of the class

flags - flags specifying the kind of type

size - size required for an object whose type is given by this class

parent - parent class

interfaces - interface classes supported by this class

data - method tables associated with each interface

Destroy Detail

destroy

public destroy() => ()

Method Detail

copy

public readonly copy(AddressMap addresses) => (Class)

equal

public readonly equal(Class other) => (boolean)

Compares the current class to another Class, returning true if they are the same.

Parameters

other - object to compare to

Returns

true if identical

interfaceData

protected readonly locked interfaceData(Class interfaceClass) => (immutable MethodTable)

Retrieves method table associated with the given interface.

Parameters

interfaceClass - interface to look up inside this class

Returns

method table associated with the interface

Throws

CastException - if interface cannot be found

isArray

public readonly locked isArray() => (boolean)

Checks whether or not the class is an array type.

Returns

true if the class is an array type

isGeneric

public readonly locked isGeneric() => (boolean)

Checks whether or not the class is a generic type.

Returns

true if the class is a generic type

isInterface

public readonly locked isInterface() => (boolean)

Checks whether or not the class is an interface type.

Returns

true if the class is an interface type

isMethod

public readonly locked isMethod() => (boolean)

Checks whether or not the class is a method type.

Returns

true if the class is a method type

isPrimitive

public readonly locked isPrimitive() => (boolean)

Checks whether or not the class is a primitive type.

Returns

true if the class is a primitive type

isSingleton

public readonly locked isSingleton() => (boolean)

Checks whether or not the class is a singleton type.

Returns

true if the class is a singleton type

isSubtype

public readonly locked isSubtype(Class other) => (boolean)

Checks to see if the current Class object is the subtype of another Class object, returning true if it is.

Parameters

other - object to compare to

Returns

true if the current class is its subtype

pointerSize

public readonly locked pointerSize() => (int)

toString

public readonly toString() => (String)

Returns the name of the current class.

Returns

name of the class

Property Detail

flags

public readonly get flags() => (immutable int)

hash

public readonly get locked hash() => (ulong)

Finds a hash value for the current class, based on its name.

Returns

hash value

interfaceTables

public readonly get interfaceTables() => (immutable MethodTable[])

interfaces

public readonly get interfaces() => (immutable Class[])

name

public readonly get name() => (immutable String)

parent

public readonly get parent() => (immutable nullable Class)

size

public readonly get locked size() => (int)

For normal types, returns the size required for an object whose type is given by this class. For array and interface types, it gives the width of the type. For primitive types, it gives the size of the wrapper object, not the raw primitive type.

Returns

size of an object

width

public readonly get locked width() => (int)

Returns the width needed to store an object whose type is given by this class in an array. For normal objects and arrays, this width is the pointer size. For primitive types, it is the size of the raw primitive type. For interface type, the size is twice the pointer size, accounting for the interface class and the method table.

Returns

width of an object