11. Runtime type information library

The RTTI module reflects runtime type information to Daslang. It also exposes Daslang compiler infrastructure to Daslang runtime.

All functions and symbols are in “rtti” module, use require to get access to it.

require rtti

11.1. Type aliases

bitfield ProgramFlags

Flags which represent state of the Program object, both during and after compilation.

Fields
  • failToCompile (0x1) - indicates that the program failed to compile.

  • _unsafe (0x2) - indicates that the program contains unsafe code.

  • isCompiling (0x4) - indicates that the program is currently compiling.

  • isSimulating (0x8) - indicates that the program is currently simulating.

  • isCompilingMacros (0x10) - indicates that the program is currently compiling macros.

  • needMacroModule (0x20) - indicates that the program needs a macro module.

  • promoteToBuiltin (0x40) - indicates that the program is being promoted to a builtin module.

  • isDependency (0x80) - indicates that the program is a dependency module.

  • macroException (0x100) - indicates that a macro exception has occurred.

bitfield context_category_flags

Flags which specify type of the Context.

Fields
  • dead (0x1) - indicates that the context is dead.

  • debug_context (0x2) - indicates that the context is a debug context.

  • thread_clone (0x4) - indicates that the context is a thread clone.

  • job_clone (0x8) - indicates that the context is a job clone.

  • opengl (0x10) - indicates that the context is an opengl context.

  • debugger_tick (0x20) - indicates that the context is a debugger tick.

  • debugger_attached (0x40) - indicates that the context has a debugger attached.

  • macro_context (0x80) - indicates that the context is a macro context (i.e. compiled macro module)

  • folding_context (0x100) - indicates that the context is a folding context (used during compilation or optimization for the purposes of folding constants)

  • audio (0x200) - indicates that the context is an audio context.

bitfield TypeInfoFlags

Flags which specify properties of the TypeInfo object (any rtti type).

Fields
  • ref (0x1) - indicates that the type is a reference value.

  • refType (0x2) - indicates that the type is a reference type.

  • canCopy (0x4) - indicates that the type can be copied.

  • isPod (0x8) - indicates that the type is a plain old data type.

  • isRawPod (0x10) - indicates that the type is a raw plain old data type (without pointers or strings).

  • isConst (0x20) - indicates that the type is a const type.

  • isTemp (0x40) - indicates that the type is a temporary type.

  • isImplicit (0x80) - indicates that the type is an implicit type.

  • refValue (0x100) - indicates that the type is a reference value.

  • hasInitValue (0x200) - indicates that the type has an initial value.

  • isSmartPtr (0x400) - indicates that the type is a smart pointer.

  • isSmartPtrNative (0x800) - indicates that the type is a smart pointer native (smart_ptr_raw)

  • isHandled (0x1000) - indicates that the type is a handled type (annotation)

  • heapGC (0x2000) - indicates that the type needs marking by the garbage collector.

  • stringHeapGC (0x4000) - indicates that the type needs marking of strings by the garbage collector.

  • lockCheck (0x8000) - indicates that the type needs lock checking.

  • isPrivate (0x10000) - indicates that the type is private.

bitfield StructInfoFlags

Flags which represent properties of the StructInfo object (rtti object which represents structure type).

Fields
  • _class (0x1) - This structure is a class.

  • _lambda (0x2) - This structure is a lambda.

  • heapGC (0x4) - This structure needs marking by the garbage collector.

  • stringHeapGC (0x8) - This structure needs marking of strings by the garbage collector.

  • lockCheck (0x10) - This structure needs lock checking.

bitfield ModuleFlags

Flags which represent the module’s state.

Fields
  • builtIn (0x1) - This module is built-in.

  • promoted (0x2) - This module is promoted to a builtin module.

  • isPublic (0x4) - This module is public.

  • isModule (0x8) - This module is a module.

  • isSolidContext (0x10) - This module is a solid context (can’t be called from other contexts via pinvoke, global variables are cemented at locations)

  • doNotAllowUnsafe (0x20) - This module does not allow unsafe code.

  • wasParsedNameless (0x40) - This module was parsed nameless.

  • visibleEverywhere (0x80) - This module is visible everywhere.

  • skipLockCheck (0x100) - This module skips lock checking.

bitfield AnnotationDeclarationFlags

Flags which represent properties of the AnnotationDeclaration object.

Fields
  • inherited (0x1) - Indicates that the annotation is inherited.

variant RttiValue

Variant type which represents value of any annotation arguments and variable annotations.

Variants
  • tBool : bool - boolean value

  • tInt : int - integer value

  • tUInt : uint - unsigned integer value

  • tInt64 : int64 - 64-bit integer value

  • tUInt64 : uint64 - 64-bit unsigned integer value

  • tFloat : float - floating point value

  • tDouble : double - double precision floating point value

  • tString : string - string value

  • nothing : any - no value

FileAccessPtr = smart_ptr<FileAccess>

smart_ptr<FileAccess>, i.e pointer to the FileAccess object.

11.2. Constants

FUNCINFO_INIT = 0x1

Function flag which indicates that function is called during the Context initialization.

FUNCINFO_BUILTIN = 0x2

Function flag which indicates that function is a built-in function.

FUNCINFO_PRIVATE = 0x4

Function flag which indicates that function is private.

FUNCINFO_SHUTDOWN = 0x8

Function flag which indicates that function is called during the Context shutdown.

FUNCINFO_LATE_INIT = 0x20

Function flag which indicates that function initialization is ordered via custom init order.

11.3. Enumerations

CompilationError

Enumeration which represents error type for each of the errors which compiler returns and various stages.

Values
  • unspecified = 0 - Unspecified error.

  • mismatching_parentheses = 10001 - Mismatching parentheses.

  • mismatching_curly_bracers = 10002 - Mismatching curly braces.

  • string_constant_exceeds_file = 10003 - String constant exceeds file.

  • string_constant_exceeds_line = 10004 - String constant exceeds line.

  • unexpected_close_comment = 10005 - Unexpected close comment.

  • integer_constant_out_of_range = 10006 - Integer constant out of range.

  • comment_contains_eof = 10007 - Comment contains EOF (end of file).

  • invalid_escape_sequence = 10008 - Invalid escape sequence.

  • invalid_line_directive = 10009 - Invalid line directive.

  • syntax_error = 20000 - Syntax error, usually invalid grammar.

  • malformed_ast = 20001 - Malformed AST.

  • invalid_type = 30101 - Invalid type.

  • invalid_return_type = 30102 - Invalid return type.

  • invalid_argument_type = 30103 - Invalid argument type.

  • invalid_structure_field_type = 30104 - Invalid structure field type.

  • invalid_array_type = 30105 - Invalid array type.

  • invalid_table_type = 30106 - Invalid table type.

  • invalid_argument_count = 30107 - Invalid argument count.

  • invalid_variable_type = 30108 - Invalid variable type.

  • invalid_new_type = 30109 - Invalid new type.

  • invalid_index_type = 30110 - Invalid index type.

  • invalid_annotation = 30111 - Invalid annotation.

  • invalid_swizzle_mask = 30112 - Invalid swizzle mask.

  • invalid_initialization_type = 30113 - Invalid initialization type.

  • invalid_with_type = 30114 - Invalid with type.

  • invalid_override = 30115 - Invalid override.

  • invalid_name = 30116 - Invalid name.

  • invalid_array_dimension = 30117 - Invalid array dimension.

  • invalid_iteration_source = 30118 - Invalid iteration source.

  • invalid_loop = 30119 - Invalid loop.

  • invalid_label = 30120 - Invalid label.

  • invalid_enumeration = 30121 - Invalid enumeration.

  • invalid_option = 30122 - Invalid or unsupported option.

  • invalid_member_function = 30123 - Invalid member function.

  • function_already_declared = 30201 - Function already declared.

  • argument_already_declared = 30202 - Argument already declared.

  • local_variable_already_declared = 30203 - Local variable already declared.

  • global_variable_already_declared = 30204 - Global variable already declared.

  • structure_field_already_declared = 30205 - Structure field already declared.

  • structure_already_declared = 30206 - Structure already declared.

  • structure_already_has_initializer = 30207 - Structure already has initializer.

  • enumeration_already_declared = 30208 - Enumeration already declared.

  • enumeration_value_already_declared = 30209 - Enumeration value already declared.

  • type_alias_already_declared = 30210 - Type alias already declared.

  • field_already_initialized = 30211 - Field already initialized.

  • type_not_found = 30301 - Type not found.

  • structure_not_found = 30302 - Structure not found.

  • operator_not_found = 30303 - Operator not found.

  • function_not_found = 30304 - Function not found.

  • variable_not_found = 30305 - Variable not found.

  • handle_not_found = 30306 - Handle not found.

  • annotation_not_found = 30307 - Annotation not found.

  • enumeration_not_found = 30308 - Enumeration not found.

  • enumeration_value_not_found = 30309 - Enumeration value not found.

  • type_alias_not_found = 30310 - Type alias not found.

  • bitfield_not_found = 30311 - Bitfield not found.

  • cant_initialize = 30401 - Can’t initialize.

  • cant_dereference = 30501 - Can’t dereference (not a pointer or dereferencable type).

  • cant_index = 30502 - Can’t index (not an array, table, or indexable type).

  • cant_get_field = 30503 - Can’t get field (not a structure or table type).

  • cant_write_to_const = 30504 - Can’t write to const.

  • cant_move_to_const = 30505 - Can’t move to const.

  • cant_write_to_non_reference = 30506 - Can’t write to non-reference.

  • cant_copy = 30507 - Can’t copy.

  • cant_move = 30508 - Can’t move.

  • cant_pass_temporary = 30509 - Can’t pass temporary value to non-temporary parameter.

  • condition_must_be_bool = 30601 - Condition must be boolean.

  • condition_must_be_static = 30602 - Condition must be static (for ‘static_if’ and ‘static_elif’)

  • cant_pipe = 30701 - Can’t pipe (invalid left-hand side or right-hand side).

  • invalid_block = 30801 - Invalid block.

  • return_or_break_in_finally = 30802 - Return or break in finally section is not allowed.

  • module_not_found = 30901 - Module not found.

  • module_already_has_a_name = 30902 - Module already has a name.

  • cant_new_handle = 31001 - Can’t new handled type.

  • bad_delete = 31002 - Bad delete.

  • cant_infer_generic = 31100 - Can’t infer generic.

  • cant_infer_missing_initializer = 31101 - Can’t infer missing initializer.

  • cant_infer_mismatching_restrictions = 31102 - Can’t infer mismatching restrictions.

  • invalid_cast = 31200 - Invalid cast.

  • incompatible_cast = 31201 - Incompatible cast.

  • unsafe = 31300 - Unsafe operation.

  • index_out_of_range = 31400 - Index out of range.

  • expecting_return_value = 32101 - Expecting return value.

  • not_expecting_return_value = 32102 - Not expecting return value (void function or block).

  • invalid_return_semantics = 32103 - Invalid return semantics.

  • invalid_yield = 32104 - Invalid yield.

  • typeinfo_reference = 39901 - ‘typeinfo’ error, the type is a reference.

  • typeinfo_auto = 39902 - ‘typeinfo’ error, the type is auto.

  • typeinfo_undefined = 39903 - ‘typeinfo’ error, the type is undefined.

  • typeinfo_dim = 39904 - ‘typeinfo’ error, the type is not a static array.

  • typeinfo_macro_error = 39905 - Macro returned error.

  • static_assert_failed = 40100 - Static assert failed.

  • run_failed = 40101 - Run failed (attempt of folding constant function without side-effects failed)

  • annotation_failed = 40102 - Annotation throw panic during compile time.

  • concept_failed = 40103 - Concept throw panic during compile time.

  • not_all_paths_return_value = 40200 - Not all paths return value.

  • assert_with_side_effects = 40201 - Assert with side effects.

  • only_fast_aot_no_cpp_name = 40202 - Only fast AOT no C++ name.

  • aot_side_effects = 40203 - AOT side effects.

  • no_global_heap = 40204 - No global heap is specified, but program requests it.

  • no_global_variables = 40205 - No global variables are allowed in this context.

  • unused_function_argument = 40206 - Unused function argument.

  • unsafe_function = 40207 - Unsafe function.

  • too_many_infer_passes = 41000 - Too many infer passes.

  • missing_node = 50100 - Missing simulation node.

ConstMatters

Yes or no flag which indicates if constant flag of the type matters (during comparison).

Values
  • no = 0 - const does not matter, when comparing types.

  • yes = 1 - const matters, when comparing types.

RefMatters

Yes or no flag which indicates if reference flag of the type matters (during comparison).

Values
  • no = 0 - Ref does not matter, when comparing types.

  • yes = 1 - Ref matters, when comparing types.

TemporaryMatters

Yes or no flag which indicates if temporary flag of the type matters (during comparison).

Values
  • no = 0 - Temporary does not matter, when comparing types.

  • yes = 1 - Temporary matters, when comparing types.

Type

One of the fundamental (base) types of any type object.

Values
  • none = 0 - No type specified (not void, not anything).

  • autoinfer = 1 - Auto-inferred type (auto)

  • alias = 2 - Type alias.

  • option = 3 - Optional type (foo|bar|…)

  • typeDecl = 4 - Type declaration typedecl(expr…)

  • typeMacro = 5 - Type macro. $type_macro_name(args…)

  • fakeContext = 6 - Fake context type (used for internal purposes to pass context as argument to C++ functions)

  • fakeLineInfo = 7 - Fake line info type (used for internal purposes to pass line info as argument to C++ functions)

  • anyArgument = 8 - Any argument type (only available for C++ interop functions, TypeInfo is provided)

  • tVoid = 9 - Void type.

  • tBool = 10 - Boolean type.

  • tInt8 = 11 - 8-bit integer type.

  • tUInt8 = 12 - 8-bit unsigned integer type.

  • tInt16 = 13 - 16-bit integer type.

  • tUInt16 = 14 - 16-bit unsigned integer type.

  • tInt64 = 15 - 64-bit integer type.

  • tUInt64 = 16 - 64-bit unsigned integer type.

  • tInt = 17 - 32-bit integer type.

  • tInt2 = 18 - vector of 2 32-bit integers.

  • tInt3 = 19 - vector of 3 32-bit integers.

  • tInt4 = 20 - vector of 4 32-bit integers.

  • tUInt = 21 - 32-bit unsigned integer type.

  • tUInt2 = 22 - vector of 2 32-bit unsigned integers.

  • tUInt3 = 23 - vector of 3 32-bit unsigned integers.

  • tUInt4 = 24 - vector of 4 32-bit unsigned integers.

  • tFloat = 25 - 32-bit floating point type.

  • tFloat2 = 26 - vector of 2 32-bit floating point numbers.

  • tFloat3 = 27 - vector of 3 32-bit floating point numbers.

  • tFloat4 = 28 - vector of 4 32-bit floating point numbers.

  • tDouble = 29 - 64-bit floating point type.

  • tRange = 30 - 32-bit range type, similar to vector of two 32-bit integers.

  • tURange = 31 - 32-bit unsigned range type, similar to vector of two 32-bit unsigned integers.

  • tRange64 = 32 - 64-bit range type, similar to vector of two 64-bit integers.

  • tURange64 = 33 - 64-bit unsigned range type, similar to vector of two 64-bit unsigned integers.

  • tString = 34 - String type.

  • tStructure = 35 - Structure type.

  • tHandle = 36 - Handle type (C++ type specified via annotation).

  • tEnumeration = 37 - 32-bit enumeration type.

  • tEnumeration8 = 38 - 8-bit enumeration type.

  • tEnumeration16 = 39 - 16-bit enumeration type.

  • tEnumeration64 = 40 - 64-bit enumeration type.

  • tBitfield = 41 - 32-bit bitfield type.

  • tBitfield8 = 42 - 8-bit bitfield type.

  • tBitfield16 = 43 - 16-bit bitfield type.

  • tBitfield64 = 44 - 64-bit bitfield type.

  • tPointer = 45 - Pointer type.

  • tFunction = 46 - Function type.

  • tLambda = 47 - Lambda type.

  • tIterator = 48 - Iterator type.

  • tArray = 49 - Array type.

  • tTable = 50 - Table type.

  • tBlock = 51 - Block type.

  • tTuple = 52 - Tuple type.

  • tVariant = 53 - Variant type.

11.4. Handled structures

CodeOfPolicies

Object which holds compilation and simulation settings and restrictions.

Fields
  • aot : bool - whether ahead-of-time compilation is enabled

  • standalone_context : bool - whether standalone context AOT compilation is enabled

  • aot_module : bool - specifies to AOT if we are compiling a module, or a final program

  • aot_macros : bool - enables AOT of macro code (like ‘qmacro_block’ etc)

  • completion : bool - if we are in code completion mode

  • export_all : bool - export all functions and global variables

  • serialize_main_module : bool - if not, we recompile main module each time

  • keep_alive : bool - keep context alive after main function

  • very_safe_context : bool - whether to use very safe context (delete of data is delayed, to avoid table[foo]=table[bar] lifetime bugs)

  • always_report_candidates_threshold : int - threshold for reporting candidates for function calls. if less than this number, we always report them

  • max_infer_passes : int - maximum number of inference passes

  • stack : uint - stack size

  • intern_strings : bool - whether to intern strings

  • persistent_heap : bool - whether to use persistent heap (or linear heap)

  • multiple_contexts : bool - whether multiple contexts are allowed (pinvokes between contexts)

  • heap_size_hint : uint - heap size hint

  • string_heap_size_hint : uint - string heap size hint

  • solid_context : bool - whether to use solid context (global variables are cemented at locations, can’t be called from other contexts via pinvoke)

  • macro_context_persistent_heap : bool - whether macro context uses persistent heap

  • macro_context_collect : bool - whether macro context does garbage collection

  • max_static_variables_size : uint64 - maximum size of static variables

  • max_heap_allocated : uint64 - maximum heap allocated

  • max_string_heap_allocated : uint64 - maximum string heap allocated

  • rtti : bool - whether to enable RTTI

  • unsafe_table_lookup : bool - whether to allow unsafe table lookups (via [] operator)

  • relaxed_pointer_const : bool - whether to relax pointer constness rules

  • version_2_syntax : bool - allows use of version 2 syntax

  • gen2_make_syntax : bool - whether to use gen2 make syntax

  • relaxed_assign : bool - allows relaxing of the assignment rules

  • no_unsafe : bool - disables all unsafe operations

  • local_ref_is_unsafe : bool - local references are considered unsafe

  • no_global_variables : bool - disallows global variables in this context (except for generated)

  • no_global_variables_at_all : bool - disallows global variables at all in this context

  • no_global_heap : bool - disallows global heap in this context

  • only_fast_aot : bool - only fast AOT, no C++ name generation

  • aot_order_side_effects : bool - whether to consider side effects during AOT ordering

  • no_unused_function_arguments : bool - errors on unused function arguments

  • no_unused_block_arguments : bool - errors on unused block arguments

  • allow_block_variable_shadowing : bool - allows block variable shadowing

  • allow_local_variable_shadowing : bool - allows local variable shadowing

  • allow_shared_lambda : bool - allows shared lambdas

  • ignore_shared_modules : bool - ignore shared modules during compilation

  • default_module_public : bool - default module mode is public

  • no_deprecated : bool - disallows use of deprecated features

  • no_aliasing : bool - disallows aliasing (if aliasing is allowed, temporary lifetimes are extended)

  • strict_smart_pointers : bool - enables strict smart pointer checks

  • no_init : bool - disallows use of ‘init’ in structures

  • strict_unsafe_delete : bool - enables strict unsafe delete checks

  • no_members_functions_in_struct : bool - disallows members functions in structures

  • no_local_class_members : bool - disallows local class members

  • report_invisible_functions : bool - report invisible functions

  • report_private_functions : bool - report private functions

  • strict_properties : bool - enables strict property checks

  • no_optimizations : bool - disables all optimizations

  • fail_on_no_aot : bool - fails compilation if AOT is not available

  • fail_on_lack_of_aot_export : bool - fails compilation if AOT export is not available

  • log_compile_time : bool - log compile time

  • log_total_compile_time : bool - log total compile time

  • no_fast_call : bool - disables fast call optimization

  • debugger : bool - enables debugger support

  • debug_infer_flag : bool - enables debug inference flag

  • debug_module : das_string - sets debug module (module which will be loaded when IDE connects)

  • profiler : bool - enables profiler support

  • profile_module : das_string - sets profile module (module which will be loaded when profiler connects)

  • jit : bool - enables JIT support

  • jit_module : das_string - sets JIT module (module which will be loaded when JIT is enabled)

  • threadlock_context : bool - enables threadlock context

FileInfo

Information about a single file stored in the FileAccess object.

Fields
  • name : das_string - File name.

  • tabSize : int - Tab size for this file.

LineInfo

Information about a section of the file stored in the FileAccess object.

Fields
  • fileInfo : FileInfo ? - File information object.

  • column : uint - Column number (1-based).

  • line : uint - Line number (1-based).

  • last_column : uint - Last column number (1-based).

  • last_line : uint - Last line number (1-based).

Context
Context implicit.getInitSemanticHash() : uint64()

Returns the semantic hash of the initialization code for the given Context.

Context implicit.totalFunctions() : int()

Returns the total number of functions in the given Context.

Context implicit.totalVariables() : int()

Returns the total number of variables in the given Context.

Context implicit.getCodeAllocatorId() : uint64()

Returns non-persistent unique ID of the code (node) allocator associated with the given Context.

Properties
  • getInitSemanticHash : uint64

  • totalFunctions : int

  • totalVariables : int

  • getCodeAllocatorId : uint64

Object which holds single Daslang Context. Context is the result of the simulation of the Daslang program.

Fields
  • breakOnException : bool - Calls breakpoint when exception is thrown.

  • alwaysErrorOnException : bool - Always error on exception.

  • alwaysStackWalkOnException : bool - Always stack walk on exception.

  • name : das_string - Context name.

  • category : context_category_flags - Context category flags.

  • exceptionAt : LineInfo - Exception at line info.

  • exception : string - Exception message.

  • last_exception : string - Last exception message.

  • contextMutex : recursive_mutex ? - Context mutex.

Error

Object which holds information about compilation error or exception.

Fields
FileAccess

Object which holds collection of files as well as means to access them (Project).

Module

Collection of types, aliases, functions, classes, macros etc under a single namespace.

Fields
ModuleGroup

Collection of modules.

AnnotationArgument

Single argument of the annotation, typically part of the AnnotationArgumentList.

Fields
  • basicType : Type - type of the argument value

  • name : das_string - argument name

  • sValue : das_string - string value

  • iValue : int - integer value

  • fValue : float - float value

  • bValue : bool - boolean value

  • at : LineInfo - line info where the argument is defined

Program
Program implicit.getThisModule() : Module?()

Returns the currently inferred module of the Program.

Program implicit.getDebugger() : bool()

Returns true if debugger is enabled for the given Program.

Properties
  • getThisModule : Module ?

  • getDebugger : bool

Object representing full information about Daslang program during and after compilation (but not the simulated result of the program).

Fields
  • thisNamespace : das_string - namespace of the program

  • thisModuleName : das_string - module name

  • totalFunctions : int - total number of functions in the program

  • totalVariables : int - total number of variables in the program

  • errors : vector<Error> - compilation errors and exceptions

  • globalStringHeapSize : uint - size of the global string heap

  • initSemanticHashWithDep : uint64 - initial semantic hash with dependencies

  • flags : ProgramFlags - program flags

  • _options : AnnotationArgumentList - program options

  • policies : CodeOfPolicies - code of policies

Annotation
Annotation implicit.isTypeAnnotation() : bool()

Returns true if the given annotation represents a type annotation.

Annotation implicit.isBasicStructureAnnotation() : bool()

Returns true if the given annotation is a BasicStructureAnnotation.

Annotation implicit.isStructureAnnotation() : bool()

Returns true if the given annotation represents a structure annotation.

Annotation implicit.isStructureTypeAnnotation() : bool()

Returns true if the given annotation represents a structure type annotation.

Annotation implicit.isFunctionAnnotation() : bool()

Returns true if the given annotation is a FunctionAnnotation.

Annotation implicit.isEnumerationAnnotation() : bool()

Returns true if the given annotation is an EnumerationAnnotation.

Properties
  • isTypeAnnotation : bool

  • isBasicStructureAnnotation : bool

  • isStructureAnnotation : bool

  • isStructureTypeAnnotation : bool

  • isFunctionAnnotation : bool

  • isEnumerationAnnotation : bool

Handled type or macro.

Fields
  • name : das_string - name of the annotation

  • cppName : das_string - name of the associated C++ type or macro

  • _module : Module ? - module where the annotation is defined

AnnotationDeclaration

Annotation declaration, its location, and arguments.

Fields
TypeAnnotation
TypeAnnotation implicit.is_any_vector() : bool()

Returns true if the given type annotation represents any vector type (std::vector and such).

TypeAnnotation implicit.canMove() : bool()

Returns true if the given type annotation can be moved.

TypeAnnotation implicit.canCopy() : bool()

Returns true if the given type annotation can be copied.

TypeAnnotation implicit.canClone() : bool()

Returns true if the given type annotation can be cloned.

TypeAnnotation implicit.isPod() : bool()

Returns true if the given type annotation represents a POD (plain old data) type.

TypeAnnotation implicit.isRawPod() : bool()

Returns true if the given type annotation represents a raw POD (plain old data) type - any basic type, but not a pointer or a string.

TypeAnnotation implicit.isRefType() : bool()

Returns true if the given type annotation represents a reference type, i.e. something which is always passed by reference - or a literal reference.

TypeAnnotation implicit.hasNonTrivialCtor() : bool()

Returns true if the given type annotation represents a type with non-trivial constructor semantics.

TypeAnnotation implicit.hasNonTrivialDtor() : bool()

Returns true if the given type annotation represents a type with non-trivial destructor semantics.

TypeAnnotation implicit.hasNonTrivialCopy() : bool()

Returns true if the given type annotation represents a type with non-trivial copy semantics.

TypeAnnotation implicit.canBePlacedInContainer() : bool()

Returns true if the given type annotation can be placed in a container.

TypeAnnotation implicit.isLocal() : bool()

Returns true if the given type annotation represents a local type (i.e something which can be a local variable of a function).

TypeAnnotation implicit.canNew() : bool()

Returns true if the given type annotation can be instantiated (i.e., a new instance can be created via new).

TypeAnnotation implicit.canDelete() : bool()

Returns true if the given type annotation can be deleted.

TypeAnnotation implicit.needDelete() : bool()

Returns true if the given type annotation requires deletion.

TypeAnnotation implicit.canDeletePtr() : bool()

Returns true if the pointer to about given type can be deleted.

TypeAnnotation implicit.isIterable() : bool()

Returns true if the given type annotation represents an iterable type.

TypeAnnotation implicit.isShareable() : bool()

Returns true if the given type annotation represents a shareable type.

TypeAnnotation implicit.isSmart() : bool()

Returns true if the given type annotation represents a smart pointer type.

TypeAnnotation implicit.avoidNullPtr() : bool()

Returns true if the given type annotation requires avoiding null pointers, i.e. for pointers to that type to be initialized.

TypeAnnotation implicit.sizeOf() : uint64()

Returns the size in bytes of the given type annotation.

TypeAnnotation implicit.alignOf() : uint64()

Returns the alignment requirement of the given type annotation.

Properties
  • is_any_vector : bool

  • canMove : bool

  • canCopy : bool

  • canClone : bool

  • isPod : bool

  • isRawPod : bool

  • isRefType : bool

  • hasNonTrivialCtor : bool

  • hasNonTrivialDtor : bool

  • hasNonTrivialCopy : bool

  • canBePlacedInContainer : bool

  • isLocal : bool

  • canNew : bool

  • canDelete : bool

  • needDelete : bool

  • canDeletePtr : bool

  • isIterable : bool

  • isShareable : bool

  • isSmart : bool

  • avoidNullPtr : bool

  • sizeOf : uint64

  • alignOf : uint64

Handled type.

Fields
  • name : das_string - name of the type annotation

  • cppName : das_string - name of the associated C++ type

  • _module : Module ? - module where the annotation is defined

BasicStructureAnnotation
BasicStructureAnnotation implicit.fieldCount() : int()

Returns the number of fields in the given structure annotation.

Properties
  • fieldCount : int

Handled type which represents structure-like object. name of the structure module where the structure is defined list of fields in the structure hash of the structure hash of the structure initializer flags associated with the structure number of fields in the structure

Fields
  • name : das_string - size of the structure in bytes

  • cppName : das_string - index of the first GC field, i.e. field which requires garbage collection marking

EnumValueInfo

Single element of enumeration, its name and value.

Fields
  • name : string - name of the enumeration value

  • value : int64 - value of the enumeration value

EnumInfo

Type object which represents enumeration.

Fields
  • name : string - name of the enumeration

  • module_name : string - module where the enumeration is defined

  • fields : EnumValueInfo ?? - fields in the enumeration

  • count : uint - number of fields in the enumeration

  • hash : uint64 - hash of the enumeration

StructInfo

Type object which represents structure or class.

Fields
  • name : string - name of the structure

  • module_name : string - module where the structure is defined

  • fields : VarInfo ?? - fields in the structure

  • hash : uint64 - hash of the structure

  • init_mnh : uint64 - hash of the structure initializer

  • flags : StructInfoFlags - flags associated with the structure

  • count : uint - number of fields in the structure

  • size : uint - size of the structure in bytes

  • firstGcField : uint - index of the first GC field in the structure, i.e. field which requires garbage collection marking

TypeInfo
TypeInfo implicit.enumType() : EnumInfo?()

Returns underlying enum type info for the given enum type annotation.

TypeInfo implicit.isRef() : bool()

Returns true if the given type info represents a reference type.

TypeInfo implicit.isRefType() : bool()

Returns true if the given type annotation represents a reference type, i.e. something which is always passed by reference - or a literal reference.

TypeInfo implicit.isRefValue() : bool()

Returns true if the given type info represents a ref value type.

TypeInfo implicit.canCopy() : bool()

Returns true if the given type annotation can be copied.

TypeInfo implicit.isPod() : bool()

Returns true if the given type annotation represents a POD (plain old data) type.

TypeInfo implicit.isRawPod() : bool()

Returns true if the given type annotation represents a raw POD (plain old data) type - any basic type, but not a pointer or a string.

TypeInfo implicit.isConst() : bool()

Returns true if the given type info represents a const type.

TypeInfo implicit.isTemp() : bool()

Returns true if the given type info represents a temporary type.

TypeInfo implicit.isImplicit() : bool()

Returns true if the given type info represents an implicit type.

TypeInfo implicit.annotation() : TypeAnnotation?()

Returns the annotation of the given type info.

TypeInfo implicit.annotation_or_name() : TypeAnnotation?()

Returns the annotation or name of the given type info.

TypeInfo implicit.structType() : StructInfo?()

Returns the structure type information for the given type info.

Properties
  • enumType : EnumInfo ?

  • isRef : bool

  • isRefType : bool

  • isRefValue : bool

  • canCopy : bool

  • isPod : bool

  • isRawPod : bool

  • isConst : bool

  • isTemp : bool

  • isImplicit : bool

  • annotation : TypeAnnotation ?

  • annotation_or_name : TypeAnnotation ?

  • structType : StructInfo ?

Object which represents any Daslang type.

Fields
  • firstType : TypeInfo ? - first type parameter

  • secondType : TypeInfo ? - second type parameter

  • argTypes : TypeInfo ?? - argument types list

  • argNames : string? - argument names list

  • dim : uint? - dimensions list

  • hash : uint64 - hash of the type

  • _type : Type - kind of the type

  • basicType : Type - basic type category

  • flags : TypeInfoFlags - flags associated with the type

  • size : uint - size of the type in bytes

  • argCount : uint - number of arguments in the type

  • dimSize : uint - number of dimensions in the type

VarInfo

Object which represents variable declaration.

Fields
  • firstType : TypeInfo ? - first type parameter

  • secondType : TypeInfo ? - second type parameter

  • argTypes : TypeInfo ?? - argument types list

  • argNames : string? - argument names list

  • hash : uint64 - hash of the type

  • basicType : Type - basic type category

  • flags : TypeInfoFlags - flags associated with the type

  • size : uint - size of the type in bytes

  • argCount : uint - number of arguments in the type

  • dimSize : uint - number of dimensions in the type

  • value : any - value of the variable

  • sValue : string - string value of the variable

  • name : string - name of the variable

  • annotation_arguments : AnnotationArguments ? - annotation arguments

  • offset : uint - offset of the variable in the structure

  • nextGcField : uint - next garbage collection field in the structure, which requires garbage collection marking

LocalVariableInfo

Object which represents local variable declaration.

Fields
  • firstType : TypeInfo ? - first type parameter

  • secondType : TypeInfo ? - second type parameter

  • argTypes : TypeInfo ?? - argument types list

  • argNames : string? - argument names list

  • hash : uint64 - hash of the type

  • basicType : Type - basic type category

  • flags : TypeInfoFlags - flags associated with the type

  • size : uint - size of the type in bytes

  • argCount : uint - number of arguments in the type

  • dimSize : uint - number of dimensions in the type

  • visibility : LineInfo - visibility information

  • name : string - name of the variable

  • stackTop : uint - stack top offset

  • localFlags : LocalVariableInfoFlags - local variable flags

FuncInfo

Object which represents function declaration.

Fields
  • name : string - function name

  • cppName : string - C++ name (for the builtin functions)

  • fields : VarInfo ?? - function parameters

  • result : TypeInfo ? - function result type

  • locals : LocalVariableInfo ?? - local variables (with visibility info)

  • globals : VarInfo ?? - accessed global variables

  • hash : uint64 - hash of the function

  • flags : uint - flags associated with the function

  • count : uint - number of arguments in the function

  • stackSize : uint - stack size in bytes

  • localCount : uint - number of local variables

  • globalCount : uint - number of accessed global variables

SimFunction
SimFunction implicit.lineInfo() : LineInfo const?()

Returns line information for the given function RTTI.

Properties

Object which represents simulated function in the Context.

Fields
  • name : string - original function name

  • mangledName : string - mangled function name (with arguments and types encoded)

  • debugInfo : FuncInfo ? - pointer to the function debug info, if available

  • mangledNameHash : uint64 - hash of the mangled function name

  • stackSize : uint - stack size in bytes

  • flags : SimFunctionFlags - flags associated with the function

DebugInfoHelper
Fields
  • rtti : bool - Helper object which holds debug information about the simulated program.

11.5. Typeinfo macros

rtti_typeinfo

Generates TypeInfo for the given expression or type.

11.6. Handled types

recursive_mutex

Holds system-specific recursive mutex object (typically std::recursive_mutex).

AnnotationArguments

List of annotation arguments.

AnnotationArgumentList

List of annotation arguments and properties.

AnnotationList

List of all annotations attached to the object (function or structure).

11.7. Initialization and finalization

CodeOfPolicies() : CodeOfPolicies()

CodeOfPolicies initializer.

using(arg0: block<(CodeOfPolicies):void>)

Creates object which can be used inside of the block scope.

Arguments
LineInfo() : LineInfo()

LineInfo initializer.

LineInfo(arg0: FileInfo? implicit; arg1: int; arg2: int; arg3: int; arg4: int) : LineInfo()

LineInfo initializer.

Arguments
  • arg0 : FileInfo ? implicit

  • arg1 : int

  • arg2 : int

  • arg3 : int

  • arg4 : int

using(arg0: block<(recursive_mutex):void>)

Creates object which can be used inside of the block scope.

Arguments
using(arg0: block<(ModuleGroup):void>)

Creates object which can be used inside of the block scope.

Arguments
RttiValue_nothing() : auto()

Constructs new RttiValue of type ‘nothing’.

11.8. Type access

get_dim(typeinfo: TypeInfo implicit; index: int) : int()

Get dim property of the type, i.e. size of the static array.

Arguments
  • typeinfo : TypeInfo implicit

  • index : int

get_dim(typeinfo: VarInfo implicit; index: int) : int()

Get dim property of the type, i.e. size of the static array.

Arguments
  • typeinfo : VarInfo implicit

  • index : int

builtin_is_same_type(a: TypeInfo const? implicit; b: TypeInfo const? implicit; refMatters: RefMatters; cosntMatters: ConstMatters; tempMatters: TemporaryMatters; topLevel: bool) : bool()

Returns true if two TypeInfo objects are the same given comparison criteria.

Arguments
get_type_size(type: TypeInfo? implicit) : int()

Returns size of the type in bytes.

Arguments
get_type_align(type: TypeInfo? implicit) : int()

Returns alignment of the type in bytes.

Arguments
is_compatible_cast(from: StructInfo const? implicit; to: StructInfo const? implicit) : bool()

Returns true if from type can be casted to to type.

Arguments
get_das_type_name(type: Type) : string()

Returns name of the Type object.

Arguments
is_same_type(a: TypeInfo; b: TypeInfo; refMatters: RefMatters = RefMatters.yes; constMatters: ConstMatters = ConstMatters.yes; temporaryMatters: TemporaryMatters = TemporaryMatters.yes; topLevel: bool = true) : auto()

Returns true if two TypeInfo objects are the same given comparison criteria.

Arguments
is_compatible_cast(a: StructInfo; b: StructInfo) : auto()

Returns true if from type can be casted to to type.

Arguments
each_dim(info: TypeInfo) : auto()

Iterates through all dim values of the rtti type object, i.e. through all size properties of the array.

Arguments
each_dim(info: VarInfo) : auto()

Iterates through all dim values of the rtti type object, i.e. through all size properties of the array.

Arguments
arg_types(info: TypeInfo) : auto()

Iterates through argument types of the rtti type object.

Arguments
arg_types(info: VarInfo) : auto()

Iterates through argument types of the rtti type object.

Arguments
arg_names(info: TypeInfo) : auto()

Iterates through argument names of the rtti type object.

Arguments
arg_names(info: VarInfo) : auto()

Iterates through argument names of the rtti type object.

Arguments

11.9. Rtti context access

get_total_functions(context: Context implicit) : int()

Get total number of functions in the context.

Arguments
get_total_variables(context: Context implicit) : int()

Get total number of global variables in the context.

Arguments
get_function_info(context: any; index: int) : FuncInfo()

Get function declaration info by index.

Arguments
  • context : any

  • index : int

get_variable_info(context: any; index: int) : VarInfo()

Get global variable type information by variable index.

Arguments
  • context : any

  • index : int

get_variable_value(varInfo: VarInfo implicit) : RttiValue()

Return RttiValue which represents value of the global variable.

Arguments
get_function_info(context: Context implicit; function: function<():void>) : FuncInfo const?()

Get function declaration info by index.

Arguments
  • context : Context implicit

  • function : function<void>

get_function_by_mnh(context: Context implicit; MNH: uint64) : function<():void>()

Returns SimFunction by mangled name hash.

Arguments
  • context : Context implicit

  • MNH : uint64

get_line_info() : LineInfo()

Returns LineInfo object for the current line (line where get_line_info is called from).

get_line_info(depth: int) : LineInfo()

Returns LineInfo object for the current line (line where get_line_info is called from).

Arguments
  • depth : int

this_context() : Context&()

Returns current Context object.

context_for_each_function(blk: block<(info:FuncInfo):void>) : auto()

Iterates through all functions in the Context.

Arguments
context_for_each_variable(blk: block<(info:VarInfo):void>) : auto()

Iterates through all variables in the Context.

Arguments
  • blk : block<(info: VarInfo ):void>

class_info(cl: auto) : StructInfo const?()

Returns StructInfo?` for the class.

Arguments
  • cl : auto

type_info(cl: auto) : TypeInfo const?()

Returns TypeInfo object for the local variable.

Arguments
  • cl : auto

type_info(vinfo: LocalVariableInfo) : TypeInfo const?()

Returns TypeInfo object for the local variable.

Arguments
type_info(vinfo: VarInfo) : TypeInfo const?()

Returns TypeInfo object for the local variable.

Arguments

11.10. Program access

get_this_module(program: smart_ptr<Program> implicit) : Module?()

Get current Program object currently compiled module.

Arguments
  • program : smart_ptr< Program > implicit

get_module(name: string implicit) : Module?()

Get Module object by name.

Arguments
  • name : string implicit

program_for_each_module(program: smart_ptr<Program> implicit; block: block<(Module?):void>)

Iterates through all modules of the Program object.

Arguments
  • program : smart_ptr< Program > implicit

  • block : block<( Module ?):void> implicit

program_for_each_registered_module(block: block<(Module?):void>)

Iterates through all registered modules of the Daslang runtime.

Arguments
  • block : block<( Module ?):void> implicit

11.11. Module access

module_for_each_structure(module: Module? implicit; block: block<(StructInfo):void>)

Iterates through all structure declarations in the Module object.

Arguments
module_for_each_enumeration(module: Module? implicit; block: block<(EnumInfo):void>)

Iterates through each enumeration in the module.

Arguments
  • module : Module ? implicit

  • block : block<( EnumInfo ):void> implicit

module_for_each_function(module: Module? implicit; block: block<(FuncInfo):void>)

Iterates through each function in the module.

Arguments
  • module : Module ? implicit

  • block : block<( FuncInfo ):void> implicit

module_for_each_generic(module: Module? implicit; block: block<(FuncInfo):void>)

Iterates through each generic function in the module.

Arguments
  • module : Module ? implicit

  • block : block<( FuncInfo ):void> implicit

module_for_each_global(module: Module? implicit; block: block<(VarInfo):void>)

Iterates through each global variable in the module.

Arguments
  • module : Module ? implicit

  • block : block<( VarInfo ):void> implicit

module_for_each_annotation(module: Module? implicit; block: block<(Annotation):void>)

Iterates though each handled type in the module.

Arguments

11.12. Annotation access

get_annotation_argument_value(info: AnnotationArgument implicit) : RttiValue()

Returns RttiValue which represents argument value for the specific annotation argument.

Arguments
add_annotation_argument(annotation: AnnotationArgumentList implicit; name: string implicit) : int()

Adds annotation argument to the AnnotationArgumentList object.

Arguments

11.13. Compilation and simulation

compile(module_name: string implicit; codeText: string implicit; codeOfPolicies: CodeOfPolicies implicit; block: block<(bool;smart_ptr<Program>;das_string):void>)

Compile Daslang program given as string.

Arguments
  • module_name : string implicit

  • codeText : string implicit

  • codeOfPolicies : CodeOfPolicies implicit

  • block : block<(bool;smart_ptr< Program >; das_string ):void> implicit

compile(module_name: string implicit; codeText: string implicit; codeOfPolicies: CodeOfPolicies implicit; exportAll: bool; block: block<(bool;smart_ptr<Program>;das_string):void>)

Compile Daslang program given as string.

Arguments
  • module_name : string implicit

  • codeText : string implicit

  • codeOfPolicies : CodeOfPolicies implicit

  • exportAll : bool

  • block : block<(bool;smart_ptr< Program >; das_string ):void> implicit

compile_file(module_name: string implicit; fileAccess: smart_ptr<FileAccess> implicit; moduleGroup: ModuleGroup? implicit; codeOfPolicies: CodeOfPolicies implicit; block: block<(bool;smart_ptr<Program>;das_string):void>)

Compile Daslang program given as file in the FileAccess object.

Arguments
for_each_expected_error(program: smart_ptr<Program> implicit; block: block<(CompilationError;int):void>)

Iterates through each compilation error of the Program object.

Arguments
for_each_require_declaration(program: smart_ptr<Program> implicit; block: block<(Module?;string#;string#;bool;LineInfo):void>)

Iterates though each require declaration of the compiled program.

Arguments
  • program : smart_ptr< Program > implicit

  • block : block<( Module ?;string#;string#;bool; LineInfo &):void> implicit

simulate(program: smart_ptr<Program> const& implicit; block: block<(bool;smart_ptr<Context>;das_string):void>)

Simulates Daslang program and creates ‘Context’ object.

Arguments

11.14. File access

make_file_access(project: string implicit) : smart_ptr<FileAccess>()

Creates new FileAccess object.

Arguments
  • project : string implicit

set_file_source(access: smart_ptr<FileAccess> implicit; fileName: string implicit; text: string implicit) : bool()

Sets source for the specified file in the FileAccess object.

Arguments
  • access : smart_ptr< FileAccess > implicit

  • fileName : string implicit

  • text : string implicit

add_file_access_root(access: smart_ptr<FileAccess> implicit; mod: string implicit; path: string implicit) : bool()

Add extra root directory (search path) to the FileAccess object.

Arguments
  • access : smart_ptr< FileAccess > implicit

  • mod : string implicit

  • path : string implicit

11.15. Structure access

rtti_builtin_structure_for_each_annotation(struct: StructInfo implicit; block: block<():void>)

Iterates through each annotation for the Structure object.

Arguments
  • struct : StructInfo implicit

  • block : block<void> implicit

basic_struct_for_each_field(annotation: BasicStructureAnnotation implicit; block: block<(string;string;TypeInfo;uint):void>)

Iterates through each field of the structure object.

Arguments
basic_struct_for_each_parent(annotation: BasicStructureAnnotation implicit; block: block<(Annotation?):void>)

Iterates through each parent type of the BasicStructureAnnotation object.

Arguments
structure_for_each_annotation(st: StructInfo; subexpr: block<(ann:Annotation;args:AnnotationArguments):void>) : auto()

Iterates through each annotation for the Structure object.

Arguments

11.16. Data walking and printing

sprint_data(data: void? implicit; type: TypeInfo const? implicit; flags: bitfield) : string()

Prints data given TypeInfo and returns result as a string, similar to print function.

Arguments
  • data : void? implicit

  • type : TypeInfo ? implicit

  • flags : bitfield<>

sprint_data(data: float4; type: TypeInfo const? implicit; flags: bitfield) : string()

Prints data given TypeInfo and returns result as a string, similar to print function.

Arguments
  • data : float4

  • type : TypeInfo ? implicit

  • flags : bitfield<>

describe(type: TypeInfo const? implicit) : string()

Describe rtti object and return data as string.

Arguments
describe(lineinfo: LineInfo implicit; fully: bool = false) : string()

Describe rtti object and return data as string.

Arguments
  • lineinfo : LineInfo implicit

  • fully : bool

get_mangled_name(type: TypeInfo const? implicit) : string()

Returns mangled name of the function.

Arguments

11.17. Function and mangled name hash

get_function_by_mangled_name_hash(src: uint64) : function<():void>()

Returns function<> given mangled name hash.

Arguments
  • src : uint64

get_function_by_mangled_name_hash(src: uint64; context: Context implicit) : function<():void>()

Returns function<> given mangled name hash.

Arguments
  • src : uint64

  • context : Context implicit

get_function_mangled_name_hash(src: function<():void>) : uint64()

Returns mangled name hash of the function<> object.

Arguments
  • src : function<void>

get_function_address(MNH: uint64; at: Context implicit) : uint64()

Return function pointer SimFunction * given mangled name hash.

Arguments
  • MNH : uint64

  • at : Context implicit

11.18. Context and mutex locking

lock_this_context(block: block<():void>)

Makes recursive critical section of the current Context object.

Arguments
  • block : block<void> implicit

lock_context(lock_context: Context implicit; block: block<():void>)

Makes recursive critical section of the given Context object.

Arguments
  • lock_context : Context implicit

  • block : block<void> implicit

lock_mutex(mutex: recursive_mutex implicit; block: block<():void>)

Makes recursive critical section of the given recursive_mutex object.

Arguments

11.19. Runtime data access

get_table_key_index(table: void? implicit; key: any; baseType: Type; valueTypeSize: int) : int()

Returns index of the key in the table.

Arguments
  • table : void? implicit

  • key : any

  • baseType : Type

  • valueTypeSize : int

11.20. Uncategorized

module_for_each_dependency(module: Module? implicit; block: block<(Module?;bool):void>)

Iterates through each dependency of the module.

Arguments
  • module : Module ? implicit

  • block : block<( Module ?;bool):void> implicit

get_tuple_field_offset(type: TypeInfo? implicit; index: int) : int()

Returns offset of the tuple field.

Arguments
  • type : TypeInfo ? implicit

  • index : int

get_variant_field_offset(type: TypeInfo? implicit; index: int) : int()

Returns offset of the variant field.

Arguments
  • type : TypeInfo ? implicit

  • index : int

each(info: FuncInfo implicit ==const) : iterator<VarInfo&>()

Iterates through each element of the object.

Arguments
each(info: FuncInfo const implicit ==const) : iterator<VarInfo const&>()

Iterates through each element of the object.

Arguments
each(info: StructInfo implicit ==const) : iterator<VarInfo&>()

Iterates through each element of the object.

Arguments
each(info: StructInfo const implicit ==const) : iterator<VarInfo const&>()

Iterates through each element of the object.

Arguments
each(info: EnumInfo implicit ==const) : iterator<EnumValueInfo&>()

Iterates through each element of the object.

Arguments
each(info: EnumInfo const implicit ==const) : iterator<EnumValueInfo const&>()

Iterates through each element of the object.

Arguments