mixin compiler::CType

compiler::CType : compiler::CNode

Source

CType is a "compiler type" which is class used for representing the Fantom type system in the compiler. CTypes map to types within the compilation units themsevles as TypeDef and TypeRef or to precompiled types in imported pods via ReflectType or FType.

base

abstract CType? base()

Source

The direct super class of this type (null for Obj).

bridge

CBridge? bridge()

Source

If this is a foreign function return the bridge.

common

static CType common(CNamespace ns, CType[] types)

Source

Given a list of types, compute the most specific type which they all share, or at worst return sys::Obj. This method does not take into account mixins, only extends class inheritance.

ctors

CMethod[] ctors()

Source

List of the all constructors.

deref

virtual CType deref()

Source

If this is a TypeRef, return what it references

equals

virtual override Bool equals(Obj? t)

Source

Equality based on signature.

field

virtual CField? field(Str name)

Source

Lookup a field by name (null if method).

fields

CField[] fields()

Source

List of the all defined fields (including inherited fields).

fits

virtual Bool fits(CType t)

Source

Does this type implement the specified type. If true, then this type is assignable to the specified type (although the converse is not necessarily true). All types (including mixin types) fit sys::Obj.

fitsAny

Bool fitsAny(CType[] types)

Source

Return if this type fits any of the types in the specified list.

flags

abstract Int flags()

Source

Get the flags bitmask.

foreignInheritance

CType? foreignInheritance()

Source

If this TypeDef extends from a FFI class or implements any FFI mixins, then return the FFI type otherwise return null.

hasSlot

Bool hasSlot(Str name)

Source

Return if this type contains a slot by the specified name.

hash

virtual override Int hash()

Source

Hash on signature.

inferredAs

virtual CType inferredAs()

Source

If this type is being used for type inference then get the type as it should be inferred. Typically we just return this. However some FFI types such as [java]::int are never used on the stack directly and are inferred to be sys::Int.

instanceCtors

CMethod[] instanceCtors()

Source

List of the all instance constructors.

isAbstract

Bool isAbstract()

Source

Return if this Type is abstract and cannot be instantiated. This method will always return true if the type is a mixin.

isBool

Bool isBool()

Source

isBuf

Bool isBuf()

Source

isClass

Bool isClass()

Source

Return if this Type is a class (as opposed to enum or mixin)

isConst

Bool isConst()

Source

Return if this Type is const and immutable.

isConstFieldType

Bool isConstFieldType()

Source

Is this type ok to use as a const field? Any const type fine, plus we allow Obj, List, Map, Buf, and Func since they will implicitly have toImmutable called on them.

isDecimal

Bool isDecimal()

Source

isEnum

Bool isEnum()

Source

Return if this Type is an sys::Enum

isFacet

Bool isFacet()

Source

Return if this Type is an sys::Facet

isFinal

Bool isFinal()

Source

Return if this Type is final and cannot be subclassed.

isFloat

Bool isFloat()

Source

isForeign

virtual Bool isForeign()

Source

If this a foreign function interface type.

isFunc

Bool isFunc()

Source

isGeneric

abstract Bool isGeneric()

Source

A generic type means that one or more of my slots contain signatures using a generic parameter (such as V or K). Fantom supports three built-in generic types: List, Map, and Func. A generic instance (such as Str[]) is NOT a generic type (all of its generic parameters have been filled in). User defined generic types are not supported in Fan.

isGenericParameter

abstract Bool isGenericParameter()

Source

Return if this type is a generic parameter (such as V or K) in a generic type (List, Map, or Method). Generic parameters serve as place holders for the parameterization of the generic type. Fantom has a predefined set of generic parameters which are always defined in the sys pod with a one character name.

isInt

Bool isInt()

Source

isInternal

Bool isInternal()

Source

Is this an internally scoped class

isList

Bool isList()

Source

isMap

Bool isMap()

Source

isMixin

Bool isMixin()

Source

Return if this Type is a mixin type and cannot be instantiated.

isNative

Bool isNative()

Source

Is the entire class implemented in native code?

isNothing

Bool isNothing()

Source

isNullable

abstract Bool isNullable()

Source

Is this is a nullable type (marked with trailing ?)

isObj

Bool isObj()

Source

isParameterized

abstract Bool isParameterized()

Source

A parameterized type is a type which has parameterized a generic type and replaced all the generic parameter types with generic argument types. The type Str[] is a parameterized type of the generic type List (V is replaced with Str). A parameterized type always has a signature which is different from the qname.

isPublic

Bool isPublic()

Source

Is this a public scoped class

isRange

Bool isRange()

Source

isStr

Bool isStr()

Source

isSupported

virtual Bool isSupported()

Source

Return if type is supported by the Fantom type system. For example the Java FFI will correctly model a Java multi-dimensional array during compilation, however there is no Fantom representation. We check for supported types during CheckErrors when accessing fields and methods.

isSynthetic

Bool isSynthetic()

Source

Is this a compiler generated synthetic class

isThis

Bool isThis()

Source

isType

Bool isType()

Source

isVal

abstract Bool isVal()

Source

Is this is a value type (Bool, Int, or Float and their nullables)

isValType

static Bool isValType(Str qname)

Source

Static utility for value type

isValid

virtual Bool isValid()

Source

Is this a valid type usable anywhere (such as local var)

isVoid

Bool isVoid()

Source

method

virtual CMethod? method(Str name)

Source

Lookup a method by name (null if field).

methods

CMethod[] methods()

Source

List of the all defined methods (including inherited methods).

mixins

abstract CType[] mixins()

Source

Return the mixins directly implemented by this type.

name

abstract Str name()

Source

Simple name of the type such as "Str".

operators

abstract COperators operators()

Source

Get operators lookup structure

parameterizeThis

virtual CType parameterizeThis(CType thisType)

Source

If this is a parameterized type which uses This, then replace This with the specified type.

pod

abstract CPod pod()

Source

Parent pod which defines this type.

qname

abstract Str qname()

Source

Qualified name such as "sys:Str".

raw

CType raw()

Source

If this type is a generic parameter (V, L, etc), then return the actual type for the native implementation. For example V is Obj, and L is List. This is the type we actually use when constructing a signature for the invoke opcode.

signature

abstract Str signature()

Source

This is the full signature of the type.

slot

virtual CSlot? slot(Str name)

Source

Lookup a slot by name. If the slot doesn't exist then return null.

slots

abstract Str:CSlot slots()

Source

Map of the all defined slots, both fields and methods (including inherited slots).

toListOf

abstract CType toListOf()

Source

Create a parameterized List of this type.

toNonNullable

virtual CType toNonNullable()

Source

Get this type as a non-nullable (if nullable)

toNullable

abstract CType toNullable()

Source

Get this type as a nullable type (marked with trailing ?)

toStr

override Str toStr()

Source

Return signature