Type is immutable once created. The exception is StructType. Its information is updated in multiple semantic analysis stages. We make sure that GetXXType() doesn't create duplicated instances of the same type.
More...
#include <type.h>
|
virtual bool | is_primitive () const |
|
virtual bool | is_pointer () const |
|
virtual bool | is_array () const |
|
virtual bool | is_string () const |
|
virtual bool | is_struct () const |
|
virtual bool | is_function () const |
|
virtual bool | is_ref () const |
|
virtual bool | is_float () const |
|
virtual bool | is_int () const |
|
virtual bool | is_num () const |
|
virtual bool | is_unsigned () const |
|
virtual bool | is_bool () const |
|
virtual bool | is_void () const |
|
virtual bool | is_char () const |
|
virtual int | get_align_bits () |
|
virtual int | get_size_bits () |
|
virtual vector< Type * > | children () const |
|
bool | is_canonical () const |
|
const str & | get_typename () const |
|
|
static vector< str > | ALL_TYPE_NAMES |
|
Type is immutable once created. The exception is StructType. Its information is updated in multiple semantic analysis stages. We make sure that GetXXType() doesn't create duplicated instances of the same type.
Definition at line 22 of file type.h.
◆ IsCanonical()
bool Type::IsCanonical |
( |
const Type & |
type | ) |
|
|
static |
A composite type is canonical only if its subtype(s) are also canonical. A non-composite type is canonical only if it's not a type reference.
We write it as a static method to check for infinite recursion using iterative search.
Definition at line 209 of file type.cpp.
◆ ALL_TYPE_NAMES
vector<str> tanlang::Type::ALL_TYPE_NAMES |
|
inlinestatic |
Initial value:{"bool", "int", "float", "f32", "str", "char", "f64", "i8",
"u8", "i16", "u16", "i32", "u32", "i64", "u64", "void"}
Definition at line 38 of file type.h.
The documentation for this class was generated from the following files:
- /home/tjy/repos/tan/include/ast/type.h
- /home/tjy/repos/tan/src/ast/type.cpp