10.2. AST manipulation library

The AST module provides access to the abstract syntax tree representation of daslang programs. It defines node types for all language constructs (expressions, statements, types, functions, structures, enumerations, etc.), visitors for tree traversal, and utilities for AST construction and manipulation. This module is the foundation for writing macros, code generators, and source-level program transformations.

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

require daslib/ast

10.2.1. Type aliases

bitfield TypeDeclFlags

properties of the TypeDecl object.

Fields:
  • ref (0x1) - The type is a reference type.

  • constant (0x2) - The type is a constant type.

  • temporary (0x4) - The type is a temporary type.

  • _implicit (0x8) - The type is an implicit type.

  • removeRef (0x10) - Remove the reference flag.

  • removeConstant (0x20) - Remove the constant flag.

  • removeDim (0x40) - Remove the dimension flag.

  • removeTemporary (0x80) - Remove the temporary flag.

  • explicitConst (0x100) - The type is an explicit constant type.

  • aotAlias (0x200) - The type is an AOT alias.

  • smartPtr (0x400) - The type is a smart pointer type.

  • smartPtrNative (0x800) - The type is a native smart pointer type (smart_ptr_raw).

  • isExplicit (0x1000) - The type is explicit.

  • isNativeDim (0x2000) - The type is a native dimension.

  • isTag (0x4000) - The type is a reification tag.

  • explicitRef (0x8000) - The type is an explicit reference.

  • isPrivateAlias (0x10000) - The type is a private alias.

  • autoToAlias (0x20000) - The type is an auto-to-alias.

bitfield FieldDeclarationFlags

properties of the FieldDeclaration object.

Fields:
  • moveSemantics (0x1) - The field is initialized using move semantics.

  • parentType (0x2) - Which parent type this field belongs to.

  • capturedConstant (0x4) - This field is a captured constant (via lambda or generator).

  • generated (0x8) - This field is compiler-generated.

  • capturedRef (0x10) - This field is a captured reference (via lambda or generator).

  • doNotDelete (0x20) - Has @do_not_delete attribute.

  • privateField (0x40) - This field is private.

  • _sealed (0x80) - The field is sealed. It cannot be overridden in derived types.

  • implemented (0x100) - Already implemented.

  • classMethod (0x200) - This field is a class method.

bitfield StructureFlags

properties of the Structure object. The structure is a class.

Fields:
  • isClass (0x1) - Generate constructor.

  • genCtor (0x2) - C++ data layout.

  • cppLayout (0x4) - C++ layout not POD type, i.e. has alignment to accommodate for inheritance.

  • cppLayoutNotPod (0x8) - This structure is compiler-generated.

  • generated (0x10) - This structure is using persistent heap (C++ heap).

  • persistent (0x20) - This structure is a lambda.

  • isLambda (0x40) - This structure is private.

  • privateStructure (0x80) - This structure is a macro interface.

  • macroInterface (0x100) - This structure is sealed. It cannot be inherited.

  • _sealed (0x200) - Skip lock check.

  • circular (0x400) - This structure has circular references (and is invalid).

  • _generator (0x800) - This structure is a generator.

  • hasStaticMembers (0x1000) - This structure has static members.

  • hasStaticFunctions (0x2000) - This structure has static functions.

  • hasInitFields (0x4000) - This structure has initialized fields.

  • safeWhenUninitialized (0x8000) - This structure is safe when uninitialized.

  • isTemplate (0x10000) - This structure is a template.

  • hasDefaultInitializer (0x20000) - This structure has a default initializer.

  • noGenCtor (0x40000) - This structure does not generate a default constructor.

bitfield ExprGenFlags

generation (genFlags) properties of the Expression object.

Fields:
  • alwaysSafe (0x1) - Expression is always safe.

  • generated (0x2) - Expression is compiler-generated.

  • userSaidItsSafe (0x4) - Expression is marked as safe explicitly.

bitfield ExprLetFlags

properties of the ExprLet object.

Fields:
  • inScope (0x1) - It’s ‘let inscope’ expression.

  • hasEarlyOut (0x2) - It’s ‘let hasEarlyOut’ expression.

  • itTupleExpansion (0x4) - It’s ‘let itTupleExpansion’ expression.

bitfield ExprFlags

properties of the Expression object.

Fields:
  • constexpression (0x1) - Expression is a constant expression.

  • noSideEffects (0x2) - Expression has no side effects.

  • noNativeSideEffects (0x4) - Expression has no native side effects, i.e. expression itself has no sideeffects.

  • isForLoopSource (0x8) - Expression is a for loop source.

  • isCallArgument (0x10) - Expression is a call argument.

bitfield ExprPrintFlags

printing properties of the Expression object.

Fields:
  • topLevel (0x1) - Its a top level expression.

  • argLevel (0x2) - Its an argument level expression.

  • bottomLevel (0x4) - Its a bottom level expression - no sub-expressions or nesting.

bitfield FunctionFlags

properties of the Function object.

Fields:
  • builtIn (0x1) - Function is built-in.

  • policyBased (0x2) - Function is policy-based.

  • callBased (0x4) - Function is call-based.

  • interopFn (0x8) - Function is interop function.

  • hasReturn (0x10) - Function has a return value.

  • copyOnReturn (0x20) - Function copies return value.

  • moveOnReturn (0x40) - Function moves return value.

  • exports (0x80) - Its an exported function.

  • init (0x100) - Its an init function.

  • addr (0x200) - Function has address requested.

  • used (0x400) - Function is used.

  • fastCall (0x800) - Function is fast call.

  • knownSideEffects (0x1000) - Function has known side effects (user defined).

  • hasToRunAtCompileTime (0x2000) - Function has to run at compile time.

  • unsafeOperation (0x4000) - Function is unsafe operation.

  • unsafeDeref (0x8000) - All dereferences in the function will be simulated without safety checks.

  • hasMakeBlock (0x10000) - Function has ‘make block’ operation.

  • aotNeedPrologue (0x20000) - Function needs AOT prologue.

  • noAot (0x40000) - Function is not AOT.

  • aotHybrid (0x80000) - Function is AOT hybrid, i.e. can be called from both AOT and interpreted code. Call in never hardcoded.

  • aotTemplate (0x100000) - Function is AOT template, i.e. instantiated from template at C++ compile time.

  • generated (0x200000) - Function is compiler-generated.

  • privateFunction (0x400000) - Function is private.

  • _generator (0x800000) - Function is a generator.

  • _lambda (0x1000000) - Function is a lambda.

  • firstArgReturnType (0x2000000) - First argument type is return type.

  • noPointerCast (0x4000000) - Function has no pointer cast.

  • isClassMethod (0x8000000) - Function is a class method.

  • isTypeConstructor (0x10000000) - Function is a type constructor.

  • shutdown (0x20000000) - Function is a shutdown function.

  • anyTemplate (0x40000000) - Function is any template.

  • macroInit (0x80000000) - Function is macro init.

bitfield MoreFunctionFlags

additional properties of the Function object.

Fields:
  • macroFunction (0x1) - Function is a macro function.

  • needStringCast (0x2) - Converts das string arguments to C++ char *. Empty string, which is null in das, is converted to “”.

  • aotHashDeppendsOnArguments (0x4) - Function hash depends on arguments.

  • lateInit (0x8) - Function is late initialized.

  • requestJit (0x10) - Function is requested to be JIT compiled.

  • unsafeOutsideOfFor (0x20) - Function is unsafe outside of for loop sources.

  • safeImplicit (0x40) - Skip lock check for this function.

  • deprecated (0x80) - Function is safe for implicit calls. Otherwise temp values are to be specialized for in the generic.

  • aliasCMRES (0x100) - Function is deprecated.

  • neverAliasCMRES (0x200) - Function aliases CMRES (Copy or Move return result).

  • addressTaken (0x400) - Function never aliases CMRES.

  • propertyFunction (0x800) - Function address is taken.

  • pinvoke (0x1000) - Function is a property function.

  • jitOnly (0x2000) - Function is a P/Invoke function, i.e. cross-context call.

  • isStaticClassMethod (0x4000) - Function is JIT only.

  • requestNoJit (0x8000) - Function is a static class method.

  • jitContextAndLineInfo (0x10000) - Function is requested to not be JIT compiled.

  • nodiscard (0x20000) - Function requires JIT context and line info.

  • captureString (0x40000) - Discarding the return value of the function is unsafe.

  • callCaptureString (0x80000) - Function captures string arguments.

  • hasStringBuilder (0x100000) - Function calls capture string arguments.

  • recursive (0x200000) - Function has a string builder.

  • isTemplate (0x400000) - Function is recursive.

  • unsafeWhenNotCloneArray (0x800000) - Function is a template function.

  • stub (0x1000000) - Function is unsafe, when its not used to clone arrays.

  • lateShutdown (0x2000000) - This flag is a stub.

  • hasTryRecover (0x4000000) - Function will shutdown after all other shutdonws are done.

  • hasUnsafe (0x8000000) - Function has tryrecover blocks.

  • isConstClassMethod (0x10000000) - Function has unsafe operations made by user.

  • isCustomProperty (0x20000000) - Function is a const class method.

bitfield FunctionSideEffectFlags

side-effect properties of the Function object.

Fields:
  • _unsafe (0x1) - Function is unsafe.

  • userScenario (0x2) - User specified [sideeffects] annotation to indicate side effects.

  • modifyExternal (0x4) - Function may modify external state.

  • modifyArgument (0x8) - Function may modify argument values.

  • accessGlobal (0x10) - Function may access global state (variables and such).

  • invoke (0x20) - Function is using ‘invoke’, so we don’t know any additional side effects.

bitfield VariableFlags

properties of the Variable object.

Fields:
  • init_via_move (0x1) - Variable is initialized via move <-

  • init_via_clone (0x2) - Variable is initialized via clone :=

  • used (0x4) - Variable is used

  • aliasCMRES (0x8) - Variable is an alias for CMRES return value

  • marked_used (0x10) - Variable is marked as used (to suppress unused warnings)

  • global_shared (0x20) - Variable is a global shared variable

  • do_not_delete (0x40) - @do_not_delete annotation on the variable

  • generated (0x80) - Variable is generated by the compiler

  • capture_as_ref (0x100) - Variable is captured by reference in a closure

  • can_shadow (0x200) - Variable can shadow another variable in an inner scope

  • private_variable (0x400) - Variable is private to the class/struct

  • tag (0x800) - Variable is a reification tag

  • global (0x1000) - Variable is a global variable

  • inScope (0x2000) - Variable is ‘let inscope’, i.e. there is a coresponding ‘delete’ in the ‘finally’ section of the block

  • no_capture (0x4000) - This variable will not be captured in lambda (think ‘self’).

  • early_out (0x8000) - There is an early out from the scope where this variable is defined (via return and otherwise)

  • used_in_finally (0x10000) - Variable is used in the finally block

  • static_class_member (0x20000) - Variable is a static class member

  • bitfield_constant (0x40000) - Variable is a bitfield constant

  • pod_delete (0x80000) - This variable can be deleted as POD

  • pod_delete_gen (0x100000) - POD delete has been generated for this variable

  • single_return_via_move (0x200000) - This variable is returned via move in a function with only one return path

bitfield VariableAccessFlags

access properties of the Variable object.

Fields:
  • access_extern (0x1) - Variable is Function or block argument.

  • access_get (0x2) - Variable is accessed via get (read of some kind).

  • access_ref (0x4) - Variable is accessed via ref (written to).

  • access_init (0x8) - Variable is initialized.

  • access_pass (0x10) - Variable is passed to a function, or invoke.

  • access_fold (0x20) - Variable was folded aways (optimized out).

bitfield ExprBlockFlags

properties of the ExprBlock object.

Fields:
  • isClosure (0x1) - Block is a closure, and not a regular expression list.

  • hasReturn (0x2) - Block has a return statement.

  • copyOnReturn (0x4) - When invoked, the block result is copied on return.

  • moveOnReturn (0x8) - When invoked, the block result is moved on return.

  • inTheLoop (0x10) - Block is inside a loop.

  • finallyBeforeBody (0x20) - Finally is to be visited before the body.

  • finallyDisabled (0x40) - Finally is disabled.

  • aotSkipMakeBlock (0x80) - AOT is allowed to skip make block generation, and pass [&]() directly.

  • aotDoNotSkipAnnotationData (0x100) - AOT should not skip annotation data even if make block is skipped.

  • isCollapseable (0x200) - Block is eligible for collapse optimization.

  • needCollapse (0x400) - Block needs to be collapsed.

  • hasMakeBlock (0x800) - Block has make block operation.

  • hasEarlyOut (0x1000) - Block has early out (break/continue/return).

  • forLoop (0x2000) - Block is a for loop body.

  • hasExitByLabel (0x4000) - Block has exit by label (goto outside).

  • isLambdaBlock (0x8000) - Block is a lambda block.

  • isGeneratorBlock (0x10000) - Block is a generator block.

bitfield ExprAtFlags

properties of the ExprAt object.

Fields:
  • r2v (0x1) - Reference to value conversion is applied.

  • r2cr (0x2) - Read to const reference is propagated.

  • write (0x4) - The result is written to.

  • no_promotion (0x8) - Promotion to operator is disabled, even if operator [] is overloaded.

  • under_clone (0x10) - The expression is under a clone operation.

  • under_deref (0x20) - The expression is under a dereference (ExprRef2Value), safe for table lookup collision detection.

bitfield ExprMakeLocalFlags

properties of the ExprMakeLocal object (ExprMakeArray, ExprMakeStruct, ‘ExprMakeTuple’, ‘ExprMakeVariant’).

Fields:
  • useStackRef (0x1) - Use stack reference, i.e. there is an address on the stack - where the reference is written to.

  • useCMRES (0x2) - Result is returned via CMRES pointer. Usually this is ‘return <- [[ExprMakeLocal]]’

  • doesNotNeedSp (0x4) - Does not need stack pointer, usually due to being part of bigger initialization.

  • doesNotNeedInit (0x8) - Does not need field initialization, usually due to being fully initialized via constructor.

  • initAllFields (0x10) - Initialize all fields.

  • alwaysAlias (0x20) - Always alias the result, so temp value is always allocated on the stack.

bitfield ExprAscendFlags

properties of the ExprAscend object.

Fields:
  • useStackRef (0x1) - Use stack reference, i.e. there is an address on the stack - where the reference is written to.

  • needTypeInfo (0x2) - Simulated node needs type information at runtime.

  • isMakeLambda (0x4) - Is a lambda expression.

bitfield ExprCastFlags

properties of the ExprCast object.

Fields:
  • upcastCast (0x1) - Upcast cast, i.e. casting from based class to derived class.

  • reinterpretCast (0x2) - Reinterpret cast, i.e. casting between unrelated types (like pointer to integer)

bitfield ExprVarFlags

properties of the ExprVar object.

Fields:
  • local (0x1) - Local variable.

  • argument (0x2) - Function argument.

  • _block (0x4) - Block argument

  • thisBlock (0x8) - Argument of the most-nested block.

  • r2v (0x10) - Reference to value conversion is applied.

  • r2cr (0x20) - Read to const reference is propagated.

  • write (0x40) - Written to.

  • under_clone (0x80) - This is a foo := bar expression, and the variable is being cloned to.

bitfield ExprMakeStructFlags

properties of the ExprMakeStruct object.

Fields:
  • useInitializer (0x1) - Use initializer, i.e. ‘Foo(…)’, and not ‘Foo(uninitialized …)’.

  • isNewHandle (0x2) - Its ‘new Foo(…)’.

  • usedInitializer (0x4) - ‘useInitializer’ was used optimized out.

  • nativeClassInitializer (0x8) - Generated class initializer.

  • isNewClass (0x10) - Its ‘new ClassName(…)’.

  • forceClass (0x20) - Its declared via ‘class’syntax, so using it for regular types will fail.

  • forceStruct (0x40) - Its declared via ‘struct’ syntax, so using it for regular types will fail.

  • forceVariant (0x80) - Its declared via ‘variant’ syntax, so using it for regular types will fail.

  • forceTuple (0x100) - Its declared via ‘tuple’ syntax, so using it for regular types will fail.

  • alwaysUseInitializer (0x200) - Always use initializer, even for default construction.

  • ignoreVisCheck (0x400) - Ignores visibility check between modules.

  • canShadowBlock (0x800) - ‘where’ section argument can shadow other variables. This is for nested comprehensions and such.

bitfield MakeFieldDeclFlags

Properties of the MakeFieldDecl object.

Fields:
  • moveSemantics (0x1) - Initialized with move semantics, <-

  • cloneSemantics (0x2) - Initialized with clone semantics, :=

bitfield ExprFieldDerefFlags

dereferencing properties of the ExprField object.

Fields:
  • unsafeDeref (0x1) - Dereference without safety checking.

  • ignoreCaptureConst (0x2) - Ignore capture const, i.e. was captured as constant - but used as mutable.

bitfield ExprFieldFieldFlags

field properties of the ExprField object.

Fields:
  • r2v (0x1) - Reference to value conversion is applied.

  • r2cr (0x2) - Read to const reference is propagated.

  • write (0x4) - This is part of a write operation, and a field or part of it is being assigned to.

  • no_promotion (0x8) - No promotion to property, even if available.

  • under_clone (0x10) - Under clone, i.e. ‘Foo.bar := …’

bitfield ExprSwizzleFieldFlags

properties of the ExprSwizzle object.

Fields:
  • r2v (0x1) - Reference to value conversion is applied.

  • r2cr (0x2) - Read to const reference is propagated.

  • write (0x4) - This is part of a write operation, and a field or part of it is being assigned to.

bitfield ExprYieldFlags

properties of the ExprYield object. Its ‘yield <- …’.

Fields:
  • moveSemantics (0x1) - Skip lock checks.

bitfield ExprReturnFlags

properties of the ExprReturn object. Its ‘return <- …’.

Fields:
  • moveSemantics (0x1) - Return a reference. Function result is a reference.

  • returnReference (0x2) - Return in block, not in function.

  • returnInBlock (0x4) - Take over right stack, i.e its ‘return [MakeLocal]’ and temp stack value is allocated by return expression.

  • takeOverRightStack (0x8) - Return call CMRES, i.e. ‘return call(…)’.

  • returnCallCMRES (0x10) - Return CMRES, i.e. ‘return [MakeLocal]’ or ‘return [CmresVariable]’

  • returnCMRES (0x20) - From yield.

  • fromYield (0x40) - From comprehension.

  • fromComprehension (0x80) - Skip lock checks.

bitfield ExprMakeBlockFlags

properties of the ExprMakeBlock object.

Fields:
  • isLambda (0x1) - Is lambda, i.e. @(…) { … }

  • isLocalFunction (0x2) - Is a local function, i.e. @@(…) { … }

bitfield CopyFlags

properties of the ExprCopy object.

Fields:
  • allowCopyTemp (0x1) - This copy is allowed to copy a temporary value.

  • takeOverRightStack (0x2) - Its ‘foo = [MakeLocal]’ and temp stack value is allocated by copy expression.

  • allowConstantLValue (0x4) - Promote to clone, i.e. this is ‘foo := bar’ and not ‘foo = bar’

bitfield MoveFlags

Properties of the ExprMove object. Skip lock checks.

Fields:
  • takeOverRightStack (0x1) - Its ‘foo <- [MakeLocal]’ and temp stack value is allocated by move expression.

  • allowConstantLValue (0x2) - Move is allowed for constant lvalue, for example x <- 5

  • podDelete (0x4) - Move is a POD delete.

bitfield IfFlags

properties of the ExprIf object.

Fields:
  • isStatic (0x1) - This is a ‘static_if’ or ‘static_elif’ expression.

  • doNotFold (0x2) - Do not fold this ‘if’ expression during compilation.

bitfield StringBuilderFlags

properties of the ExprStringBuilder object.

Fields:
  • isTempString (0x1) - String builder produces a temporary string.

ExpressionPtr = Expression?

typedef ExpressionPtr = ast_core::Expression? aka ExpressionPtr

ProgramPtr = smart_ptr<Program>

typedef ProgramPtr = smart_ptr<rtti_core::Program> aka ProgramPtr

TypeDeclPtr = TypeDecl?

typedef TypeDeclPtr = ast_core::TypeDecl? aka TypeDeclPtr

VectorTypeDeclPtr = dasvector`ptr`TypeDecl

typedef VectorTypeDeclPtr = $::dasvector`ptr`TypeDecl aka VectorTypeDeclPtr

EnumerationPtr = Enumeration?

typedef EnumerationPtr = ast_core::Enumeration? aka EnumerationPtr

StructurePtr = Structure?

typedef StructurePtr = ast_core::Structure? aka StructurePtr

FunctionPtr = Function?

typedef FunctionPtr = ast_core::Function? aka FunctionPtr

VariablePtr = Variable?

typedef VariablePtr = ast_core::Variable? aka VariablePtr

MakeFieldDeclPtr = MakeFieldDecl?

typedef MakeFieldDeclPtr = ast_core::MakeFieldDecl? aka MakeFieldDeclPtr

ExprMakeBlockPtr = ExprMakeBlock?

typedef ExprMakeBlockPtr = ast_core::ExprMakeBlock? aka ExprMakeBlockPtr

FunctionAnnotationPtr = FunctionAnnotation?

typedef FunctionAnnotationPtr = ast_core::FunctionAnnotation? aka FunctionAnnotationPtr

StructureAnnotationPtr = StructureAnnotation?

typedef StructureAnnotationPtr = ast_core::StructureAnnotation? aka StructureAnnotationPtr

EnumerationAnnotationPtr = EnumerationAnnotation?

typedef EnumerationAnnotationPtr = ast_core::EnumerationAnnotation? aka EnumerationAnnotationPtr

PassMacroPtr = PassMacro?

typedef PassMacroPtr = ast_core::PassMacro? aka PassMacroPtr

VariantMacroPtr = VariantMacro?

typedef VariantMacroPtr = ast_core::VariantMacro? aka VariantMacroPtr

ReaderMacroPtr = ReaderMacro?

typedef ReaderMacroPtr = ast_core::ReaderMacro? aka ReaderMacroPtr

CommentReaderPtr = CommentReader?

typedef CommentReaderPtr = ast_core::CommentReader? aka CommentReaderPtr

CallMacroPtr = CallMacro?

typedef CallMacroPtr = ast_core::CallMacro? aka CallMacroPtr

TypeInfoMacroPtr = TypeInfoMacro?

typedef TypeInfoMacroPtr = ast_core::TypeInfoMacro? aka TypeInfoMacroPtr

ForLoopMacroPtr = ForLoopMacro?

typedef ForLoopMacroPtr = ast_core::ForLoopMacro? aka ForLoopMacroPtr

CaptureMacroPtr = CaptureMacro?

typedef CaptureMacroPtr = ast_core::CaptureMacro? aka CaptureMacroPtr

TypeMacroPtr = TypeMacro?

typedef TypeMacroPtr = ast_core::TypeMacro? aka TypeMacroPtr

SimulateMacroPtr = SimulateMacro?

typedef SimulateMacroPtr = ast_core::SimulateMacro? aka SimulateMacroPtr

10.2.2. Enumerations

CaptureMode

Enumeration with lambda variables capture modes.

Values:
  • capture_any = 0 - Unspecified capture mode (will try copy, then reference - and ask for unsafe).

  • capture_by_copy = 1 - Value is copied.

  • capture_by_reference = 2 - Reference to the original value is captured (this one is unsafe)

  • capture_by_clone = 3 - Value is cloned.

  • capture_by_move = 4 - Value is moved.

SideEffects

Enumeration with all possible side effects of expression or function.

Values:
  • none = 0 - No side effects.

  • unsafe = 1 - Function is unsafe.

  • userScenario = 2 - [sideeffects] annotation to indicate side effects.

  • modifyExternal = 4 - Function may modify external state.

  • accessExternal = 4 - Access to external state.

  • modifyArgument = 8 - Function may modify argument values.

  • modifyArgumentAndExternal = 12 - Function may modify argument values and external state.

  • worstDefault = 12 - Function has all sideeffects, except for a user scenario. This is to bind functions, whith unknown sideeffects.

  • accessGlobal = 16 - Function may access global state (variables and such).

  • invoke = 32 - Function is using ‘invoke’, so we don’t know any additional side effects.

  • inferredSideEffects = 56 - Mask for all sideefects, which can be inferred from the code.

10.2.3. Handled structures

ExprConstUInt64
ExprConstUInt64.getValue(): uint64

Returns the constant value stored in this expression node.

Properties:
  • getValue : uint64

Holds uint64 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tUInt64)

  • value : uint64 - Value of the constant expression

ExprConstURange64
ExprConstURange64.getValue(): urange64

Returns the constant value stored in this expression node.

Properties:
  • getValue : urange64

Holds urange64 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tURange64)

  • value : urange64 - Value of the constant expression

ExprFor

For loop (for expr1 in expr2 {your; block; here;})

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • iterators : vector<das_string> - Names of the iterator variables

  • iteratorsAka : vector<das_string> - Aliases for the iterator variables

  • iteratorsAt : vector<LineInfo> - Line information for each iterator

  • iteratorsTags : vector<Expression*> - Tags associated with each iterator

  • iteratorsTupleExpansion : vector<uint8> - Tuple expansion flags for iterators

  • iteratorVariables : vector<Variable*> - Variables associated with each iterator

  • sources : vector<Expression*> - Source expressions to iterate over

  • body : Expression? - The body of the for loop

  • visibility : LineInfo - Line information for visibility of the iterators

  • allowIteratorOptimization : bool - Whether iterator optimization is allowed

  • canShadow : bool - Whether shadowing is allowed, i.e. if the iterator names can shadow outer scope variables

ExprMakeGenerator

Generator closure (generator<int> or generator<Foo&>)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the AOT functor (if applicable)

  • arguments : vector<Expression*> - Arguments passed to the generator

  • argumentsFailedToInfer : bool - Whether arguments failed to infer

  • atEnclosure : LineInfo - Location of the enclosure

  • iterType : TypeDecl? - Iterator type, i.e. type of values produced by the generated iterator

  • _capture : vector<CaptureEntry> - List of captured variables

ExprConstRange
ExprConstRange.getValue(): range

Returns the constant value stored in this expression node.

Properties:
  • getValue : range

Holds range constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tRange)

  • value : range - Value of the constant expression

ExprConstFloat
ExprConstFloat.getValue(): float

Returns the constant value stored in this expression node.

Properties:
  • getValue : float

Holds float constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tFloat)

  • value : float - Value of the constant expression

ExprSafeAt

Safe index lookup (expr?[expr1]).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • subexpr : Expression? - Subexpression being indexed

  • index : Expression? - Index expression

  • atFlags : ExprAtFlags - Flags specific to ExprAt expressions

VariantMacro

Adapter for the AstVariantMacro.

Fields:
ExprConstPtr
ExprConstPtr.getValue(): void?

Returns the constant value stored in this expression node.

Properties:
  • getValue : void?

Null (null). Technically can be any other pointer, but it is used for nullptr.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression

  • value : void? - Pointer value. Typically this is ‘null’ constant, so the value is zero.

ExprLabel

Label (label 13:)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • labelName : int - The label name

  • comment : das_string - The label comment

ExprNullCoalescing

Null coalescing (expr1 ?? default_value).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • subexpr : Expression? - Expression being coalesced

  • unsafeDeref : bool - If true, skip runtime null-pointer check

  • assumeNoAlias : bool - Assume no aliasing occurs

  • defaultValue : Expression? - Default value expression

ExprConstInt16
ExprConstInt16.getValue(): int16

Returns the constant value stored in this expression node.

Properties:
  • getValue : int16

Holds int16 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tInt16)

  • value : int16 - Value of the constant expression

Variable
Variable.isAccessUnused(): bool

Returns whether the given variable is never accessed in the code.

Variable.getMangledNameHash(): uint64

Returns the mangled name hash of the given function.

Properties:
  • isAccessUnused : bool

  • getMangledNameHash : uint64

Variable declaration.

Fields:
  • name : das_string - Name of the variable

  • _aka : das_string - Alternative name of the variable

  • _type : TypeDecl? - Type of the variable

  • init : Expression? - Initializer expression for the variable, if any

  • source : Expression? - Source variable this variable was cloned from (weak reference, not owned).

  • loop_source : Expression? - If its an iterator variable for the for loop, source expression being iterated over

  • at : LineInfo - Location of the variable declaration in the source code

  • index : int - Index of the variable in the global variable list (for global variables)

  • stackTop : uint - Stack top offset for local variables

  • _module : Module? - Module this variable belongs to

  • initStackSize : uint - Stack size required to evaluate the initializer expression (for global variables)

  • flags : VariableFlags - Variable flags

  • access_flags : VariableAccessFlags - Variable access flags

  • annotation : AnnotationArgumentList - Annotations attached to this variable

ExprConstRange64
ExprConstRange64.getValue(): range64

Returns the constant value stored in this expression node.

Properties:
  • getValue : range64

Holds range64 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tRange64)

  • value : range64 - Value of the constant expression

ExprLet

Local variable declaration (let v = expr;).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • variables : vector<Variable*> - List of variables being declared in this let expression

  • atInit : LineInfo - Location of the initializer expression in source code

  • letFlags : ExprLetFlags - Properties of the ExprLet object.

ExprVar

Variable access (foo)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - The name of the variable

  • variable : Variable? - The variable being accessed

  • pBlock : ExprBlock? - The block in which the variable is accessed (if any)

  • argumentIndex : int - The argument index of the variable (if variable is an argument of a function or a block)

  • varFlags : ExprVarFlags - The flags of the variable

ExprConstURange
ExprConstURange.getValue(): urange

Returns the constant value stored in this expression node.

Properties:
  • getValue : urange

Holds urange constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tURange)

  • value : urange - Value of the constant expression

ExprBlock

Any block expression, including regular blocks and all types of closures.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • list : vector<Expression*> - List of expressions in the main body of the block

  • finalList : vector<Expression*> - List of expressions in the ‘finally’ section of the block

  • returnType : TypeDecl? - Declared return type of the block, if any (for closures)

  • arguments : vector<Variable*> - List of arguments for the block (for closures)

  • stackTop : uint - Stack top offset for the block declaration

  • stackVarTop : uint - Where variables of the block start on the stack

  • stackVarBottom : uint - Where variables of the block end on the stack

  • stackCleanVars : vector<pair`uint`uint> - Variables which are to be zeroed, if there is ‘finally’ section of the block. If there is ‘inscope’ variable after the return, it should be zeroed before entering the block.

  • maxLabelIndex : int - Maximum label index used in this block (for goto statements)

  • annotations : AnnotationList - AnnotationList - Annotations attached to this block

  • annotationData : uint64 - Opaque data associated with block

  • annotationDataSid : uint64 - Opaque data source unique-ish id associated with block

  • blockFlags : ExprBlockFlags - Block expression flags

  • inFunction : Function? - Which function this block belongs to

ExprCast

Any cast expression (cast<int> a, upcast<Foo> b or reinterpret<Bar?> c)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • subexpr : Expression? - Subexpression being cast

  • castType : TypeDecl? - Type to which the expression is being cast

  • castFlags : ExprCastFlags - Flags specific to ExprCast expressions

ExprConstUInt2
ExprConstUInt2.getValue(): uint2

Returns the constant value stored in this expression node.

Properties:
  • getValue : uint2

Holds uint2 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tUInt2)

  • value : uint2 - Value of the constant expression

ExprConstBitfield
ExprConstBitfield.getValue(): uint64

Returns the constant value stored in this expression node.

Properties:
  • getValue : uint64

Holds bitfield constant (Foo bar).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tBitfield, Type::tBitfield8, Type::tBitfield16, or Type::tBitfield64)

  • value : bitfield<> - Value of the constant expression

  • bitfieldType : TypeDecl? - Type declaration of the bitfield

ExprConstInt4
ExprConstInt4.getValue(): int4

Returns the constant value stored in this expression node.

Properties:
  • getValue : int4

Holds int4 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tInt4)

  • value : int4 - Value of the constant expression

ExprUnsafe

Unsafe expression (unsafe(addr(x)))

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • body : Expression? - Body expression that is marked as unsafe

ExprConstFloat2
ExprConstFloat2.getValue(): float2

Returns the constant value stored in this expression node.

Properties:
  • getValue : float2

Holds float2 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tFloat2)

  • value : float2 - Value of the constant expression

ExprQuote

Compilation time expression which holds its subexpressions but does not infer them (quote() <| x+5)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the query expression

  • arguments : vector<Expression*> - Arguments of the query expression

  • argumentsFailedToInfer : bool - Whether the arguments failed to infer types

  • atEnclosure : LineInfo - Location of the enclosure where the query is used

ExprStringBuilder

String builder expression (“blah{blah1}blah2”).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • elements : vector<Expression*> - List of expressions that make up the string builder (literals and expressions)

  • stringBuilderFlags : StringBuilderFlags - Flags specific to string builder expressions

ExprIfThenElse

If-then-else expression (if expr1 {your; block; here;} else {your; block; here;}) including static_if’s.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • cond : Expression? - The condition expression

  • if_true : Expression? - The ‘then’ block expression

  • if_false : Expression? - The ‘else’ block expression

  • if_flags : IfFlags - Flags specific to if-then-else expressions

ExprYield

Yield expression (yield foo or yield <- bar)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • subexpr : Expression? - The expression being yielded (never empty)

  • returnFlags : ExprYieldFlags - Yield flags

StructureAnnotation

Adapter for the AstStructureAnnotation.

ExprConstInt3
ExprConstInt3.getValue(): int3

Returns the constant value stored in this expression node.

Properties:
  • getValue : int3

Holds int3 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tInt3)

  • value : int3 - Value of the constant expression

ExprCall

Anything which looks like call (call(expr1,expr2)).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the call

  • arguments : vector<Expression*> - List of arguments passed to the function

  • argumentsFailedToInfer : bool - Whether any arguments failed to infer their types

  • atEnclosure : LineInfo - Location of the expression in source code

  • func : Function? - Pointer to the function being called, if resolved

  • stackTop : uint - Stack top at the point of call, if temporary variable allocation is needed

  • doesNotNeedSp : bool - If the call does not need stack pointer

  • cmresAlias : bool - If the call uses CMRES (Copy or Move result) aliasing, i.e would need temporary

  • notDiscarded : bool - If the call result is not discarded

TypeDecl
TypeDecl.canAot(): bool

Returns whether the given type can be ahead-of-time compiled.

TypeDecl.isExprType(): bool

Returns whether the type hierarchy contains an expression type.

TypeDecl.isSimpleType(): bool

Returns whether the given type is a simple non-void type that does not require resolution at inference time.

TypeDecl.isArray(): bool

Returns whether the given type is an array type.

TypeDecl.isGoodIteratorType(): bool

Returns whether the given type is an iterator type.

TypeDecl.isGoodArrayType(): bool

Returns whether the given type is a dynamic array type.

TypeDecl.isGoodTableType(): bool

Returns whether the given type is a table type.

TypeDecl.isGoodBlockType(): bool

Returns whether the given type is a block type.

TypeDecl.isGoodFunctionType(): bool

Returns whether the given type is a function type.

TypeDecl.isGoodLambdaType(): bool

Returns whether the given type is a lambda type.

TypeDecl.isGoodTupleType(): bool

Returns whether the given type is a tuple type.

TypeDecl.isGoodVariantType(): bool

Returns whether the given type is a variant type.

TypeDecl.isVoid(): bool

Returns whether the given type is the void type.

TypeDecl.isAnyType(): bool

Returns whether the given type is the any type, passed as vec4f via standard C++ interop.

TypeDecl.isRef(): bool

Returns whether the given type is a reference value.

TypeDecl.isRefType(): bool

Returns whether the given type is a reference type.

TypeDecl.canWrite(): bool

Returns whether the given type can be written to.

TypeDecl.isAotAlias(): bool

Returns whether the type definition contains an AOT alias type.

TypeDecl.isShareable(): bool

Returns whether the given type is shareable across contexts.

TypeDecl.isIndex(): bool

Returns whether the given type is an index type.

TypeDecl.isBool(): bool

Returns whether the given type is a boolean type.

TypeDecl.isInteger(): bool

Returns whether the given type is an integer type.

TypeDecl.isSignedInteger(): bool

Returns whether the given type is a signed integer type.

TypeDecl.isUnsignedInteger(): bool

Returns whether the given type is an unsigned integer type.

TypeDecl.isSignedIntegerOrIntVec(): bool

Returns whether the given type is a signed integer or signed integer vector type.

TypeDecl.isUnsignedIntegerOrIntVec(): bool

Returns whether the given type is an unsigned integer or unsigned integer vector type.

TypeDecl.isFloatOrDouble(): bool

Returns whether the given type is a float or double type.

TypeDecl.isNumeric(): bool

Returns whether the given type is a numeric type.

TypeDecl.isNumericComparable(): bool

Returns whether the given type supports numeric comparison.

TypeDecl.isPointer(): bool

Returns whether the given type is a pointer type.

TypeDecl.isSmartPointer(): bool

Returns whether the given type is a smart pointer type.

TypeDecl.isVoidPointer(): bool

Returns whether the given type is a void pointer type.

TypeDecl.isIterator(): bool

Returns whether the given type is an iterator type.

TypeDecl.isEnum(): bool

Returns whether the given type is an enumeration type.

TypeDecl.isEnumT(): bool

Returns whether the base type of the given type is an enumeration type.

TypeDecl.isHandle(): bool

Returns whether the given type is a handle type, representing a C++ type exposed to daslang via TypeAnnotation.

TypeDecl.isStructure(): bool

Returns whether the given type is a structure type.

TypeDecl.isClass(): bool

Returns whether the given type is a class type.

TypeDecl.isFunction(): bool

Returns whether the given type is a function type.

TypeDecl.isTuple(): bool

Returns whether the given type is a tuple type.

TypeDecl.isVariant(): bool

Returns whether the given type is a variant type.

TypeDecl.sizeOf(): int

Returns the size of the given type in bytes.

TypeDecl.countOf(): int

Returns the number of elements if the given type is a fixed array, otherwise returns 1.

TypeDecl.alignOf(): int

Returns the memory alignment requirement of the type in bytes.

TypeDecl.baseSizeOf(): int

Returns the size of the given type in bytes, excluding fixed array dimensions.

TypeDecl.stride(): int

Returns the stride size in bytes of an element in a fixed array type.

TypeDecl.tupleSize(): int

Returns the size of the given tuple type in bytes.

TypeDecl.tupleAlign(): int

Returns the alignment of the given tuple type in bytes.

TypeDecl.variantSize(): int

Returns the size of the given variant type in bytes.

TypeDecl.variantAlign(): int

Returns the alignment of the given variant type in bytes.

TypeDecl.canCopy(): bool

Returns whether the given type can be copied.

TypeDecl.canMove(): bool

Returns whether the given type can be moved.

TypeDecl.canClone(): bool

Returns whether the given type can be cloned.

TypeDecl.canCloneFromConst(): bool

Returns whether the given type can be cloned from a const instance.

TypeDecl.canNew(): bool

Returns whether the given type can be heap-allocated via the new operator.

TypeDecl.canDeletePtr(): bool

Returns whether the pointer to the given type can be deleted.

TypeDecl.canDelete(): bool

Returns whether the given type can be deleted.

TypeDecl.needDelete(): bool

Returns whether the given type requires explicit deletion.

TypeDecl.isPod(): bool

Returns whether the given type is a plain old data (POD) type.

TypeDecl.isRawPod(): bool

Returns whether the given type is a raw POD type containing no pointers or strings.

TypeDecl.isNoHeapType(): bool

Returns whether the given type can be used without heap allocation.

TypeDecl.isWorkhorseType(): bool

Returns whether the given type is a workhorse type, which is a built-in non-reference type.

TypeDecl.isPolicyType(): bool

Returns whether the given type is a policy type with SimNode implementations available for it.

TypeDecl.isVecPolicyType(): bool

Returns whether the given type is a vector policy type, which is any policy type other than string.

TypeDecl.isReturnType(): bool

Returns whether the given type can be used as a return type, which includes anything except block.

TypeDecl.isCtorType(): bool

Returns whether the given basic type is a constructor type that can be constructed via its type name, such as int(3.4).

TypeDecl.isRange(): bool

Returns whether the given type is a range type.

TypeDecl.isString(): bool

Returns whether the given type is a string type.

TypeDecl.isConst(): bool

Returns whether the given type is const-qualified.

TypeDecl.isFoldable(): bool

Returns whether the given type is foldable, such as integer or float, as opposed to pointer or array.

TypeDecl.isAlias(): bool

Returns whether the type definition contains an alias type.

TypeDecl.isAutoArrayResolved(): bool

Returns whether all fixed array dimensions are fully resolved with no auto or expression dimensions remaining.

TypeDecl.isAuto(): bool

Returns whether the type definition contains an auto type.

TypeDecl.isAutoOrAlias(): bool

Returns whether the type definition contains an auto or alias type.

TypeDecl.isVectorType(): bool

Returns whether the given type is a vector type such as int2, float3, or range64.

TypeDecl.isBitfield(): bool

Returns whether the given type is a bitfield type.

TypeDecl.isLocal(): bool

Returns whether the given type is a local type that can be allocated on the stack.

TypeDecl.hasClasses(): bool

Returns whether the type definition contains any class types.

TypeDecl.hasNonTrivialCtor(): bool

Returns whether the type definition contains any non-trivial constructors.

TypeDecl.hasNonTrivialDtor(): bool

Returns whether the type definition contains any non-trivial destructors.

TypeDecl.hasNonTrivialCopy(): bool

Returns whether the type definition contains any non-trivial copy operations.

TypeDecl.canBePlacedInContainer(): bool

Returns whether the given type can be placed in a container.

TypeDecl.vectorBaseType(): Type

Returns the scalar base type of a vector type, for example float for float4.

TypeDecl.vectorDim(): int

Returns the number of components in a vector type, for example 4 for float4.

TypeDecl.canInitWithZero(): bool

Returns whether the given type can be initialized by zeroing its memory.

TypeDecl.rangeBaseType(): Type

Returns the base type of a range type, for example int64 for range64.

TypeDecl.unsafeInit(): bool

Returns whether the given type requires initialization and skipping it would be unsafe.

TypeDecl.get_mnh(): uint64

Returns the mangled name hash of the given type.

Properties:
  • canAot : bool

  • isExprType : bool

  • isSimpleType : bool

  • isArray : bool

  • isGoodIteratorType : bool

  • isGoodArrayType : bool

  • isGoodTableType : bool

  • isGoodBlockType : bool

  • isGoodFunctionType : bool

  • isGoodLambdaType : bool

  • isGoodTupleType : bool

  • isGoodVariantType : bool

  • isVoid : bool

  • isAnyType : bool

  • isRef : bool

  • isRefType : bool

  • canWrite : bool

  • isAotAlias : bool

  • isShareable : bool

  • isIndex : bool

  • isBool : bool

  • isInteger : bool

  • isSignedInteger : bool

  • isUnsignedInteger : bool

  • isSignedIntegerOrIntVec : bool

  • isUnsignedIntegerOrIntVec : bool

  • isFloatOrDouble : bool

  • isNumeric : bool

  • isNumericComparable : bool

  • isPointer : bool

  • isSmartPointer : bool

  • isVoidPointer : bool

  • isIterator : bool

  • isEnum : bool

  • isEnumT : bool

  • isHandle : bool

  • isStructure : bool

  • isClass : bool

  • isFunction : bool

  • isTuple : bool

  • isVariant : bool

  • sizeOf : int

  • countOf : int

  • alignOf : int

  • baseSizeOf : int

  • stride : int

  • tupleSize : int

  • tupleAlign : int

  • variantSize : int

  • variantAlign : int

  • canCopy : bool

  • canMove : bool

  • canClone : bool

  • canCloneFromConst : bool

  • canNew : bool

  • canDeletePtr : bool

  • canDelete : bool

  • needDelete : bool

  • isPod : bool

  • isRawPod : bool

  • isNoHeapType : bool

  • isWorkhorseType : bool

  • isPolicyType : bool

  • isVecPolicyType : bool

  • isReturnType : bool

  • isCtorType : bool

  • isRange : bool

  • isString : bool

  • isConst : bool

  • isFoldable : bool

  • isAlias : bool

  • isAutoArrayResolved : bool

  • isAuto : bool

  • isAutoOrAlias : bool

  • isVectorType : bool

  • isBitfield : bool

  • isLocal : bool

  • hasClasses : bool

  • hasNonTrivialCtor : bool

  • hasNonTrivialDtor : bool

  • hasNonTrivialCopy : bool

  • canBePlacedInContainer : bool

  • vectorBaseType : Type

  • vectorDim : int

  • canInitWithZero : bool

  • rangeBaseType : Type

  • unsafeInit : bool

  • get_mnh : uint64

Any type declaration.

Fields:
  • baseType : Type - Basic declaration type

  • structType : Structure? - Structure type if baseType is Type::tStructure

  • enumType : Enumeration? - Enumeration type if baseType is Type::tEnumeration

  • annotation : TypeAnnotation? - Handled type if baseType is Type::tHandle

  • firstType : TypeDecl? - First type for compound types (like array<firstType> or table<firstType, secondType>)

  • secondType : TypeDecl? - Second type for compound types (like table<firstType, secondType>)

  • argTypes : vector<TypeDecl*> - Argument types for function types, tuples, variants, etc

  • argNames : vector<das_string> - Argument names for function types

  • dim : vector<int> - Dimensions for fixed array types

  • dimExpr : vector<Expression*> - Dimension expressions for fixed array types, when dimension is specified by expression

  • flags : TypeDeclFlags - Type declaration flags

  • alias : das_string - Alias name for typedefs, i.e. ‘int aka MyInt’ or ‘MyInt’

  • at : LineInfo - Location of the type declaration in the source code

  • _module : Module? - Module this type belongs to

ExprSetInsert

Set insert expression, i.e. tab |> insert(key).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the set-insert expression

  • arguments : vector<Expression*> - Arguments of the set-insert expression

  • argumentsFailedToInfer : bool - Whether the arguments failed to infer types

  • atEnclosure : LineInfo - Location of the enclosure where the set-insert is used

ExprKeyExists

Key exists expression (key_exists(tab,key))

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the key-exists expression

  • arguments : vector<Expression*> - Arguments of the key-exists expression

  • argumentsFailedToInfer : bool - Whether the arguments failed to infer types

  • atEnclosure : LineInfo - Location of the enclosure where the key-exists is used

ForLoopMacro

Adapter for the ‘AstForLoopMacro’.

Fields:
AstContext

Lexical context for the particular expression.

Fields:
  • func : Function? - Function this expression belongs to

  • _loop : vector<Expression*> - Loop stack

  • blocks : vector<Expression*> - Stack of active blocks

  • scopes : vector<Expression*> - Stack of active scopes

  • _with : vector<Expression*> - Stack of active ‘with’ expressions

Enumeration

Enumeration declaration.

Fields:
  • name : das_string - Name of the enumeration

  • cppName : das_string - C++ name of the enumeration

  • at : LineInfo - Location of the enumeration declaration in the source code

  • list : vector<EnumEntry> - List of entries in the enumeration

  • _module : Module? - Module this enumeration belongs to

  • external : bool - Whether this enumeration is external (defined on the C++ side)

  • baseType : Type - Enumeration underlying type (int8, int16, int, or int64)

  • annotations : AnnotationList - Annotations attached to this enumeration

  • isPrivate : bool - Is this enumeration private (not visible from outside the module)

ExprAscend

New expression for ExprMakeLocal (new [[Foo fld=val,…]] or new [[Foo() fld=…]], but NOT new Foo())

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • subexpr : Expression? - Subexpression being ascended (newed)

  • ascType : TypeDecl? - Type being made

  • stackTop : uint - Location on the stack where the temp object is created, if necessary

  • ascendFlags : ExprAscendFlags - Flags specific to ExprAscend expressions

ExprAssert

Assert expression (assert(x<13), or assert(x<13, “x is too big”), or verify(foo()!=0))

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the asserted expression

  • arguments : vector<Expression*> - Arguments of the assert expression

  • argumentsFailedToInfer : bool - Whether the arguments failed to infer types

  • atEnclosure : LineInfo - Location of the enclosure where the assert is used

  • isVerify : bool - Whether the assert is a verify expression (verify expressions have to have sideeffects, assert expressions cant)

ExprConstFloat3
ExprConstFloat3.getValue(): float3

Returns the constant value stored in this expression node.

Properties:
  • getValue : float3

Holds float3 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tFloat3)

  • value : float3 - Value of the constant expression

ExprConstBool
ExprConstBool.getValue(): bool

Returns the constant value stored in this expression node.

Properties:
  • getValue : bool

Holds bool constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tBool)

  • value : bool - Value of the constant expression

ExprWhile

While loop (while expr {your; block; here;})

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • cond : Expression? - The condition expression

  • body : Expression? - The body of the while loop

Expression

Any expression (base class).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

ExprMakeVariant

Make variant expression ([YourVariant variantName=expr1])

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • makeType : TypeDecl? - Type being made

  • stackTop : uint - Stack top offset for the data, if applicable

  • extraOffset : uint - Extra offset for the data, if applicable. If part of the larger initialization, extra offset is that

  • makeFlags : ExprMakeLocalFlags - Flags specific to make-local expressions

  • variants : vector<MakeFieldDecl*> - Array of variants being made

CallMacro

Adapter for the AstCallMacro.

Fields:
  • name : das_string - Name of the macro

  • _module : Module? - Module where the macro is defined

ExprConstUInt3
ExprConstUInt3.getValue(): uint3

Returns the constant value stored in this expression node.

Properties:
  • getValue : uint3

Holds uint3 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tUInt3)

  • value : uint3 - Value of the constant expression

ExprErase

Erase expression (erase(tab,key))

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the erase expression

  • arguments : vector<Expression*> - Arguments of the erase expression

  • argumentsFailedToInfer : bool - Whether the arguments failed to infer types

  • atEnclosure : LineInfo - Location of the enclosure where the erase is used

ExprConstFloat4
ExprConstFloat4.getValue(): float4

Returns the constant value stored in this expression node.

Properties:
  • getValue : float4

Holds float4 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tFloat4)

  • value : float4 - Value of the constant expression

ExprPtr2Ref

Pointer dereference (*expr or deref(expr)).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • subexpr : Expression? - Expression being dereferenced

  • unsafeDeref : bool - If true, skip runtime null-pointer check

  • assumeNoAlias : bool - If true, assume no aliasing occurs

VisitorAdapter

Adapter for the AstVisitor interface.

ExprSafeField

Safe field lookup (foo?.bar)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • value : Expression? - Subexpression whose field is being accessed

  • name : das_string - Name of the field being accessed

  • atField : LineInfo - Location of the field access in source code

  • fieldIndex : int - Index of the field in the type’s field list

  • annotation : TypeAnnotation? - Type annotation for the field

  • derefFlags : ExprFieldDerefFlags - Flags for dereferencing operations

  • fieldFlags : ExprFieldFieldFlags - Flags specific to field access expressions

  • skipQQ : bool - If true the subexpression is already a pointer and no additional dereference is needed

ExprConstInt2
ExprConstInt2.getValue(): int2

Returns the constant value stored in this expression node.

Properties:
  • getValue : int2

Holds int2 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tInt2)

  • value : int2 - Value of the constant expression

ExprCallFunc

Actual function call (func(expr1,…)).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the called function

  • arguments : vector<Expression*> - Arguments passed to the function

  • argumentsFailedToInfer : bool - Whether any arguments failed to infer their types

  • atEnclosure : LineInfo - Location of the expression in source code

  • func : Function? - Pointer to the function being called, if resolved

  • stackTop : uint - Stack top at the point of call, if temporary variable allocation is needed

BuiltInFunction

Bindings for the ‘BuiltInFunction’, which is used for the builtin (bound) functions in Daslang.

Fields:
  • annotations : AnnotationList - Annotations attached to this function

  • name : das_string - Name of the function

  • arguments : vector<Variable*> - Arguments of the function

  • result : TypeDecl? - Result type of the function

  • body : Expression? - Body expression of the function (null just about every time for the builtins)

  • index : int - Index of the function in the ‘Context’

  • totalStackSize : uint - Stack size required for this function

  • totalGenLabel : int - Number of generated labels in the jump table (for the generator)

  • at : LineInfo - Location of the function in the source code

  • atDecl : LineInfo - Location of the function declaration in the source code

  • _module : Module? - Module this function belongs to

  • classParent : Structure? - Parent structure if this is a method

  • flags : FunctionFlags - Function flags

  • moreFlags : MoreFunctionFlags - More function flags

  • sideEffectFlags : FunctionSideEffectFlags - Function side effect flags

  • inferStack : vector<InferHistory> - Inference history

  • fromGeneric : Function? - If this function was instantiated from a generic function, pointer to the generic function

  • hash : uint64 - Hash of the function signature

  • aotHash : uint64 - Hash of the function signature for AOT purposes

  • cppName : das_string - C++ function name.

ExprRef2Ptr

Addr expresion (addr(expr))

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • subexpr : Expression? - The sub-expression being converted from pointer to reference

ExprNamedCall

Named call (call([argname1=expr1, argname2=expr2])).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the named call

  • nonNamedArguments : vector<Expression*> - Non-named arguments passed to the call

  • arguments : MakeStruct? - Named arguments passed to the call

  • argumentsFailedToInfer : bool - Whether any arguments failed to infer their types

MakeFieldDecl

Part of ExprMakeStruct, declares single field (a = expr or a <- expr etc)

Fields:
  • at : LineInfo - Location of the expression in source code

  • name : das_string - Name of the field being assigned

  • value : Expression? - Initializer expression for the field

  • tag : Expression? - Tag associated with the field, if any

  • flags : MakeFieldDeclFlags - Flags specific to this field declaration

ExprOp1

Single operator expression (+a or -a or !a or ~a)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the operator (unused)

  • arguments : vector<Expression*> - Arguments of the operator (unused)

  • argumentsFailedToInfer : bool - Whether arguments failed to infer

  • atEnclosure : LineInfo - Location of the expression in source code

  • func : Function? - Function associated with the expression

  • stackTop : uint - Stack top position if temporary variable allocation is needed

  • op : das_string - Name of the operator

  • subexpr : Expression? - That one argument of the operator

ExprMakeArray

Make array expression ([[auto 1;2;3]] or [{auto “foo”;”bar”}] for static and dynamic arrays accordingly).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • makeType : TypeDecl? - Type being made

  • stackTop : uint - Stack top offset for the data, if applicable

  • extraOffset : uint - Extra offset for the data, if applicable. If part of the larger initialization, extra offset is that

  • makeFlags : ExprMakeLocalFlags - Flags specific to make-local expressions

  • recordType : TypeDecl? - Type of the array elements

  • values : vector<Expression*> - Array of expressions for the elements

  • gen2 : bool - If gen2 syntax is used (i.e. […] instead of [[…]])

ExprLooksLikeCall

Anything which looks like call (call(expr1,expr2)).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the call

  • arguments : vector<Expression*> - List of arguments passed to the call

  • argumentsFailedToInfer : bool - Whether any arguments failed to infer their types

  • atEnclosure : LineInfo - Location of the expression in source code

ExprInvoke
ExprInvoke.isCopyOrMove(): bool

Returns whether the given invoke expression requires a copy or move of a reference type.

Properties:
  • isCopyOrMove : bool

Invoke expression (invoke(fn) or invoke(lamb, arg1, arg2, …))

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the invoke expression

  • arguments : vector<Expression*> - Arguments of the invoke expression

  • argumentsFailedToInfer : bool - Whether the arguments failed to infer types

  • atEnclosure : LineInfo - Location of the enclosure where the invoke is used

  • stackTop : uint - Stack top for invoke, if applicable

  • doesNotNeedSp : bool - Does not need stack pointer

  • isInvokeMethod : bool - Is invoke of class method

  • cmresAlias : bool - If true, then CMRES aliasing is allowed for this invoke (and stack will be allocated)

ExprTypeInfo

typeinfo() expression (typeinfo dim(a), typeinfois_ref_type<int&>())

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • trait : das_string - The trait name

  • subexpr : Expression? - The expression being queried for type information

  • typeexpr : TypeDecl? - The type expression being queried for type information

  • subtrait : das_string - The sub-trait name

  • extratrait : das_string - The extra trait name

  • macro : TypeInfoMacro? - The macro associated with the typeinfo expression

InferHistory

Generic function infer history.

Fields:
  • at : LineInfo - Location of the function in the source code

  • func : Function? - Function being inferred

Structure
Structure.sizeOf(): int

Returns the size of the given type in bytes.

Properties:
  • sizeOf : int

Structure declaration.

Fields:
  • name : das_string - Name of the structure

  • fields : vector<FieldDeclaration> - Field declarations of the structure

  • at : LineInfo - Location of the structure declaration in the source code

  • _module : Module? - Module this structure belongs to

  • parent : Structure? - Parent structure, if any

  • annotations : AnnotationList - List of annotations attached to this structure

  • flags : StructureFlags - Structure flags

ExprSafeAsVariant

Safe as expression (foo? as bar)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • value : Expression? - Subexpression whose field is being accessed

  • name : das_string - Name of the field being accessed

  • atField : LineInfo - Location of the field access in source code

  • fieldIndex : int - Index of the field in the type’s field list

  • annotation : TypeAnnotation? - Type annotation for the field

  • derefFlags : ExprFieldDerefFlags - Flags for dereferencing operations

  • fieldFlags : ExprFieldFieldFlags - Flags specific to field access expressions

  • skipQQ : bool - If true the subexpression is already a pointer and no additional dereference is needed

FieldDeclaration

Structure field declaration.

Fields:
ExprDebug

Debug expression (debug(x) or debug(x,”x=”))

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the debug expression

  • arguments : vector<Expression*> - Arguments of the debug expression

  • argumentsFailedToInfer : bool - Whether the arguments failed to infer types

  • atEnclosure : LineInfo - Location of the enclosure where the debug is used

ExprFakeContext

Compilation time only fake context expression. Will simulate as current evaluation Context.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::fakeContext)

ExprTag

Compilation time only tag expression, used for reification. For example $c(….).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • subexpr : Expression? - The subexpression of the tag

  • value : Expression? - Value of the tag

  • name : das_string - Name of the tag

ExprBreak

Break expression (break)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

ExprMakeLocal

Any make expression (ExprMakeBlock, ExprMakeTuple, ExprMakeVariant, ExprMakeStruct)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • makeType : TypeDecl? - Type being made

  • stackTop : uint - Stack top offset for the data, if applicable

  • extraOffset : uint - Extra offset for the data, if applicable. If part of the larger initialization, extra offset is that

  • makeFlags : ExprMakeLocalFlags - Flags specific to make-local expressions

EnumerationAnnotation

Adapter for the AstEnumerationAnnotation.

ExprMemZero

Memzero (memzero(expr))

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the memzero call

  • arguments : vector<Expression*> - Arguments of the memzero call

  • argumentsFailedToInfer : bool - Whether the arguments failed to infer types

  • atEnclosure : LineInfo - Location of the enclosure where the memzero is used

ExprAssume

Assume expression (assume name = expr) or (typedef name = type).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • alias : das_string - The alias name for the assume expression

  • subexpr : Expression? - The expression being aliased, if specified

  • assumeType : TypeDecl? - The type being assumed, if specified

ExprGoto

Goto expression (goto label 13, goto x)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • labelName : int - Label to go to, if specified

  • subexpr : Expression? - Expression evaluating to label to go to, if specified

ExprConstString

Holds string constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tString)

  • value : das_string - Value of the constant expression

ExprCallMacro
Fields:
  • at : LineInfo - Compilation time only expression which holds temporary information for the AstCallMacro.

  • _type : TypeDecl? - Location of the expression in source code

  • __rtti : string - Type of the expression

  • genFlags : ExprGenFlags - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • flags : ExprFlags - Expression generation flags

  • printFlags : ExprPrintFlags - Expression flags

  • name : das_string - Expression print flags

  • arguments : vector<Expression*> - Name of the macro being called

  • argumentsFailedToInfer : bool - List of argument expressions

  • atEnclosure : LineInfo - If the arguments failed to infer their types

  • inFunction : Function? - Location of the expression in source code

  • macro : CallMacro? - Call macro, if resolved

TypeInfoMacro

Compilation time only structure which holds live information about typeinfo expression for the specific macro.

Fields:
  • name : das_string - The name of the macro

  • _module : Module? - The module where the macro is defined

ExprTypeDecl

typedecl() expression (typedecl(1+2))

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • typeexpr : TypeDecl? - The type expression being queried for type information

ExprClone

Clone operator (expr1 := expr2)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the call (unused)

  • arguments : vector<Expression*> - Arguments (unused)

  • argumentsFailedToInfer : bool - If arguments failed to infer their types

  • atEnclosure : LineInfo - Location of the expression in source code

  • func : Function? - Function being called, if resolved

  • stackTop : uint - Stack top at the point of call, if temporary variable allocation is needed

  • op : das_string - Name of the operator

  • left : Expression? - Left operand expression

  • right : Expression? - Right operand expression

CaptureMacro

Adapter for the AstCaptureMacro.

Fields:
PassMacro

Adapter for the AstPassMacro.

Fields:
ExprConstUInt
ExprConstUInt.getValue(): uint

Returns the constant value stored in this expression node.

Properties:
  • getValue : uint

Holds uint constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tUInt)

  • value : uint - Value of the constant expression

ExprConstEnumeration

Holds enumeration constant, both type and entry (Foo bar).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tEnumeration, Type::tEnumeration8, Type::tEnumeration16, or Type::tEnumeration64)

  • enumType : Enumeration? - Enumeration type declaration

  • value : das_string - Value of the constant expression

ExprConstUInt4
ExprConstUInt4.getValue(): uint4

Returns the constant value stored in this expression node.

Properties:
  • getValue : uint4

Holds uint4 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tUInt4)

  • value : uint4 - Value of the constant expression

ExprConstUInt8
ExprConstUInt8.getValue(): uint8

Returns the constant value stored in this expression node.

Properties:
  • getValue : uint8

Holds uint8 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tUInt8)

  • value : uint8 - Value of the constant expression

ExprConstUInt16
ExprConstUInt16.getValue(): uint16

Returns the constant value stored in this expression node.

Properties:
  • getValue : uint16

Holds uint16 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tUInt16)

  • value : uint16 - Value of the constant expression

ExternalFnBase

Base class for external function bindings. Bindings for the ‘BuiltInFunction’, which is used for the builtin (bound) functions in Daslang.

Fields:
  • annotations : AnnotationList - Annotations attached to this function

  • name : das_string - Name of the function

  • arguments : vector<Variable*> - Arguments of the function

  • result : TypeDecl? - Result type of the function

  • body : Expression? - Body expression of the function (null just about every time for the external functions)

  • index : int - Index of the function in the ‘Context’

  • totalStackSize : uint - Stack size required for this function

  • totalGenLabel : int - Number of generated labels in the jump table (for the generator)

  • at : LineInfo - Location of the function in the source code

  • atDecl : LineInfo - Location of the function declaration in the source code

  • _module : Module? - Module this function belongs to

  • classParent : Structure? - Parent structure if this is a method

  • flags : FunctionFlags - Function flags

  • moreFlags : MoreFunctionFlags - More function flags

  • sideEffectFlags : FunctionSideEffectFlags - Function side effect flags

  • inferStack : vector<InferHistory> - Inference history

  • fromGeneric : Function? - If this function was instantiated from a generic function, pointer to the generic function

  • hash : uint64 - Hash of the function signature

  • aotHash : uint64 - Hash of the function signature for AOT purposes

  • cppName : das_string - C++ function name.

ExprContinue

Continue expression (continue)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

ExprMove

Move operator (expr1 <- expr2)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the call (unused)

  • arguments : vector<Expression*> - Arguments (unused)

  • argumentsFailedToInfer : bool - If arguments failed to infer their types

  • atEnclosure : LineInfo - Location of the expression in source code

  • func : Function? - Function being called, if resolved

  • stackTop : uint - Stack top at the point of call, if temporary variable allocation is needed

  • op : das_string - Name of the operator

  • left : Expression? - Left operand expression

  • right : Expression? - Right operand expression

  • move_flags : MoveFlags - Flags specific to move operation

ExprFind

Find expression (find(tab,key) <| { your; block; here; })

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the find expression

  • arguments : vector<Expression*> - Arguments of the find expression

  • argumentsFailedToInfer : bool - Whether the arguments failed to infer types

  • atEnclosure : LineInfo - Location of the enclosure where the find is used

ExprSwizzle

Vector swizzle operation (vec.xxy or vec.y)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • value : Expression? - Value being swizzled

  • mask : das_string - Swizzle mask

  • fields : vector<uint8> - Swizzle fields

  • fieldFlags : ExprSwizzleFieldFlags - Flags specific to ExprSwizzle expressions

ExprTryCatch

Try-recover expression (try {your; block; here;} recover {your; recover; here;})

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • try_block : Expression? - The try block

  • catch_block : Expression? - The recover block

ModuleLibrary

Object which holds list of Module and provides access to them.

ExprArrayComprehension

Array comprehension ([for (x in 0..3); x], [iterator for (y in range(100)); x*2; where (x!=13)]] for arrays or generators accordingly).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • exprFor : Expression? - The ‘for’ expression

  • exprWhere : Expression? - The ‘where’ expression

  • subexpr : Expression? - The subexpression

  • generatorSyntax : bool - If generator syntax is used (i.e. [iterator for …] instead of [for])

  • tableSyntax : bool - If table syntax is used (i.e. {for …} instead of [for])

ExprAddr

Function address (@@foobarfunc or @@foobarfunc<(int;int):bool>)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • target : das_string - Name of the function being referenced

  • funcType : TypeDecl? - Type of the function being referenced

  • func : Function? - Function being referenced (if resolved)

ExprConst

Compilation time constant expression base class

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression

ExprOp3

Three operand operator (cond ? expr1 : expr2)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the call (unused)

  • arguments : vector<Expression*> - Arguments (unused)

  • argumentsFailedToInfer : bool - If arguments failed to infer their types

  • atEnclosure : LineInfo - Location of the expression in source code

  • func : Function? - Function being called, if resolved

  • stackTop : uint - Stack top at the point of call, if temporary variable allocation is needed

  • op : das_string - Name of the operator

  • subexpr : Expression? - Condition expression

  • left : Expression? - Left operand expression

  • right : Expression? - Right operand expression

ExprAsVariant

As expression (foo as bar)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • value : Expression? - Subexpression whose field is being accessed

  • name : das_string - Name of the field being accessed

  • atField : LineInfo - Location of the field access in source code

  • fieldIndex : int - Index of the field in the type’s field list

  • annotation : TypeAnnotation? - Type annotation for the field

  • derefFlags : ExprFieldDerefFlags - Flags for dereferencing operations

  • fieldFlags : ExprFieldFieldFlags - Flags specific to field access expressions

ExprIs

Is expression for variants and such (expr is Foo).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • subexpr : Expression? - Subexpression being checked

  • typeexpr : TypeDecl? - Type being checked against

ExprConstInt8
ExprConstInt8.getValue(): int8

Returns the constant value stored in this expression node.

Properties:
  • getValue : int8

Holds int8 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tInt8)

  • value : int8 - Value of the constant expression

ExprConstDouble
ExprConstDouble.getValue(): double

Returns the constant value stored in this expression node.

Properties:
  • getValue : double

Holds double constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tDouble)

  • value : double - Value of the constant expression

ExprDelete

Delete expression (delete blah)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • subexpr : Expression? - The expression being deleted

  • sizeexpr : Expression? - The size expression for deleting classes. This one determines how big instance is to be deleted.

  • native : bool - True if the delete is native, and not to be expanded at compilation time.

TypeMacro

Compilation time only structure which holds live information about type macro.

Fields:
ExprMakeStruct

Make structure expression ([[YourStruct v1=expr1elem1, v2=expr2elem1, …; v1=expr1elem2, … ]])

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • makeType : TypeDecl? - Type being made

  • stackTop : uint - Stack top offset for the data, if applicable

  • extraOffset : uint - Extra offset for the data, if applicable. If part of the larger initialization, extra offset is that

  • makeFlags : ExprMakeLocalFlags - Flags specific to make-local expressions

  • structs : vector<MakeStruct*> - Array of structures being made

  • _block : Expression? - Optional block expression to run after the struct is made

  • constructor : Function? - Constructor function to call, if any

  • makeStructFlags : ExprMakeStructFlags - Flags specific to make-struct expressions

ExprMakeTuple

Make tuple expression ([[auto f1,f2,f3]])

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • makeType : TypeDecl? - Type being made

  • stackTop : uint - Stack top offset for the data, if applicable

  • extraOffset : uint - Extra offset for the data, if applicable. If part of the larger initialization, extra offset is that

  • makeFlags : ExprMakeLocalFlags - Flags specific to make-local expressions

  • recordType : TypeDecl? - Type of the array elements

  • values : vector<Expression*> - Array of expressions for the elements

  • gen2 : bool - If gen2 syntax is used (i.e. […] instead of [[…]])

  • isKeyValue : bool - If key-value syntax is used (i.e. [key=>val; key2=>val2])

ExprWith

With section (with expr {your; block; here}).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • _with : Expression? - The expression to be used as the context for the with block

  • body : Expression? - The body of the with block

CaptureEntry

Single entry in lambda capture.

Fields:
  • name : das_string - Name of the captured variable

  • mode : CaptureMode - How the variable is captured (by value, by reference, etc.)

ExprOp

Compilation time only base class for any operator.

ExprCopy

Copy operator (expr1 = expr2)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the call (unused)

  • arguments : vector<Expression*> - Arguments (unused)

  • argumentsFailedToInfer : bool - If arguments failed to infer their types

  • atEnclosure : LineInfo - Location of the expression in source code

  • func : Function? - Function being called, if resolved

  • stackTop : uint - Stack top at the point of call, if temporary variable allocation is needed

  • op : das_string - Name of the operator

  • left : Expression? - Left operand expression

  • right : Expression? - Right operand expression

  • copy_flags : CopyFlags - Flags specific to copy operation

ExprConstInt
ExprConstInt.getValue(): int

Returns the constant value stored in this expression node.

Properties:
  • getValue : int

Holds int constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tInt)

  • value : int - Value of the constant expression

ExprOp2

Two operand operator (expr1 + expr2)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the call (unused)

  • arguments : vector<Expression*> - Arguments (unused)

  • argumentsFailedToInfer : bool - If arguments failed to infer their types

  • atEnclosure : LineInfo - Location of the expression in source code

  • func : Function? - Function being called, if resolved

  • stackTop : uint - Stack top at the point of call, if temporary variable allocation is needed

  • op : das_string - Name of the operator

  • left : Expression? - Left operand expression

  • right : Expression? - Right operand expression

CommentReader

Adapter for the AstCommentReader.

Function
Function.origin(): Function?

Returns the origin function, indicating which generic function this was instantiated from, if any.

Function.getMangledNameHash(): uint64

Returns the mangled name hash of the given function.

Function.isGeneric(): bool

Returns whether the given function is a generic function.

Properties:
  • origin : Function?

  • getMangledNameHash : uint64

  • isGeneric : bool

Function declaration.

Fields:
  • annotations : AnnotationList - Annotations attached to this function

  • name : das_string - Name of the function

  • arguments : vector<Variable*> - Arguments of the function

  • result : TypeDecl? - Result type of the function

  • body : Expression? - Body expression of the function (usually ‘ExprBlock’ but can be optimized out on later stages)

  • index : int - Index of the function in the ‘Context’

  • totalStackSize : uint - Stack size required for this function

  • totalGenLabel : int - Number of generated labels in the jump table (for the generator)

  • at : LineInfo - Location of the function in the source code

  • atDecl : LineInfo - Location of the function declaration in the source code

  • _module : Module? - Module this function belongs to

  • classParent : Structure? - Parent structure if this is a method

  • flags : FunctionFlags - Function flags

  • moreFlags : MoreFunctionFlags - More function flags

  • sideEffectFlags : FunctionSideEffectFlags - Function side effect flags

  • inferStack : vector<InferHistory> - Inference history

  • fromGeneric : Function? - If this function was instantiated from a generic function, pointer to the generic function

  • hash : uint64 - Hash of the function signature

  • aotHash : uint64 - Hash of the function signature for AOT purposes

ExprReader

Compilation time only expression which holds temporary information for the AstReaderMacro.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • macro : ReaderMacro? - Macro which is attached to the context parser.

  • sequence : das_string - Sequence of characters being read.

ExprConstInt64
ExprConstInt64.getValue(): int64

Returns the constant value stored in this expression node.

Properties:
  • getValue : int64

Holds int64 constant.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::tInt64)

  • value : int64 - Value of the constant expression

ExprReturn

Return expression (return or return foo, or return <- foo)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • subexpr : Expression? - The expression being returned (if any)

  • returnFlags : ExprReturnFlags - Return flags

  • stackTop : uint - Stack top position if temporary variable allocation is needed

  • refStackTop : uint - Reference stack top position if temporary variable allocation is needed

  • returnFunc : Function? - Function associated with the return expression

  • _block : ExprBlock? - Block associated with the return expression

ExprMakeBlock

Any closure. Holds block as well as capture information in CaptureEntry.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • _capture : vector<CaptureEntry> - List of captured variables

  • _block : Expression? - The block expression

  • stackTop : uint - Stack top for the block

  • mmFlags : ExprMakeBlockFlags - Expression generation flags

  • aotFunctorName : das_string - Name of the AOT functor (if applicable)

ReaderMacro

Adapter for the AstReaderMacro.

Fields:
  • name : das_string - Name of the macro

  • _module : Module? - Module where the macro is defined

EnumEntry

Entry in the enumeration.

Fields:
  • name : das_string - Name of the enumeration entry

  • cppName : das_string - C++ name of the enumeration entry

  • at : LineInfo - Location of the enumeration entry in the source code

  • value : Expression? - Value of the enumeration entry (typicall ‘ExprConst’ derivative)

ExprIsVariant

Is expression (foo is bar)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • value : Expression? - Subexpression whose field is being accessed

  • name : das_string - Name of the field being accessed

  • atField : LineInfo - Location of the field access in source code

  • fieldIndex : int - Index of the field in the type’s field list

  • annotation : TypeAnnotation? - Type annotation for the field

  • derefFlags : ExprFieldDerefFlags - Flags for dereferencing operations

  • fieldFlags : ExprFieldFieldFlags - Flags specific to field access expressions

ExprRef2Value

Compilation time only structure which holds reference to value conversion for the value types, i.e. goes from int& to int and such.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • subexpr : Expression? - The sub-expression being converted from reference to value

ExprAt

Index lookup (expr[expr1]).

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • subexpr : Expression? - Subexpression being indexed

  • index : Expression? - Index expression

  • atFlags : ExprAtFlags - Flags specific to ExprAt expressions

ExprStaticAssert

Static assert expression (static_assert(x<13) or static_assert(x<13, “x is too big”))

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the static_assert expression

  • arguments : vector<Expression*> - Arguments of the static_assert expression

  • argumentsFailedToInfer : bool - Whether the arguments failed to infer types

  • atEnclosure : LineInfo - Location of the enclosure where the static_assert is used

ExprFakeLineInfo
ExprFakeLineInfo.getValue(): void?

Returns the constant value stored in this expression node.

Properties:
  • getValue : void?

Compilation time only fake lineinfo expression. Will simulate as current file and line LineInfo.

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • baseType : Type - Base type of the constant expression (Type::fakeLineInfo)

  • value : void? - Pointer to the LineInfo, as void?

ExprNew

New expression (new Foo, new Bar(expr1..), but NOT new [[Foo …]])

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • name : das_string - Name of the new expression

  • arguments : vector<Expression*> - List of arguments passed to the constructor

  • argumentsFailedToInfer : bool - Whether any arguments failed to infer their types

  • atEnclosure : LineInfo - Location of the expression in source code

  • func : Function? - Pointer to the constructor function being called, if resolved

  • stackTop : uint - Stack top at the point of call, if temporary variable allocation is needed

  • typeexpr : TypeDecl? - Type expression for the type being constructed

  • initializer : bool - Whether there is an initializer for the new expression, or it’s just default construction

FunctionAnnotation

Adapter for the AstFunctionAnnotation.

SimulateMacro

Adapter for the AstSimulateMacro.

Fields:
ExprField
ExprField.field(): FieldDeclaration?

Returns a pointer to the named field of a structure, or null if the field does not exist or the type is not a structure.

Properties:

Field lookup (foo.bar)

Fields:
  • at : LineInfo - Location of the expression in source code

  • _type : TypeDecl? - Type of the expression

  • __rtti : string - Runtime type information of the class of the expression (i.e “ExprConstant”, “ExprCall”, etc)

  • genFlags : ExprGenFlags - Expression generation flags

  • flags : ExprFlags - Expression flags

  • printFlags : ExprPrintFlags - Expression print flags

  • value : Expression? - Subexpression whose field is being accessed

  • name : das_string - Name of the field being accessed

  • atField : LineInfo - Location of the field access in source code

  • fieldIndex : int - Index of the field in the type’s field list

  • annotation : TypeAnnotation? - Type annotation for the field

  • derefFlags : ExprFieldDerefFlags - Flags for dereferencing operations

  • fieldFlags : ExprFieldFieldFlags - Flags specific to field access expressions

10.2.4. Call macros

quote

Returns the AST expression tree of the provided code without evaluating or type-inferring it. Used in macro programming to capture source code as a manipulable AST.

10.2.5. Typeinfo macros

ast_typedecl

Returns a TypeDeclPtr for the type specified via type<> or subexpression type, for example typeinfo ast_typedecl(type<int?>). Useful in macros that need compile-time access to type declarations.

ast_function

Returns a FunctionPtr to the function specified by the subexpression, for example typeinfo ast_function(@@foo). Useful in macros that need compile-time access to function declarations.

10.2.6. Handled types

MakeStruct

Annotation representing a vector of MakeFieldDecl used to initialize fields in ExprMakeStruct expressions.

10.2.7. Classes

AstFunctionAnnotation

class AstFunctionAnnotation

AstBlockAnnotation

class AstBlockAnnotation

AstStructureAnnotation

class AstStructureAnnotation

AstPassMacro

class AstPassMacro

AstVariantMacro

class AstVariantMacro

AstForLoopMacro

class AstForLoopMacro

AstCaptureMacro

class AstCaptureMacro

AstTypeMacro

class AstTypeMacro

AstSimulateMacro

class AstSimulateMacro

AstReaderMacro

class AstReaderMacro

AstCommentReader

class AstCommentReader

AstCallMacro

class AstCallMacro

AstTypeInfoMacro

class AstTypeInfoMacro

AstEnumerationAnnotation

class AstEnumerationAnnotation

AstVisitor

class AstVisitor

10.2.8. Call generation

make_call(at: LineInfo; name: string): Expression?

Creates the appropriate call expression for a given function name in the program.

Arguments:
  • at : LineInfo implicit

  • name : string implicit

10.2.9. Visitor pattern

10.2.9.1. visit

visit(program: smart_ptr<Program>; adapter: VisitorAdapter?; sortStructures: bool)

Visit the program with the given visitor adapter. When sortStructures is true, struct declarations are visited in topological (dependency) order, ensuring that structs used by value in fields are visited before the structs that contain them.

Arguments:
visit(program: smart_ptr<Program>; adapter: VisitorAdapter?)
visit(expression: Expression?; adapter: VisitorAdapter?): Expression?
visit(function: Function?; adapter: VisitorAdapter?)
visit(expression: TypeDecl?; adapter: VisitorAdapter?): TypeDecl?

visit_enumeration(program: smart_ptr<Program>; enumeration: Enumeration?; adapter: VisitorAdapter?)

Applies the given visitor adapter to the specified enumeration within the context of the program, triggering the appropriate visitor callbacks.

Arguments:
visit_finally(expression: ExprBlock?; adapter: VisitorAdapter?)

Invokes the visitor on the finally section of a block.

Arguments:
visit_module(program: smart_ptr<Program>; adapter: VisitorAdapter?; module: Module?)

Invokes an AST visitor on the given module.

Arguments:
visit_modules(program: smart_ptr<Program>; adapter: VisitorAdapter?)

Invokes an AST visitor on all modules in the specified program.

Arguments:
visit_structure(program: smart_ptr<Program>; structure: Structure?; adapter: VisitorAdapter?)

Applies the given visitor adapter to the specified structure within the context of the program, triggering the appropriate visitor callbacks.

Arguments:
visit_with_generics(program: smart_ptr<Program>; adapter: VisitorAdapter?)

Visits the program AST including generic function instantiations. Unlike visit, which only walks non-generic functions, this also visits each instantiated generic, making it suitable for lint passes that need to check generated code.

Arguments:

10.2.10. Expression generation

10.2.10.1. force_generated

force_generated(function: Function?; value: bool)

Sets or clears the generated flag on the specified function and all expressions within its body. Generated functions are treated as compiler-produced rather than user-written.

Arguments:
  • function : Function? implicit

  • value : bool

force_generated(expression: Expression?; value: bool)

get_expression_annotation(expr: Expression?): Annotation?

Returns the Annotation associated with an Expression or its inherited types.

Arguments:
make_type_info_structure(ctx: Context; type: TypeDecl?): TypeInfo?

Returns a new TypeInfo corresponding to the specified type.

Arguments:

10.2.11. Adapter generation

10.2.11.1. make_block_annotation

make_block_annotation(name: string; someClassPtr: auto): FunctionAnnotationPtr

def make_block_annotation (name: string; var someClassPtr: auto) : FunctionAnnotationPtr

Arguments:
  • name : string

  • someClassPtr : auto

make_block_annotation(name: string; class: void?; info: StructInfo const?): FunctionAnnotation?

make_block_type(blk: ExprBlock?): TypeDecl?

Generates a TypeDeclPtr for a specified block or lambda type.

Arguments:

10.2.11.2. make_call_macro

make_call_macro(name: string; class: void?; info: StructInfo const?): CallMacro?

Creates an adapter for the AstCallMacro interface.

Arguments:
  • name : string implicit

  • class : void? implicit

  • info : StructInfo? implicit

make_call_macro(name: string; someClassPtr: auto): CallMacroPtr

10.2.11.3. make_capture_macro

make_capture_macro(name: string; class: void?; info: StructInfo const?): CaptureMacro?

Creates an adapter for the AstCaptureMacro interface.

Arguments:
  • name : string implicit

  • class : void? implicit

  • info : StructInfo? implicit

make_capture_macro(name: string; someClassPtr: auto): CaptureMacroPtr

make_clone_structure(structure: Structure?): Function?

Generates a clone function for the given structure.

Arguments:

10.2.11.4. make_comment_reader

make_comment_reader(class: void?; info: StructInfo const?): CommentReader?

Creates an adapter for the AstCommentReader interface.

Arguments:
  • class : void? implicit

  • info : StructInfo? implicit

make_comment_reader(name: string; someClassPtr: auto): CommentReaderPtr

make_enum_debug_info(helper: DebugInfoHelper?; en: Enumeration const?): EnumInfo?

Generates an EnumInfo for the specified enumeration using the given DebugInfoHelper.

Arguments:

10.2.11.5. make_enumeration_annotation

make_enumeration_annotation(name: string; someClassPtr: auto): EnumerationAnnotationPtr

def make_enumeration_annotation (name: string; var someClassPtr: auto) : EnumerationAnnotationPtr

Arguments:
  • name : string

  • someClassPtr : auto

make_enumeration_annotation(name: string; class: void?; info: StructInfo const?): EnumerationAnnotation?

10.2.11.6. make_for_loop_macro

make_for_loop_macro(name: string; class: void?; info: StructInfo const?): ForLoopMacro?

Creates an adapter for the AstForLoopMacro interface.

Arguments:
  • name : string implicit

  • class : void? implicit

  • info : StructInfo? implicit

make_for_loop_macro(name: string; someClassPtr: auto): ForLoopMacroPtr

10.2.11.7. make_function_annotation

make_function_annotation(name: string; someClassPtr: auto): FunctionAnnotationPtr

def make_function_annotation (name: string; var someClassPtr: auto) : FunctionAnnotationPtr

Arguments:
  • name : string

  • someClassPtr : auto

make_function_annotation(name: string; class: void?; info: StructInfo const?): FunctionAnnotation?

make_function_debug_info(helper: DebugInfoHelper?; fn: Function const?): FuncInfo?

Generates a FuncInfo for the specified function using the given DebugInfoHelper.

Arguments:
make_invokable_type_debug_info(helper: DebugInfoHelper?; blk: TypeDecl?; at: LineInfo): FuncInfo?

Generates a FuncInfo for an invokable type such as a lambda or block using the given DebugInfoHelper.

Arguments:

10.2.11.8. make_pass_macro

make_pass_macro(name: string; class: void?; info: StructInfo const?): PassMacro?

Creates an adapter for the AstPassMacro interface.

Arguments:
  • name : string implicit

  • class : void? implicit

  • info : StructInfo? implicit

make_pass_macro(name: string; someClassPtr: auto): PassMacroPtr

10.2.11.9. make_reader_macro

make_reader_macro(name: string; someClassPtr: auto): ReaderMacroPtr

def make_reader_macro (name: string; var someClassPtr: auto) : ReaderMacroPtr

Arguments:
  • name : string

  • someClassPtr : auto

make_reader_macro(name: string; class: void?; info: StructInfo const?): ReaderMacro?

10.2.11.10. make_simulate_macro

make_simulate_macro(name: string; someClassPtr: auto): SimulateMacroPtr

def make_simulate_macro (name: string; var someClassPtr: auto) : SimulateMacroPtr

Arguments:
  • name : string

  • someClassPtr : auto

make_simulate_macro(name: string; class: void?; info: StructInfo const?): SimulateMacro?

make_struct_debug_info(helper: DebugInfoHelper?; st: Structure const?): StructInfo?

Generates a StructInfo for the specified structure using the given DebugInfoHelper.

Arguments:
make_struct_variable_debug_info(helper: DebugInfoHelper?; st: Structure const?; var: FieldDeclaration const?): VarInfo?

Generates a VariableInfo for a structure field using the given DebugInfoHelper.

Arguments:

10.2.11.11. make_structure_annotation

make_structure_annotation(name: string; someClassPtr: auto): StructureAnnotationPtr

def make_structure_annotation (name: string; var someClassPtr: auto) : StructureAnnotationPtr

Arguments:
  • name : string

  • someClassPtr : auto

make_structure_annotation(name: string; class: void?; info: StructInfo const?): StructureAnnotation?

make_type_info(helper: DebugInfoHelper?; info: TypeInfo?; type: TypeDecl? const&): TypeInfo?

Generates a TypeInfo for the specified type using the given DebugInfoHelper.

Arguments:

10.2.11.12. make_type_macro

make_type_macro(name: string; someClassPtr: auto): TypeMacroPtr

def make_type_macro (name: string; var someClassPtr: auto) : TypeMacroPtr

Arguments:
  • name : string

  • someClassPtr : auto

make_type_macro(name: string; class: void?; info: StructInfo const?): TypeMacro?

10.2.11.13. make_typeinfo_macro

make_typeinfo_macro(name: string; class: void?; info: StructInfo const?): TypeInfoMacro?

Creates an adapter for the AstTypeInfoMacro interface.

Arguments:
  • name : string implicit

  • class : void? implicit

  • info : StructInfo? implicit

make_typeinfo_macro(name: string; someClassPtr: auto): TypeInfoMacroPtr

make_variable_debug_info(helper: DebugInfoHelper?; var: Variable?): VarInfo?

Generates a VariableInfo for the specified variable using the given DebugInfoHelper.

Arguments:

10.2.11.14. make_variant_macro

make_variant_macro(name: string; someClassPtr: auto): VariantMacroPtr

def make_variant_macro (name: string; var someClassPtr: auto) : VariantMacroPtr

Arguments:
  • name : string

  • someClassPtr : auto

make_variant_macro(name: string; class: void?; info: StructInfo const?): VariantMacro?

10.2.11.15. make_visitor

make_visitor(someClass: auto; blk: block<(var adapter:VisitorAdapter?):void>): auto

def make_visitor (someClass: auto; blk: block<(var adapter:VisitorAdapter?):void>) : auto

Arguments:
make_visitor(class: void?; info: StructInfo const?; blk: block<(VisitorAdapter?):void>)

10.2.12. Adapter application

10.2.12.1. add_block_annotation

add_block_annotation(block: ExprBlock?; annotation: FunctionAnnotation?&)

Attaches a function annotation to an expression block.

Arguments:
add_block_annotation(block: ExprBlock?; annotation: AnnotationDeclaration?&)

add_call_macro(module: Module?; annotation: CallMacro?)

Adds an AstCallMacro adapter to the specified module.

Arguments:
add_capture_macro(module: Module?; annotation: CaptureMacro?)

Adds an AstCaptureMacro to the specified module.

Arguments:
add_comment_reader(module: Module?; reader: CommentReader?)

Adds an AstCommentReader adapter to the specified module.

Arguments:
add_dirty_infer_macro(module: Module?; annotation: PassMacro?)

Adds an AstPassMacro adapter to the dirty inference pass.

Arguments:
add_enumeration_annotation(module: Module?; annotation: EnumerationAnnotation?&)

Registers an enumeration annotation with the given module.

Arguments:
add_for_loop_macro(module: Module?; annotation: ForLoopMacro?)

Adds an AstForLoopMacro to the specified module.

Arguments:

10.2.12.2. add_function_annotation

add_function_annotation(function: Function?; annotation: FunctionAnnotation?&)

Attaches a function annotation to a function and calls the annotation’s apply method.

Arguments:
add_function_annotation(module: Module?; annotation: FunctionAnnotation?&)
add_function_annotation(function: Function?; annotation: AnnotationDeclaration?&)

add_global_lint_macro(module: Module?; annotation: PassMacro?)

Adds an AstPassMacro adapter to the global lint pass.

Arguments:
add_infer_macro(module: Module?; annotation: PassMacro?)

Adds an AstPassMacro adapter to the type inference pass.

Arguments:
add_lint_macro(module: Module?; annotation: PassMacro?)

Adds an AstPassMacro adapter to the lint pass of the current module.

Arguments:
add_module_option(module: Module?; option: string; type: Type)

Adds a module-specific option accessible via the options keyword.

Arguments:
  • module : Module? implicit

  • option : string implicit

  • type : Type

add_new_block_annotation(name: string; someClassPtr: auto): auto

def add_new_block_annotation (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_call_macro(name: string; someClassPtr: auto): auto

def add_new_call_macro (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_capture_macro(name: string; someClassPtr: auto): auto

def add_new_capture_macro (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_comment_reader(name: string; someClassPtr: auto): auto

def add_new_comment_reader (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_contract_annotation(name: string; someClassPtr: auto): auto

def add_new_contract_annotation (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_dirty_infer_macro(name: string; someClassPtr: auto): auto

def add_new_dirty_infer_macro (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_enumeration_annotation(name: string; someClassPtr: auto): auto

def add_new_enumeration_annotation (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_for_loop_macro(name: string; someClassPtr: auto): auto

def add_new_for_loop_macro (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_function_annotation(name: string; someClassPtr: auto): auto

def add_new_function_annotation (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_global_lint_macro(name: string; someClassPtr: auto): auto

def add_new_global_lint_macro (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_infer_macro(name: string; someClassPtr: auto): auto

def add_new_infer_macro (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_lint_macro(name: string; someClassPtr: auto): auto

def add_new_lint_macro (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_optimization_macro(name: string; someClassPtr: auto): auto

def add_new_optimization_macro (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_reader_macro(name: string; someClassPtr: auto): auto

def add_new_reader_macro (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_simulate_macro(name: string; someClassPtr: auto): auto

def add_new_simulate_macro (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_structure_annotation(name: string; someClassPtr: auto): auto

def add_new_structure_annotation (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_type_macro(name: string; someClassPtr: auto): auto

def add_new_type_macro (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_typeinfo_macro(name: string; someClassPtr: auto): auto

def add_new_typeinfo_macro (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_new_variant_macro(name: string; someClassPtr: auto): auto

def add_new_variant_macro (name: string; var someClassPtr: auto) : auto

Arguments:
  • name : string

  • someClassPtr : auto

add_optimization_macro(module: Module?; annotation: PassMacro?)

Adds an AstPassMacro adapter to the optimization pass of a specific module.

Arguments:
add_reader_macro(module: Module?; annotation: ReaderMacro?)

Adds an AstReaderMacro adapter to the specified module.

Arguments:
add_simulate_macro(module: Module?; annotation: SimulateMacro?)

Adds an AstSimulateMacro adapter to the specified module.

Arguments:

10.2.12.3. add_structure_annotation

add_structure_annotation(structure: Structure?; annotation: StructureAnnotation?&)

Attaches a structure annotation to a structure and calls the annotation’s touch method.

Arguments:
add_structure_annotation(module: Module?; annotation: StructureAnnotation?&)
add_structure_annotation(structure: Structure?; annotation: AnnotationDeclaration?&)

add_type_macro(module: Module?; annotation: TypeMacro?)

Adds an AstTypeMacro adapter to the specified module.

Arguments:
add_typeinfo_macro(module: Module?; annotation: TypeInfoMacro?)

Adds an AstTypeInfoMacro adapter to the specified module.

Arguments:
add_variant_macro(module: Module?; annotation: VariantMacro?)

Adds an AstVariantMacro adapter to the specified module.

Arguments:

10.2.13. Adding objects to objects

add_alias(module: Module?; structure: TypeDecl?&): bool

Adds a type alias to the specified module.

Arguments:
add_enumeration_entry(enum: Enumeration?; name: string): int

Adds a new entry with the given name to the specified enumeration. Returns the integer value assigned to the new entry.

Arguments:
add_function(module: Module?; function: Function?&): bool

Adds a function to the specified module. Returns true if the function was added successfully, or false if a conflicting function already exists.

Arguments:
add_generic(module: Module?; function: Function?&): bool

Adds a generic (template) function to the specified module. Returns true if the generic was added successfully, or false if a conflicting generic already exists.

Arguments:
add_keyword(module: Module?; keyword: string; needOxfordComma: bool): bool

Registers a new keyword in the specified module, making it available to the parser.

Arguments:
  • module : Module? implicit

  • keyword : string implicit

  • needOxfordComma : bool

add_module_require(module: Module?; publicModule: Module?; pub: bool): bool

Adds module dependencies, similar to the require keyword.

Arguments:
  • module : Module? implicit

  • publicModule : Module? implicit

  • pub : bool

add_ptr_ref(expression: Expression?): Expression?

Wraps an expression in a pointer-to-reference (r2v) conversion node if needed.

Arguments:
add_structure(module: Module?; structure: Structure?&): bool

Adds a structure definition to the specified module. Returns true if the structure was added successfully, or false if a structure with the same name already exists.

Arguments:
add_structure_alias(structure: Structure?; aliasName: string; alias: TypeDecl? const&): bool

Adds a typedef alias to a structure type in the AST, equivalent to a typedef in the structure body.

Arguments:
  • structure : Structure? implicit

  • aliasName : string implicit

  • alias : TypeDecl?& implicit

add_type_function(module: Module?; keyword: string): bool

Adds a type function keyword, allowing function calls to accept type arguments before regular arguments via the some_call<type_args>(regular_args) syntax.

Arguments:
  • module : Module? implicit

  • keyword : string implicit

add_variable(module: Module?; variable: Variable?&): bool

Adds a global variable to the specified module. Returns true if the variable was added successfully, or false if a variable with the same name already exists.

Arguments:

10.2.14. Program and module access

compiling_module(): Module?

Returns the module currently being compiled.

compiling_program(): smart_ptr<Program>

Returns the program currently being compiled.

this_module(): Module?

Returns the main module attached to the current context, throwing an error if RTTI is disabled.

this_program(): smart_ptr<Program>

Returns the program attached to the current context, or null if RTTI is disabled.

10.2.15. Textual descriptions of the objects

das_to_string(type: Type): string

Returns the name of the corresponding daslang base type as a string.

Arguments:

10.2.15.1. describe

describe(expr: FunctionPtr): auto

def describe (expr: FunctionPtr) : auto

Arguments:
describe(prog: smart_ptr<Program>): auto
describe(expr: Expression?): auto
describe(decl: TypeDecl?; extra: bool = true; contracts: bool = true; modules: bool = true): auto

describe_cpp(decl: TypeDecl?; substitureRef: bool = false; skipRef: bool = false; skipConst: bool = false; redundantConst: bool = true; chooseSmartPtr: bool = true): auto

def describe_cpp (decl: TypeDecl?; substitureRef: bool = false; skipRef: bool = false; skipConst: bool = false; redundantConst: bool = true; chooseSmartPtr: bool = true) : auto

Arguments:
  • decl : TypeDecl?

  • substitureRef : bool

  • skipRef : bool

  • skipConst : bool

  • redundantConst : bool

  • chooseSmartPtr : bool

describe_expression(expression: Expression?): string

Returns a string description of the Expression matching the corresponding daslang source code.

Arguments:
describe_function(function: Function?): string

Returns a human-readable string description of the specified function, including its name, arguments, and return type.

Arguments:
describe_program(program: smart_ptr<Program>): string

Returns a textual representation of the entire compiled program, equivalent to the output produced by options log. Includes all types, globals, and functions after macro expansion, template instantiation, and type inference.

Arguments:
  • program : smart_ptr< Program> implicit

describe_typedecl(type: TypeDecl?; extra: bool; contracts: bool; module: bool): string

Returns a string description of the TypeDecl matching the corresponding daslang type declaration.

Arguments:
  • type : TypeDecl? implicit

  • extra : bool

  • contracts : bool

  • module : bool

describe_typedecl_cpp(type: TypeDecl?; substitueRef: bool; skipRef: bool; skipConst: bool; redundantConst: bool; choose_smart_ptr: bool): string

Returns a string description of the TypeDecl matching the corresponding C++ type declaration.

Arguments:
  • type : TypeDecl? implicit

  • substitueRef : bool

  • skipRef : bool

  • skipConst : bool

  • redundantConst : bool

  • choose_smart_ptr : bool

10.2.16. Searching

find_bitfield_name(bit: TypeDecl?; value: bitfield): string

Finds the name of a bitfield value in the specified type.

Arguments:
  • bit : TypeDecl? implicit

  • value : bitfield<>

find_call_macro(module: Module?; name: string): CallMacro?

Finds a CallMacro by name in the specified module.

Arguments:
  • module : Module? implicit

  • name : string implicit

find_compiling_function_by_mangled_name_hash(moduleName: string; mangledNameHash: uint64): Function?

Returns a Function from the currently compiling program given its mangled name hash.

Arguments:
  • moduleName : string implicit

  • mangledNameHash : uint64

find_compiling_module(name: string): Module?

def find_compiling_module (name: string) : Module?

Arguments:
  • name : string

find_enum_name(enum: Enumeration?; value: int64): string

Finds the name corresponding to an enumeration value in the specified type.

Arguments:
find_enum_value(enum: Enumeration?; value: string): int64

Finds the integer value corresponding to an enumeration name in the specified type.

Arguments:
find_matching_variable(program: Program?; function: Function?; name: string; seePrivate: bool; block: block<(array<Variable?>#):void>)

Searches the program for global variables matching the given name that are visible from the specified function’s scope. The matching variables are passed to the provided block as a temporary array.

Arguments:
  • program : Program? implicit

  • function : Function? implicit

  • name : string implicit

  • seePrivate : bool

  • block : block<(array< Variable?>#):void> implicit

10.2.16.1. find_module

find_module(prog: smart_ptr<Program>; name: string): Module?

def find_module (prog: smart_ptr<Program>; name: string) : Module?

Arguments:
  • prog : smart_ptr< Program>

  • name : string

find_module(name: string): Module?

find_module_function_via_rtti(module: Module?; function: function<():void>): Function?

Finds a function by name in the specified module using RTTI.

Arguments:
  • module : Module? implicit

  • function : function<void>

find_module_via_rtti(program: smart_ptr<Program>; name: string): Module?

Finds a module by name in the specified program using RTTI.

Arguments:
  • program : smart_ptr< Program> implicit

  • name : string implicit

find_struct_field_parent(structure: Structure?; name: string): Structure const?

Finds and returns the parent structure in the inheritance chain that originally declares the field with the given name. Returns null if the field is not found.

Arguments:
  • structure : Structure? implicit

  • name : string implicit

find_structure_field(structPtr: Structure?; field: string): FieldDeclaration?

Returns the FieldDeclaration for a specific field of a structure type, or null if not found.

Arguments:
  • structPtr : Structure? implicit

  • field : string implicit

find_unique_structure(program: smart_ptr<Program>; name: string): Structure?

Finds a uniquely named structure in the program, returning it if unique or null if ambiguous.

Arguments:
  • program : smart_ptr< Program> implicit

  • name : string implicit

find_variable(module: Module?; variable: string): Variable?

Finds a variable by name in the specified module.

Arguments:
  • module : Module? implicit

  • variable : string implicit

10.2.17. Iterating

any_array_foreach(array: void?; stride: int; block: block<(void?):void>)

Iterates through any array<> type in a typeless fashion using void? pointers.

Arguments:
  • array : void? implicit

  • stride : int

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

any_table_foreach(table: void?; keyStride: int; valueStride: int; block: block<(void?;void?):void>)

Iterates through any table<> type in a typeless fashion using void? pointers.

Arguments:
  • table : void? implicit

  • keyStride : int

  • valueStride : int

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

for_each_annotation_ordered(module: Module?; block: block<(uint64;uint64):void>)

Iterates through each annotation in the given module in the order they were added.

Arguments:
  • module : Module? implicit

  • block : block<(uint64;uint64):void> implicit

for_each_call_macro(module: Module?; block: block<(string#):void>)

Iterates through every CallMacro adapter in the specified module.

Arguments:
  • module : Module? implicit

  • block : block<(string#):void> implicit

10.2.17.1. for_each_enumeration

for_each_enumeration(module: Module?; block: block<(Enumeration?):void>)

Iterates over all enumerations defined in the given module, calling the provided block for each one.

Arguments:
for_each_enumeration(mod: Module?; blk: block<(var en:EnumerationPtr):void>): auto

for_each_field(annotation: BasicStructureAnnotation; block: block<(string;string;TypeDecl?;uint):void>)

Iterates through every field in a BuiltinStructure handled type.

Arguments:
for_each_for_loop_macro(module: Module?; block: block<(ForLoopMacro?):void>)

Iterates through every for-loop macro in the specified module.

Arguments:

10.2.17.2. for_each_function

for_each_function(module: Module?; name: string; block: block<(Function?):void>)

Iterates over all functions with the specified name in the given module, calling the provided block for each matching function.

Arguments:
  • module : Module? implicit

  • name : string implicit

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

for_each_function(mod: Module?; name: string; blk: block<(var func:FunctionPtr):void>): auto

10.2.17.3. for_each_generic

for_each_generic(module: Module?; name: string; block: block<(Function?):void>)

Iterates over all generic functions with the specified name in the given module, calling the provided block for each matching generic.

Arguments:
  • module : Module? implicit

  • name : string implicit

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

for_each_generic(module: Module?; block: block<(Function?):void>)

10.2.17.4. for_each_global

for_each_global(module: Module?; block: block<(Variable?):void>)

Iterates over all global variables defined in the given module, calling the provided block for each one.

Arguments:
for_each_global(mod: Module?; blk: block<(var value:VariablePtr):void>): auto

for_each_module(program: Program?; block: block<(Module?):void>)

Iterates through each module in the program in dependency order.

Arguments:
  • program : Program? implicit

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

for_each_module_function(module: Module?; blk: block<(Function?):void>)

Iterates over all functions defined in the given module, calling the provided block for each function regardless of name.

Arguments:
for_each_module_no_order(program: Program?; block: block<(Module?):void>)

Iterates through each module in the program in no particular order, as they appear in the library group.

Arguments:
  • program : Program? implicit

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

for_each_reader_macro(module: Module?; block: block<(string#):void>)

Iterates through each reader macro in the given module.

Arguments:
  • module : Module? implicit

  • block : block<(string#):void> implicit

10.2.17.5. for_each_structure

for_each_structure(module: Module?; block: block<(Structure?):void>)

Iterates over all structures defined in the given module, calling the provided block for each one.

Arguments:
for_each_structure(mod: Module?; blk: block<(var st:StructurePtr):void>): auto

for_each_structure_alias(structure: Structure?; block: block<(TypeDecl?):void>)

Iterates over all structure aliases defined in the given structure type, invoking the provided block for each alias.

Arguments:

10.2.17.6. for_each_typedef

for_each_typedef(module: Module?; block: block<(string#;TypeDecl?):void>)

Iterates through every typedef in the specified module.

Arguments:
  • module : Module? implicit

  • block : block<(string#; TypeDecl?):void> implicit

for_each_typedef(mod: Module?; blk: block<(name:string#;var value:TypeDeclPtr):void>): auto

for_each_typeinfo_macro(module: Module?; block: block<(TypeInfoMacro?):void>)

Iterates through each typeinfo macro in the given module.

Arguments:
for_each_typemacro(module: Module?; block: block<(TypeMacro?):void>)

Iterates over all type macros registered in the given module, invoking the provided block for each one.

Arguments:
for_each_variant_macro(module: Module?; block: block<(VariantMacro?):void>)

Iterates through each variant macro in the given module.

Arguments:

10.2.18. Cloning

clone_expression(expression: Expression?): Expression?

Clones an Expression along with all its subexpressions and corresponding type information.

Arguments:
clone_file_info(name: string; tab_size: int): FileInfo?

Clones a FileInfo structure.

Arguments:
  • name : string implicit

  • tab_size : int

clone_function(function: Function?): Function?

Creates and returns a deep copy of the specified function, including its body, arguments, and annotations.

Arguments:
clone_structure(structure: Structure const?): Structure?

Returns a deep clone of the specified Structure.

Arguments:
clone_type(type: TypeDecl?): TypeDecl?

Clones a TypeDecl along with all its subtypes.

Arguments:
clone_variable(variable: Variable?): Variable?

Creates and returns a deep copy of the specified variable, including its type declaration and initializer expression.

Arguments:

10.2.19. Mangled name

10.2.19.1. get_mangled_name

get_mangled_name(function: Function?): string

Returns the mangled name of the given function, which uniquely identifies it by encoding the function name along with its argument and return types.

Arguments:
get_mangled_name(type: TypeDecl?): string
get_mangled_name(variable: Variable?): string
get_mangled_name(variable: ExprBlock?): string
get_mangled_name(decl: ExprBlock?): auto

parse_mangled_name(txt: string; lib: ModuleGroup; thisModule: Module?): TypeDecl?

Parses a mangled name string and creates the corresponding TypeDecl.

Arguments:

10.2.20. Size and offset

any_array_size(array: void?): int

Returns the size of an array from a pointer to an array<> object.

Arguments:
  • array : void? implicit

any_table_size(table: void?): int

Returns the size of a table from a pointer to a table<> object.

Arguments:
  • table : void? implicit

get_handled_type_field_offset(type: TypeAnnotation?; field: string): uint

Returns the byte offset of a field within a handled (C++-bound) type annotation.

Arguments:
get_tuple_field_offset(typle: TypeDecl?; index: int): int

Returns the byte offset of a tuple field.

Arguments:
  • typle : TypeDecl? implicit

  • index : int

get_variant_field_offset(variant: TypeDecl?; index: int): int

Returns the byte offset of a variant field.

Arguments:
  • variant : TypeDecl? implicit

  • index : int

10.2.21. Evaluations

eval_single_expression(expr: Expression?; ok: bool&): float4

Warning

This is unsafe operation.

Simulates and evaluates a single expression on a separate context.

Arguments:

10.2.22. Error reporting

macro_error(porogram: smart_ptr<Program>; at: LineInfo; message: string)

Reports an error to the currently compiling program during the active compilation pass.

Arguments:
  • porogram : smart_ptr< Program> implicit

  • at : LineInfo implicit

  • message : string implicit

macro_performance_warning(porogram: smart_ptr<Program>; at: LineInfo; message: string)

Reports a performance warning (error code 40217) at the given source location during compilation.

Arguments:
  • porogram : smart_ptr< Program> implicit

  • at : LineInfo implicit

  • message : string implicit

macro_style_warning(porogram: smart_ptr<Program>; at: LineInfo; message: string)

Reports a style warning (error code 40218) at the given source location during compilation.

Arguments:
  • porogram : smart_ptr< Program> implicit

  • at : LineInfo implicit

  • message : string implicit

10.2.23. Location and context

collect_dependencies(function: Function?; block: block<(array<Function?>;array<Variable?>):void>)

Collects all functions and global variables that the specified function depends on, and passes them to the provided block as two arrays.

Arguments:

10.2.23.1. force_at

force_at(function: Function?; at: LineInfo)

Overrides the line information of the specified function and all expressions within its body to the given location. Useful for macro-generated functions that should point to a specific source location.

Arguments:
force_at(expression: Expression?; at: LineInfo)

get_ast_context(program: smart_ptr<Program>; expression: Expression?; block: block<(bool;AstContext):void>)

Returns the AstContext for a given expression, including the current function, loops, blocks, scopes, and with sections.

Arguments:

10.2.24. Use queries

get_use_functions(func: Function?; block: block<(Function?):void>)

Iterates over all functions that the given function calls or references, invoking the provided block for each one.

Arguments:
get_use_global_variables(func: Function?; block: block<(Variable?):void>)

Iterates over all global variables that the given function accesses, invoking the provided block for each one.

Arguments:

10.2.25. Log

to_compilation_log(text: string)

Writes a message to the compilation log from a macro during compilation.

Arguments:
  • text : string implicit

10.2.26. Removal

remove_structure(module: Module?; structure: Structure?&): bool

Removes the specified structure from the given module. Returns true if the structure was found and removed, false otherwise.

Arguments:

10.2.27. Properties

can_access_global_variable(variable: Variable? const&; module: Module?; thisModule: Module?): bool

Checks whether the given global variable is accessible from the specified module context, taking into account visibility rules and the module where the access originates.

Arguments:
get_aot_arg_prefix(func: Function?; call: ExprCallFunc?; argIndex: int): string

Returns the AOT argument prefix string for the specified function.

Arguments:
get_aot_arg_suffix(func: Function?; call: ExprCallFunc?; argIndex: int): string

Returns the AOT argument suffix string for the specified function.

Arguments:
get_aot_hash_comment(fun: Function const?): string

Returns a diagnostic string containing the function’s own semantic hash and all non-builtin dependency hashes with their mangled names. Used for comparing AOT-generated hash comments with runtime-computed values to diagnose AOT link failures (error 50101).

Arguments:
get_aot_name(func: Function?; call: ExprCallFunc?): string

Returns the AOT-generated name for the specified function.

Arguments:
get_current_search_module(program: Program?; function: Function?; moduleName: string): Module?

Returns the module currently being searched for a function by name, correctly resolving special names like “”, “_”, “*”, and “__”.

Arguments:
  • program : Program? implicit

  • function : Function? implicit

  • moduleName : string implicit

get_field_type(type: TypeDecl?; fieldName: string; constant: bool): TypeDecl?

Returns the type of a field if the target is a structure, variant, tuple, handled type, or pointer to any of those, or null otherwise.

Arguments:
  • type : TypeDecl? implicit

  • fieldName : string implicit

  • constant : bool

get_file_source_line(info: FileInfo?; line: uint; blk: block<(string#):void>)

Reads a single source line from a FileInfo and invokes the block with the line text as a temporary string. Zero-alloc — the string is valid only within the block.

Arguments:
  • info : FileInfo? implicit

  • line : uint

  • blk : block<(string#):void> implicit

get_func_aot_prefix(ann: FunctionAnnotation?; stg: StringBuilderWriter?; call: ExprCallFunc?)

Returns the AOT function prefix string for the specified function.

Arguments:
get_function_aot_hash(fun: Function const?): uint64

Returns the hash of a function used for AOT matching.

Arguments:
get_function_hash_by_id(fun: Function?; id: int; pctx: void?): uint64

Returns the hash of a function given its unique identifier.

Arguments:
  • fun : Function? implicit

  • id : int

  • pctx : void? implicit

get_handled_type_field_type(type: TypeAnnotation?; field: string): TypeInfo?

Returns the runtime type information for a field within a handled (C++-bound) type annotation.

Arguments:
get_handled_type_field_type_declaration(type: TypeAnnotation?; field: string; isConst: bool): TypeDecl?

Returns the type declaration for a field within a handled (C++-bound) type annotation, optionally as const.

Arguments:
  • type : TypeAnnotation? implicit

  • field : string implicit

  • isConst : bool

get_handled_type_index_type_declaration(type: TypeAnnotation?; src: Expression?; idx: Expression?): TypeDecl?

Returns the type declaration of the index operator for a handled type.

Arguments:
get_struct_aot_prefix(ann: StructureAnnotation?; structure: Structure?; args: AnnotationArgumentList; stg: StringBuilderWriter?)

Returns the AOT prefix string for the specified structure.

Arguments:
get_structure_alias(structure: Structure?; aliasName: string): TypeDecl?

Finds and returns a structure alias type by its alias name.

Arguments:
  • structure : Structure? implicit

  • aliasName : string implicit

get_underlying_value_type(type: TypeDecl?): TypeDecl?

Returns the daslang type aliased by a ManagedValue handled type.

Arguments:
get_vector_length(vec: void?; type: TypeDecl?): int

Returns the length of a vector given a pointer to the vector object and its type declaration.

Arguments:
  • vec : void? implicit

  • type : TypeDecl? implicit

get_vector_ptr_at_index(vec: void?; type: TypeDecl?; idx: int): void?

Returns a pointer to the vector element at the specified index given a pointer to the vector object and its TypeDeclPtr.

Arguments:
  • vec : void? implicit

  • type : TypeDecl? implicit

  • idx : int

has_field(type: TypeDecl?; fieldName: string; constant: bool): bool

Returns true if a structure, variant, tuple, handled type, or pointer to any of those has the specified field.

Arguments:
  • type : TypeDecl? implicit

  • fieldName : string implicit

  • constant : bool

is_cpp_keyword(str: string): bool

Returns true if the string is a reserved C++ keyword (including contextual keywords like override and final).

Arguments:
  • str : string implicit

is_das_keyword(str: string): bool

Returns true if the string is a built-in daScript language keyword.

Arguments:
  • str : string implicit

is_expr_const(expression: Expression?): bool

Returns true if the expression is or inherits from ExprConst.

Arguments:
is_expr_like_call(expression: Expression?): bool

Returns true if the expression is or inherits from ExprLooksLikeCall.

Arguments:

10.2.27.1. is_same_type

is_same_type(argType: TypeDecl?; passType: TypeDecl?; refMatters: bool; constMatters: bool; temporaryMatters: bool; allowSubstitute: bool): bool

Compares two types using the given comparison parameters and returns true if they match.

Arguments:
  • argType : TypeDecl? implicit

  • passType : TypeDecl? implicit

  • refMatters : bool

  • constMatters : bool

  • temporaryMatters : bool

  • allowSubstitute : bool

is_same_type(leftType: TypeDecl?; rightType: TypeDecl?; refMatters: RefMatters; constMatters: ConstMatters; tempMatters: TemporaryMatters): bool

is_temp_type(type: TypeDecl?; refMatters: bool): bool

Returns true if the specified type can be temporary.

Arguments:
  • type : TypeDecl? implicit

  • refMatters : bool

is_visible_directly(from_module: Module?; which_module: Module?): bool

Returns true if one module is directly visible from another module.

Arguments:
  • from_module : Module? implicit

  • which_module : Module? implicit

10.2.28. Infer

infer_generic_type(type: TypeDecl?; passType: TypeDecl?; topLevel: bool; isPassType: bool): TypeDecl?

Infers a concrete type from a generic type declaration and a pass type.

Arguments:
  • type : TypeDecl? implicit

  • passType : TypeDecl? implicit

  • topLevel : bool

  • isPassType : bool

update_alias_map(program: smart_ptr<Program>; argType: TypeDecl?; passType: TypeDecl?)

Updates the alias map for the specified type during inference.

Arguments:

10.2.29. Module queries

module_find_annotation(module: Module const?; name: string): Annotation?

Finds an annotation by name in the specified module.

Arguments:
  • module : Module? implicit

  • name : string implicit

module_find_structure(program: Module const?; name: string): Structure?

Finds a structure by name in the specified module.

Arguments:
  • program : Module? implicit

  • name : string implicit

module_find_type_annotation(module: Module const?; name: string): TypeAnnotation?

Finds a type annotation by name in the specified module.

Arguments:
  • module : Module? implicit

  • name : string implicit

not_inferred(function: Function?)

Marks a function as modified by a macro so that it will be inferred again.

Arguments:

10.2.30. Debug info helpers

debug_helper_find_struct_cppname(helper: DebugInfoHelper?; struct_info: StructInfo?): string

Finds a structure in the DebugInfoHelper and returns its C++ name.

Arguments:
debug_helper_find_type_cppname(helper: DebugInfoHelper?; type_info: TypeInfo?): string

Finds a type in the DebugInfoHelper and returns its C++ name.

Arguments:
debug_helper_iter_enums(helper: DebugInfoHelper?; blk: block<(string;EnumInfo?):void>)

Iterates through all enumerations in the DebugInfoHelper, invoking the provided block for each one.

Arguments:
debug_helper_iter_funcs(helper: DebugInfoHelper?; blk: block<(string;FuncInfo?):void>)

Iterates through all functions in the DebugInfoHelper, invoking the provided block for each one.

Arguments:
debug_helper_iter_structs(helper: DebugInfoHelper?; blk: block<(string;StructInfo?):void>)

Iterates through all structures in the DebugInfoHelper, invoking the provided block for each one.

Arguments:
debug_helper_iter_types(helper: DebugInfoHelper?; blk: block<(string;TypeInfo?):void>)

Iterates through all types in the DebugInfoHelper, invoking the provided block for each one.

Arguments:
debug_helper_iter_vars(helper: DebugInfoHelper?; blk: block<(string;VarInfo?):void>)

Iterates through all variables in the DebugInfoHelper, invoking the provided block for each one.

Arguments:

10.2.31. AOT support

aot_need_type_info(macro: TypeInfoMacro const?; expr: Expression?): bool

Returns true if a TypeInfo? is needed for the specified type in a typeinfo expression.

Arguments:
aot_previsit_get_field(ann: TypeAnnotation?; ss: StringBuilderWriter?; name: string)

Performs the pre-visit step for field access during AOT code generation.

Arguments:
aot_previsit_get_field_ptr(ann: TypeAnnotation?; ss: StringBuilderWriter?; name: string)

Performs the pre-visit step for field pointer access during AOT code generation.

Arguments:
aot_require(mod: Module?; ss: StringBuilderWriter?): bool

Writes data to the require section of an AOT module.

Arguments:
aot_type_ann_get_field_ptr(ann: TypeAnnotation?; ss: StringBuilderWriter?; name: string)

Returns the access symbol string for a field, such as -> for pointer types or . for value types.

Arguments:
aot_visit_get_field(ann: TypeAnnotation?; ss: StringBuilderWriter?; name: string)

Performs the visit step for field access during AOT code generation.

Arguments:
getInitSemanticHashWithDep(program: smart_ptr<Program>; init: uint64): uint64

Returns the initialization semantic hash including dependencies for the entire program.

Arguments:
  • program : smart_ptr< Program> implicit

  • init : uint64

macro_aot_infix(macro: TypeInfoMacro?; ss: StringBuilderWriter?; expr: Expression?): bool

Returns true if the macro requires an AOT infix operator for the specified handled type.

Arguments:
write_aot_body(structure: StructureAnnotation?; st: Structure?; args: AnnotationArgumentList; writer: StringBuilderWriter?)

Writes the AOT (ahead-of-time compilation) body section for the given structure annotation, outputting generated C++ code to the string builder writer.

Arguments:
write_aot_macro_prefix(macro: TypeInfoMacro?; ss: StringBuilderWriter?; expr: Expression?)

Writes the AOT macro prefix code for the specified TypeInfoMacro.

Arguments:
write_aot_macro_suffix(macro: TypeInfoMacro?; ss: StringBuilderWriter?; expr: Expression?)

Writes the AOT macro suffix code for the specified TypeInfoMacro.

Arguments:
write_aot_suffix(structure: StructureAnnotation?; st: Structure?; args: AnnotationArgumentList; writer: StringBuilderWriter?)

Writes the AOT (ahead-of-time compilation) suffix section for the given structure annotation, outputting generated C++ code to the string builder writer.

Arguments:

10.2.32. String builder writer

string_builder_clear(ss: StringBuilderWriter?)

Clears a StringBuilder object given a pointer to it.

Arguments:
string_builder_str(ss: StringBuilderWriter?): string

Returns the accumulated string from a StringBuilder object given a pointer to it.

Arguments:

10.2.33. GC

ast_gc_guard(block: block<():void>)

Executes a block and then collects all unreachable GC nodes (TypeDecl instances) created during execution. Use this to prevent GC leak warnings in tools that create temporary AST types.

Arguments:
  • block : block<void> implicit