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” module, use require to get access to it.

require ast

10.2.1. Type aliases

ast::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.

ast::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.

ast::bitfield StructureFlags

properties of the Structure object.

Fields
  • isClass (0x1) - The structure is a class.

  • genCtor (0x2) - Generate constructor.

  • cppLayout (0x4) - C++ data layout.

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

  • generated (0x10) - This structure is compiler-generated.

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

  • isLambda (0x40) - This structure is a lambda.

  • privateStructure (0x80) - This structure is private.

  • macroInterface (0x100) - This structure is a macro interface.

  • _sealed (0x200) - This structure is sealed. It cannot be inherited.

  • skipLockCheck (0x400) - Skip lock check.

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

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

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

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

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

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

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

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

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

ast::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.

ast::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.

ast::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.

ast::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.

ast::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.

ast::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.

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

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

  • deprecated (0x100) - Function is deprecated.

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

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

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

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

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

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

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

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

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

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

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

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

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

  • recursive (0x400000) - Function is recursive.

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

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

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

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

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

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

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

ast::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.

ast::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

ast::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).

ast::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.

ast::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.

ast::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.

ast::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.

ast::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)

ast::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.

ast::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.

ast::bitfield MakeFieldDeclFlags

Properties of the MakeFieldDecl object.

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

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

ast::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.

ast::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 := …’

ast::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.

ast::bitfield ExprYieldFlags

properties of the ExprYield object.

Fields
  • moveSemantics (0x1) - Its ‘yield <- …’.

  • skipLockCheck (0x2) - Skip lock checks.

ast::bitfield ExprReturnFlags

properties of the ExprReturn object.

Fields
  • moveSemantics (0x1) - Its ‘return <- …’.

  • returnReference (0x2) - Return a reference. Function result is a reference.

  • returnInBlock (0x4) - Return in block, not in function.

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

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

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

  • fromYield (0x40) - From yield.

  • fromComprehension (0x80) - From comprehension.

  • skipLockCheck (0x100) - Skip lock checks.

ast::bitfield ExprMakeBlockFlags

properties of the ExprMakeBlock object.

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

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

ast::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’

ast::bitfield MoveFlags

Properties of the ExprMove object.

Fields
  • skipLockCheck (0x1) - Skip lock checks.

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

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

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

ast::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.

ast::bitfield StringBuilderFlags

properties of the ExprStringBuilder object.

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

ast::ExpressionPtr = smart_ptr<Expression>

Smart pointer to an Expression object. The fundamental handle type for all AST expression nodes.

ast::ProgramPtr = smart_ptr<Program>

Smart pointer to a Program object. Represents the root of a compiled daslang program, containing all modules, functions, and structures.

ast::TypeDeclPtr = smart_ptr<TypeDecl>

Smart pointer to a TypeDecl object. The fundamental handle type for all type declarations in the AST type system.

ast::VectorTypeDeclPtr = dasvector`smart_ptr`TypeDecl

Smart pointer to a das::vector<ExpressionPtr>. Represents an ordered collection of type declarations, typically used for function argument lists and tuple fields.

ast::EnumerationPtr = smart_ptr<Enumeration>

Smart pointer to an Enumeration object. Used for creating and manipulating enumeration declarations in the AST.

ast::StructurePtr = smart_ptr<Structure>

Smart pointer to a Structure object. Used for creating and manipulating structure declarations in the AST.

ast::FunctionPtr = smart_ptr<Function>

Smart pointer to a Function object. Used for creating and manipulating function declarations in the AST.

ast::VariablePtr = smart_ptr<Variable>

Smart pointer to a Variable object. Used for creating and manipulating variable declarations in the AST.

ast::MakeFieldDeclPtr = smart_ptr<MakeFieldDecl>

Smart pointer to a MakeFieldDecl object. Represents a single field initializer in structure or variant construction expressions.

ast::ExprMakeBlockPtr = smart_ptr<ExprMakeBlock>

Smart pointer to an ExprMakeBlock expression. Wraps block or lambda creation expressions in the AST.

ast::FunctionAnnotationPtr = smart_ptr<FunctionAnnotation>

Smart pointer to a FunctionAnnotation object. Used for registering and managing function annotation macros.

ast::StructureAnnotationPtr = smart_ptr<StructureAnnotation>

Smart pointer to a StructureAnnotation object. Used for registering and managing structure annotation macros.

ast::EnumerationAnnotationPtr = smart_ptr<EnumerationAnnotation>

Smart pointer to an EnumerationAnnotation object. Used for registering and managing enumeration annotation macros.

ast::PassMacroPtr = smart_ptr<PassMacro>

Smart pointer to a PassMacro object. Used for registering and managing custom inference pass macros.

ast::VariantMacroPtr = smart_ptr<VariantMacro>

Smart pointer to a VariantMacro object. Used for registering and managing custom variant dispatch macros.

ast::ReaderMacroPtr = smart_ptr<ReaderMacro>

Smart pointer to a ReaderMacro object. Used for registering and managing custom reader (parsing) macros.

ast::CommentReaderPtr = smart_ptr<CommentReader>

Smart pointer to a CommentReader object. Used for registering and managing custom comment parsing macros.

ast::CallMacroPtr = smart_ptr<CallMacro>

Smart pointer to a CallMacro object. Used for registering and managing custom call-like expression macros.

ast::TypeInfoMacroPtr = smart_ptr<TypeInfoMacro>

Smart pointer to a TypeInfoMacro object. Used for registering and managing custom typeinfo trait macros.

ast::ForLoopMacroPtr = smart_ptr<ForLoopMacro>

Smart pointer to a ForLoopMacro object. Used for registering and managing custom for-loop macros.

ast::CaptureMacroPtr = smart_ptr<CaptureMacro>

Smart pointer to a CaptureMacro object. Used for registering and managing custom lambda capture macros.

ast::TypeMacroPtr = smart_ptr<TypeMacro>

Smart pointer to a TypeMacro object. Used for registering and managing custom type declaration macros.

ast::SimulateMacroPtr = smart_ptr<SimulateMacro>

Smart pointer to a SimulateMacro object. Used for registering and managing macros that hook into the simulation phase.

10.2.2. Enumerations

ast::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.

ast::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

ast::ModuleLibrary

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

ast::Expression

Any expression (base class).

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

  • _type : smart_ptr< 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

ast::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 : smart_ptr< TypeDecl> - First type for compound types (like array<firstType> or table<firstType, secondType>)

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

  • argTypes : vector<smart_ptr<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<smart_ptr<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

ast::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

ast::FieldDeclaration

Structure field declaration.

Fields
  • name : das_string - Name of the field

  • _type : smart_ptr< TypeDecl> - Type of the field

  • init : smart_ptr< Expression> - Expression for field initializer, if any

  • annotation : AnnotationArgumentList - Annotations attached to this field

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

  • offset : int - Offset of the field in the structure

  • flags : FieldDeclarationFlags - Field flags

ast::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 : smart_ptr< Expression> - Value of the enumeration entry (typicall ‘ExprConst’ derivative)

ast::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)

ast::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<smart_ptr<Variable>> - Arguments of the function

  • result : smart_ptr< TypeDecl> - Result type of the function

  • body : smart_ptr< 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 : smart_ptr< 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

ast::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<smart_ptr<Variable>> - Arguments of the function

  • result : smart_ptr< TypeDecl> - Result type of the function

  • body : smart_ptr< 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 : smart_ptr< 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.

ast::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<smart_ptr<Variable>> - Arguments of the function

  • result : smart_ptr< TypeDecl> - Result type of the function

  • body : smart_ptr< 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 : smart_ptr< 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.

ast::InferHistory

Generic function infer history.

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

  • func : Function? - Function being inferred

ast::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 : smart_ptr< TypeDecl> - Type of the variable

  • init : smart_ptr< Expression> - Initializer expression for the variable, if any

  • source : smart_ptr< 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

ast::AstContext

Lexical context for the particular expression.

Fields
  • func : smart_ptr< Function> - Function this expression belongs to

  • _loop : vector<smart_ptr<Expression>> - Loop stack

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

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

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

ast::ExprBlock

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

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

  • _type : smart_ptr< 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<smart_ptr<Expression>> - List of expressions in the main body of the block

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

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

  • arguments : vector<smart_ptr<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

ast::ExprLet

Local variable declaration (let v = expr;).

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

  • _type : smart_ptr< 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<smart_ptr<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.

ast::ExprStringBuilder

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

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

  • _type : smart_ptr< 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<smart_ptr<Expression>> - List of expressions that make up the string builder (literals and expressions)

  • stringBuilderFlags : StringBuilderFlags - Flags specific to string builder expressions

ast::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 : smart_ptr< Expression> - Initializer expression for the field

  • tag : smart_ptr< Expression> - Tag associated with the field, if any

  • flags : MakeFieldDeclFlags - Flags specific to this field declaration

ast::ExprNamedCall

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

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

  • _type : smart_ptr< 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<smart_ptr<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

ast::ExprLooksLikeCall

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

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

  • _type : smart_ptr< 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<smart_ptr<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

ast::ExprCallFunc

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

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

  • _type : smart_ptr< 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<smart_ptr<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

ast::ExprNew

New expression (new Foo, new Bar(expr1..), but NOT new [[Foo …]])

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

  • _type : smart_ptr< 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<smart_ptr<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 : smart_ptr< 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

ast::ExprCall

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

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

  • _type : smart_ptr< 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<smart_ptr<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

ast::ExprPtr2Ref

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

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - Expression being dereferenced

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

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

ast::ExprNullCoalescing

Null coalescing (expr1 ?? default_value).

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - Expression being coalesced

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

  • assumeNoAlias : bool - Assume no aliasing occurs

  • defaultValue : smart_ptr< Expression> - Default value expression

ast::ExprAt

Index lookup (expr[expr1]).

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - Subexpression being indexed

  • index : smart_ptr< Expression> - Index expression

  • atFlags : ExprAtFlags - Flags specific to ExprAt expressions

ast::ExprSafeAt

Safe index lookup (expr?[expr1]).

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - Subexpression being indexed

  • index : smart_ptr< Expression> - Index expression

  • atFlags : ExprAtFlags - Flags specific to ExprAt expressions

ast::ExprIs

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

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - Subexpression being checked

  • typeexpr : smart_ptr< TypeDecl> - Type being checked against

ast::ExprOp

Compilation time only base class for any operator.

ast::ExprOp2

Two operand operator (expr1 + expr2)

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

  • _type : smart_ptr< 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<smart_ptr<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 : smart_ptr< Expression> - Left operand expression

  • right : smart_ptr< Expression> - Right operand expression

ast::ExprOp3

Three operand operator (cond ? expr1 : expr2)

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

  • _type : smart_ptr< 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<smart_ptr<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 : smart_ptr< Expression> - Condition expression

  • left : smart_ptr< Expression> - Left operand expression

  • right : smart_ptr< Expression> - Right operand expression

ast::ExprCopy

Copy operator (expr1 = expr2)

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

  • _type : smart_ptr< 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<smart_ptr<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 : smart_ptr< Expression> - Left operand expression

  • right : smart_ptr< Expression> - Right operand expression

  • copy_flags : CopyFlags - Flags specific to copy operation

ast::ExprMove

Move operator (expr1 <- expr2)

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

  • _type : smart_ptr< 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<smart_ptr<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 : smart_ptr< Expression> - Left operand expression

  • right : smart_ptr< Expression> - Right operand expression

  • move_flags : MoveFlags - Flags specific to move operation

ast::ExprClone

Clone operator (expr1 := expr2)

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

  • _type : smart_ptr< 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<smart_ptr<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 : smart_ptr< Expression> - Left operand expression

  • right : smart_ptr< Expression> - Right operand expression

ast::ExprWith

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

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - The expression to be used as the context for the with block

  • body : smart_ptr< Expression> - The body of the with block

ast::ExprAssume

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

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - The expression being aliased, if specified

  • assumeType : smart_ptr< TypeDecl> - The type being assumed, if specified

ast::ExprWhile

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

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - The condition expression

  • body : smart_ptr< Expression> - The body of the while loop

ast::ExprTryCatch

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

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - The try block

  • catch_block : smart_ptr< Expression> - The recover block

ast::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 : smart_ptr< 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 : smart_ptr< Expression> - The condition expression

  • if_true : smart_ptr< Expression> - The ‘then’ block expression

  • if_false : smart_ptr< Expression> - The ‘else’ block expression

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

ast::ExprFor

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

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

  • _type : smart_ptr< 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<smart_ptr<Expression>> - Tags associated with each iterator

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

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

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

  • body : smart_ptr< 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

ast::ExprMakeLocal

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

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

  • _type : smart_ptr< 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 : smart_ptr< 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

ast::ExprMakeStruct

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

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

  • _type : smart_ptr< 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 : smart_ptr< 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<smart_ptr<MakeStruct>> - Array of structures being made

  • _block : smart_ptr< 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

ast::ExprMakeVariant

Make variant expression ([YourVariant variantName=expr1])

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

  • _type : smart_ptr< 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 : smart_ptr< 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<smart_ptr<MakeFieldDecl>> - Array of variants being made

ast::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 : smart_ptr< 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 : smart_ptr< 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 : smart_ptr< TypeDecl> - Type of the array elements

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

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

ast::ExprMakeTuple

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

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

  • _type : smart_ptr< 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 : smart_ptr< 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 : smart_ptr< TypeDecl> - Type of the array elements

  • values : vector<smart_ptr<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])

ast::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 : smart_ptr< 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 : smart_ptr< Expression> - The ‘for’ expression

  • exprWhere : smart_ptr< Expression> - The ‘where’ expression

  • subexpr : smart_ptr< 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])

ast::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

ast::ExprTypeInfo

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

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - The expression being queried for type information

  • typeexpr : smart_ptr< 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

ast::ExprTypeDecl

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

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

  • _type : smart_ptr< 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 : smart_ptr< TypeDecl> - The type expression being queried for type information

ast::ExprLabel

Label (label 13:)

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

  • _type : smart_ptr< 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

ast::ExprGoto

Goto expression (goto label 13, goto x)

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - Expression evaluating to label to go to, if specified

ast::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 : smart_ptr< 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 : smart_ptr< Expression> - The sub-expression being converted from reference to value

ast::ExprRef2Ptr

Addr expresion (addr(expr))

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - The sub-expression being converted from pointer to reference

ast::ExprAddr

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

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

  • _type : smart_ptr< 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 : smart_ptr< TypeDecl> - Type of the function being referenced

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

ast::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 : smart_ptr< 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<smart_ptr<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)

ast::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 : smart_ptr< 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<smart_ptr<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

ast::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 : smart_ptr< 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<smart_ptr<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

ast::ExprDebug

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

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

  • _type : smart_ptr< 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<smart_ptr<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

ast::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 : smart_ptr< 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<smart_ptr<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)

ast::ExprErase

Erase expression (erase(tab,key))

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

  • _type : smart_ptr< 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<smart_ptr<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

ast::ExprSetInsert

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

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

  • _type : smart_ptr< 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<smart_ptr<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

ast::ExprFind

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

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

  • _type : smart_ptr< 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<smart_ptr<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

ast::ExprKeyExists

Key exists expression (key_exists(tab,key))

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

  • _type : smart_ptr< 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<smart_ptr<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

ast::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 : smart_ptr< 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 : smart_ptr< Expression> - Subexpression being ascended (newed)

  • ascType : smart_ptr< 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

ast::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 : smart_ptr< 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 : smart_ptr< Expression> - Subexpression being cast

  • castType : smart_ptr< TypeDecl> - Type to which the expression is being cast

  • castFlags : ExprCastFlags - Flags specific to ExprCast expressions

ast::ExprDelete

Delete expression (delete blah)

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - The expression being deleted

  • sizeexpr : smart_ptr< 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.

ast::ExprVar

Variable access (foo)

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

  • _type : smart_ptr< 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 : smart_ptr< 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

ast::ExprTag

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

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - The subexpression of the tag

  • value : smart_ptr< Expression> - Value of the tag

  • name : das_string - Name of the tag

ast::ExprSwizzle

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

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - Value being swizzled

  • mask : das_string - Swizzle mask

  • fields : vector<uint8> - Swizzle fields

  • fieldFlags : ExprSwizzleFieldFlags - Flags specific to ExprSwizzle expressions

ast::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 : smart_ptr< 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 : smart_ptr< 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 : smart_ptr< TypeAnnotation> - Type annotation for the field

  • derefFlags : ExprFieldDerefFlags - Flags for dereferencing operations

  • fieldFlags : ExprFieldFieldFlags - Flags specific to field access expressions

ast::ExprSafeField

Safe field lookup (foo?.bar)

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

  • _type : smart_ptr< 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 : smart_ptr< 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 : smart_ptr< 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

ast::ExprIsVariant

Is expression (foo is bar)

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

  • _type : smart_ptr< 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 : smart_ptr< 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 : smart_ptr< TypeAnnotation> - Type annotation for the field

  • derefFlags : ExprFieldDerefFlags - Flags for dereferencing operations

  • fieldFlags : ExprFieldFieldFlags - Flags specific to field access expressions

ast::ExprAsVariant

As expression (foo as bar)

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

  • _type : smart_ptr< 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 : smart_ptr< 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 : smart_ptr< TypeAnnotation> - Type annotation for the field

  • derefFlags : ExprFieldDerefFlags - Flags for dereferencing operations

  • fieldFlags : ExprFieldFieldFlags - Flags specific to field access expressions

ast::ExprSafeAsVariant

Safe as expression (foo? as bar)

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

  • _type : smart_ptr< 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 : smart_ptr< 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 : smart_ptr< 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

ast::ExprOp1

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

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

  • _type : smart_ptr< 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<smart_ptr<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 : smart_ptr< Expression> - That one argument of the operator

ast::ExprReturn

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

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

  • _type : smart_ptr< 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 : smart_ptr< 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

ast::ExprYield

Yield expression (yield foo or yield <- bar)

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - The expression being yielded (never empty)

  • returnFlags : ExprYieldFlags - Yield flags

ast::ExprBreak

Break expression (break)

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

  • _type : smart_ptr< 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

ast::ExprContinue

Continue expression (continue)

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

  • _type : smart_ptr< 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

ast::ExprConst

Compilation time constant expression base class

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

  • _type : smart_ptr< 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

ast::ExprFakeContext

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

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

  • _type : smart_ptr< 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)

ast::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 : smart_ptr< 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?

ast::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 : smart_ptr< 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.

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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 : smart_ptr< 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

ast::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.)

ast::ExprMakeBlock

Any closure. Holds block as well as capture information in CaptureEntry.

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

  • _type : smart_ptr< 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 : smart_ptr< 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)

ast::ExprMakeGenerator

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

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

  • _type : smart_ptr< 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<smart_ptr<Expression>> - Arguments passed to the generator

  • argumentsFailedToInfer : bool - Whether arguments failed to infer

  • atEnclosure : LineInfo - Location of the enclosure

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

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

ast::ExprMemZero

Memzero (memzero(expr))

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

  • _type : smart_ptr< 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<smart_ptr<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

ast::ExprConstEnumeration

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

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

  • _type : smart_ptr< 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 : smart_ptr< Enumeration> - Enumeration type declaration

  • value : das_string - Value of the constant expression

ast::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 : smart_ptr< 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 : smart_ptr< TypeDecl> - Type declaration of the bitfield

ast::ExprConstString

Holds string constant.

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

  • _type : smart_ptr< 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

ast::ExprUnsafe

Unsafe expression (unsafe(addr(x)))

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

  • _type : smart_ptr< 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 : smart_ptr< Expression> - Body expression that is marked as unsafe

ast::VisitorAdapter

Adapter for the AstVisitor interface.

ast::FunctionAnnotation

Adapter for the AstFunctionAnnotation.

ast::StructureAnnotation

Adapter for the AstStructureAnnotation.

ast::EnumerationAnnotation

Adapter for the AstEnumerationAnnotation.

ast::PassMacro

Adapter for the AstPassMacro.

Fields
ast::ReaderMacro

Adapter for the AstReaderMacro.

Fields
  • name : das_string - Name of the macro

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

ast::CommentReader

Adapter for the AstCommentReader.

ast::CallMacro

Adapter for the AstCallMacro.

Fields
  • name : das_string - Name of the macro

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

ast::VariantMacro

Adapter for the AstVariantMacro.

Fields
ast::ForLoopMacro

Adapter for the ‘AstForLoopMacro’.

Fields
ast::CaptureMacro

Adapter for the AstCaptureMacro.

Fields
ast::TypeMacro

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

Fields
ast::SimulateMacro

Adapter for the AstSimulateMacro.

Fields
ast::ExprReader

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

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

  • _type : smart_ptr< 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 : smart_ptr< ReaderMacro> - Macro which is attached to the context parser.

  • sequence : das_string - Sequence of characters being read.

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

  • _type : smart_ptr< 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<smart_ptr<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

10.2.4. Call macros

ast::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::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::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

ast::MakeStruct

Annotation representing a vector of MakeFieldDecl used to initialize fields in ExprMakeStruct expressions.

10.2.7. Classes

ast::AstFunctionAnnotation

Annotation macro that attaches to Function declarations. Provides compile-time hooks for transforming functions, adding finalization logic, and controlling function compilation behavior.

ast::AstBlockAnnotation

Annotation macro that attaches to ExprBlock nodes. Provides compile-time hooks for inspecting and transforming code blocks, including loop bodies and scoped blocks.

ast::AstStructureAnnotation

Annotation macro that attaches to Structure declarations. Provides compile-time hooks for inspecting and modifying structure definitions, fields, and layout.

ast::AstPassMacro

Macro that executes as an additional inference pass during compilation. Allows injecting custom analysis and transformation logic into the type-inference pipeline.

ast::AstVariantMacro

Macro for implementing custom is, as, and ?as expressions. Allows user-defined variant-like dispatch and type-checking patterns beyond the built-in variant type.

ast::AstForLoopMacro

Macro for implementing custom for-loop iteration patterns. Intercepts for-loop expressions during compilation, similar to the visitExprFor callback of AstVisitor.

ast::AstCaptureMacro

Macro for implementing custom lambda capture behavior. Controls how variables are captured from the enclosing scope when creating lambdas and generators.

ast::AstTypeMacro

Macro that participates in type declarations, enabling syntax like $macro_name<type_args...>(args) for custom type construction and transformation.

ast::AstSimulateMacro

Macro that hooks into the context simulation phase — the final compilation step where the AST is translated into executable simulation nodes.

ast::AstReaderMacro

Macro for implementing custom parsing syntax using the %MacroName~ notation. The reader macro controls the start and end of the custom parsing region and produces an AST expression from the parsed content.

ast::AstCommentReader

Macro for implementing custom comment parsing, such as extracting doxygen-style documentation or other structured metadata from source comments during compilation.

ast::AstCallMacro

Macro for implementing custom call-like expressions (e.g. foo(bar, bar2, ...)). The macro intercepts specific function calls during compilation and can rewrite them into arbitrary AST.

ast::AstTypeInfoMacro

Macro for implementing custom typeinfo traits, enabling expressions like typeinfo(YourTraitHere ...) that extract compile-time type information.

ast::AstEnumerationAnnotation

Annotation macro that attaches to Enumeration declarations. Provides compile-time hooks for inspecting and modifying enumeration definitions.

ast::AstVisitor

Implements the Visitor interface for traversing and transforming the AST tree. Provides visit and preVisit callbacks for every expression and declaration node type.

10.2.8. Call generation

ast::make_call(at: LineInfo; name: string) : smart_ptr<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

ast::visit(expression: smart_ptr<TypeDecl>; adapter: smart_ptr<VisitorAdapter>) : smart_ptr<TypeDecl>()

Invokes an AST visitor on the given object.

Arguments
ast::visit(program: smart_ptr<Program>; adapter: smart_ptr<VisitorAdapter>)
ast::visit(function: smart_ptr<Function>; adapter: smart_ptr<VisitorAdapter>)
ast::visit(expression: smart_ptr<Expression>; adapter: smart_ptr<VisitorAdapter>) : smart_ptr<Expression>()

ast::visit_enumeration(program: smart_ptr<Program>; enumeration: smart_ptr<Enumeration>; adapter: smart_ptr<VisitorAdapter>)

Invokes an AST visitor on the given enumeration.

Arguments
ast::visit_finally(expression: smart_ptr<ExprBlock>; adapter: smart_ptr<VisitorAdapter>)

Invokes the visitor on the finally section of a block.

Arguments
ast::visit_module(program: smart_ptr<Program>; adapter: smart_ptr<VisitorAdapter>; module: Module?)

Invokes an AST visitor on the given module.

Arguments
ast::visit_modules(program: smart_ptr<Program>; adapter: smart_ptr<VisitorAdapter>)

Invokes an AST visitor on all modules in the specified program.

Arguments
ast::visit_structure(program: smart_ptr<Program>; structure: smart_ptr<Structure>; adapter: smart_ptr<VisitorAdapter>)

Invokes an AST visitor on the given structure.

Arguments

10.2.10. Expression generation

10.2.10.1. force_generated

ast::force_generated(function: smart_ptr<Function> const&; value: bool)

Sets the generated flag on an expression and its subexpressions.

Arguments
  • function : smart_ptr< Function>& implicit

  • value : bool

ast::force_generated(expression: smart_ptr<Expression> const&; value: bool)

ast::get_expression_annotation(expr: Expression?) : Annotation?()

Returns the Annotation associated with an Expression or its inherited types.

Arguments
ast::make_type_info_structure(ctx: Context; type: smart_ptr<TypeDecl>) : TypeInfo?()

Returns a new TypeInfo corresponding to the specified type.

Arguments

10.2.11. Adapter generation

10.2.11.1. make_block_annotation

ast::make_block_annotation(name: string; someClassPtr: auto) : FunctionAnnotationPtr()

Creates an adapter for the AstBlockAnnotation interface.

Arguments
  • name : string

  • someClassPtr : auto

ast::make_block_annotation(name: string; class: void?; info: StructInfo const?) : smart_ptr<FunctionAnnotation>()

ast::make_block_type(blk: ExprBlock?) : smart_ptr<TypeDecl>()

Generates a TypeDeclPtr for a specified block or lambda type.

Arguments

10.2.11.2. make_call_macro

ast::make_call_macro(name: string; class: void?; info: StructInfo const?) : smart_ptr<CallMacro>()

Creates an adapter for the AstCallMacro interface.

Arguments
  • name : string implicit

  • class : void? implicit

  • info : StructInfo? implicit

ast::make_call_macro(name: string; someClassPtr: auto) : CallMacroPtr()

10.2.11.3. make_capture_macro

ast::make_capture_macro(name: string; class: void?; info: StructInfo const?) : smart_ptr<CaptureMacro>()

Creates an adapter for the AstCaptureMacro interface.

Arguments
  • name : string implicit

  • class : void? implicit

  • info : StructInfo? implicit

ast::make_capture_macro(name: string; someClassPtr: auto) : CaptureMacroPtr()

ast::make_clone_structure(structure: Structure?) : smart_ptr<Function>()

Generates a clone function for the given structure.

Arguments

10.2.11.4. make_comment_reader

ast::make_comment_reader(class: void?; info: StructInfo const?) : smart_ptr<CommentReader>()

Creates an adapter for the AstCommentReader interface.

Arguments
  • class : void? implicit

  • info : StructInfo? implicit

ast::make_comment_reader(name: string; someClassPtr: auto) : CommentReaderPtr()

ast::make_enum_debug_info(helper: smart_ptr<DebugInfoHelper>; en: Enumeration const?) : EnumInfo?()

Generates an EnumInfo for the specified enumeration using the given DebugInfoHelper.

Arguments

10.2.11.5. make_enumeration_annotation

ast::make_enumeration_annotation(name: string; someClassPtr: auto) : EnumerationAnnotationPtr()

Creates an adapter for the AstEnumerationAnnotation interface.

Arguments
  • name : string

  • someClassPtr : auto

ast::make_enumeration_annotation(name: string; class: void?; info: StructInfo const?) : smart_ptr<EnumerationAnnotation>()

10.2.11.6. make_for_loop_macro

ast::make_for_loop_macro(name: string; class: void?; info: StructInfo const?) : smart_ptr<ForLoopMacro>()

Creates an adapter for the AstForLoopMacro interface.

Arguments
  • name : string implicit

  • class : void? implicit

  • info : StructInfo? implicit

ast::make_for_loop_macro(name: string; someClassPtr: auto) : ForLoopMacroPtr()

10.2.11.7. make_function_annotation

ast::make_function_annotation(name: string; someClassPtr: auto) : FunctionAnnotationPtr()

Creates an adapter for the AstFunctionAnnotation interface.

Arguments
  • name : string

  • someClassPtr : auto

ast::make_function_annotation(name: string; class: void?; info: StructInfo const?) : smart_ptr<FunctionAnnotation>()

ast::make_function_debug_info(helper: smart_ptr<DebugInfoHelper>; fn: Function const?) : FuncInfo?()

Generates a FuncInfo for the specified function using the given DebugInfoHelper.

Arguments
ast::make_invokable_type_debug_info(helper: smart_ptr<DebugInfoHelper>; blk: smart_ptr<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

ast::make_pass_macro(name: string; class: void?; info: StructInfo const?) : smart_ptr<PassMacro>()

Creates an adapter for the AstPassMacro interface.

Arguments
  • name : string implicit

  • class : void? implicit

  • info : StructInfo? implicit

ast::make_pass_macro(name: string; someClassPtr: auto) : PassMacroPtr()

10.2.11.9. make_reader_macro

ast::make_reader_macro(name: string; someClassPtr: auto) : ReaderMacroPtr()

Creates an adapter for the AstReaderMacro interface.

Arguments
  • name : string

  • someClassPtr : auto

ast::make_reader_macro(name: string; class: void?; info: StructInfo const?) : smart_ptr<ReaderMacro>()

10.2.11.10. make_simulate_macro

ast::make_simulate_macro(name: string; someClassPtr: auto) : SimulateMacroPtr()

Creates an adapter for the AstSimulateMacro interface.

Arguments
  • name : string

  • someClassPtr : auto

ast::make_simulate_macro(name: string; class: void?; info: StructInfo const?) : smart_ptr<SimulateMacro>()

ast::make_struct_debug_info(helper: smart_ptr<DebugInfoHelper>; st: Structure const?) : StructInfo?()

Generates a StructInfo for the specified structure using the given DebugInfoHelper.

Arguments
ast::make_struct_variable_debug_info(helper: smart_ptr<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

ast::make_structure_annotation(name: string; someClassPtr: auto) : StructureAnnotationPtr()

Creates an adapter for the AstStructureAnnotation interface.

Arguments
  • name : string

  • someClassPtr : auto

ast::make_structure_annotation(name: string; class: void?; info: StructInfo const?) : smart_ptr<StructureAnnotation>()

ast::make_type_info(helper: smart_ptr<DebugInfoHelper>; info: TypeInfo?; type: smart_ptr<TypeDecl> const&) : TypeInfo?()

Generates a TypeInfo for the specified type using the given DebugInfoHelper.

Arguments

10.2.11.12. make_type_macro

ast::make_type_macro(name: string; someClassPtr: auto) : TypeMacroPtr()

Creates an adapter for the AstTypeMacro interface.

Arguments
  • name : string

  • someClassPtr : auto

ast::make_type_macro(name: string; class: void?; info: StructInfo const?) : smart_ptr<TypeMacro>()

10.2.11.13. make_typeinfo_macro

ast::make_typeinfo_macro(name: string; class: void?; info: StructInfo const?) : smart_ptr<TypeInfoMacro>()

Creates an adapter for the AstTypeInfoMacro interface.

Arguments
  • name : string implicit

  • class : void? implicit

  • info : StructInfo? implicit

ast::make_typeinfo_macro(name: string; someClassPtr: auto) : TypeInfoMacroPtr()

ast::make_variable_debug_info(helper: smart_ptr<DebugInfoHelper>; var: Variable?) : VarInfo?()

Generates a VariableInfo for the specified variable using the given DebugInfoHelper.

Arguments

10.2.11.14. make_variant_macro

ast::make_variant_macro(name: string; someClassPtr: auto) : VariantMacroPtr()

Creates an adapter for the AstVariantMacro interface.

Arguments
  • name : string

  • someClassPtr : auto

ast::make_variant_macro(name: string; class: void?; info: StructInfo const?) : smart_ptr<VariantMacro>()

10.2.11.15. make_visitor

ast::make_visitor(someClass: auto) : smart_ptr<VisitorAdapter>()

Creates an adapter for the AstVisitor interface.

Arguments
  • someClass : auto

ast::make_visitor(class: void?; info: StructInfo const?) : smart_ptr<VisitorAdapter>()

10.2.12. Adapter application

10.2.12.1. add_block_annotation

ast::add_block_annotation(block: smart_ptr<ExprBlock>; annotation: smart_ptr<FunctionAnnotation>&)

Adds an annotation declaration to a block.

Arguments
ast::add_block_annotation(block: smart_ptr<ExprBlock>; annotation: smart_ptr<AnnotationDeclaration>&)

ast::add_call_macro(module: Module?; annotation: smart_ptr<CallMacro>&)

Adds an AstCallMacro adapter to the specified module.

Arguments
ast::add_capture_macro(module: Module?; annotation: smart_ptr<CaptureMacro>&)

Adds an AstCaptureMacro to the specified module.

Arguments
ast::add_comment_reader(module: Module?; reader: smart_ptr<CommentReader>&)

Adds an AstCommentReader adapter to the specified module.

Arguments
ast::add_dirty_infer_macro(module: Module?; annotation: smart_ptr<PassMacro>&)

Adds an AstPassMacro adapter to the dirty inference pass.

Arguments
ast::add_enumeration_annotation(module: Module?; annotation: smart_ptr<EnumerationAnnotation>&)

Adds an annotation to an enumeration and calls apply if applicable.

Arguments
ast::add_for_loop_macro(module: Module?; annotation: smart_ptr<ForLoopMacro>&)

Adds an AstForLoopMacro to the specified module.

Arguments

10.2.12.2. add_function_annotation

ast::add_function_annotation(function: smart_ptr<Function>; annotation: smart_ptr<FunctionAnnotation>&)

Adds an annotation to a function and calls apply if applicable.

Arguments
ast::add_function_annotation(module: Module?; annotation: smart_ptr<FunctionAnnotation>&)
ast::add_function_annotation(function: smart_ptr<Function>; annotation: smart_ptr<AnnotationDeclaration>&)

ast::add_global_lint_macro(module: Module?; annotation: smart_ptr<PassMacro>&)

Adds an AstPassMacro adapter to the global lint pass.

Arguments
ast::add_infer_macro(module: Module?; annotation: smart_ptr<PassMacro>&)

Adds an AstPassMacro adapter to the type inference pass.

Arguments
ast::add_lint_macro(module: Module?; annotation: smart_ptr<PassMacro>&)

Adds an AstPassMacro adapter to the lint pass of the current module.

Arguments
ast::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

ast::add_new_block_annotation(name: string; someClassPtr: auto) : auto()

Creates an AstBlockAnnotation adapter and adds it to the current module.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_call_macro(name: string; someClassPtr: auto) : auto()

Creates an AstCallMacro adapter and adds it to the current module.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_capture_macro(name: string; someClassPtr: auto) : auto()

Creates an AstCaptureMacro adapter and adds it to the current module.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_comment_reader(name: string; someClassPtr: auto) : auto()

Creates an AstCommentReader adapter and adds it to the current module.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_contract_annotation(name: string; someClassPtr: auto) : auto()

Creates an AstContractAnnotation adapter and adds it to the current module.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_dirty_infer_macro(name: string; someClassPtr: auto) : auto()

Creates an AstPassMacro adapter and adds it to the current module’s dirty infer pass.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_enumeration_annotation(name: string; someClassPtr: auto) : auto()

Creates an AstEnumerationAnnotation adapter and adds it to the current module.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_for_loop_macro(name: string; someClassPtr: auto) : auto()

Creates an AstForLoopMacro adapter and adds it to the current module.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_function_annotation(name: string; someClassPtr: auto) : auto()

Creates an AstFunctionAnnotation adapter and adds it to the current module.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_global_lint_macro(name: string; someClassPtr: auto) : auto()

Creates an AstPassMacro adapter and adds it to the current module’s global lint pass.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_infer_macro(name: string; someClassPtr: auto) : auto()

Creates an AstPassMacro adapter and adds it to the current module’s infer pass.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_lint_macro(name: string; someClassPtr: auto) : auto()

Creates an AstPassMacro adapter and adds it to the current module’s lint pass.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_optimization_macro(name: string; someClassPtr: auto) : auto()

Creates an AstPassMacro adapter and adds it to the current module’s optimization pass.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_reader_macro(name: string; someClassPtr: auto) : auto()

Creates an AstReaderMacro adapter and adds it to the current module.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_simulate_macro(name: string; someClassPtr: auto) : auto()

Creates an AstSimulateMacro adapter and adds it to the current module.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_structure_annotation(name: string; someClassPtr: auto) : auto()

Creates an AstStructureAnnotation adapter and adds it to the current module.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_type_macro(name: string; someClassPtr: auto) : auto()

Creates an AstTypeMacro adapter and adds it to the current module.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_typeinfo_macro(name: string; someClassPtr: auto) : auto()

Creates an AstTypeInfoMacro adapter and adds it to the current module.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_new_variant_macro(name: string; someClassPtr: auto) : auto()

Creates an AstVariantMacro adapter and adds it to the current module.

Arguments
  • name : string

  • someClassPtr : auto

ast::add_optimization_macro(module: Module?; annotation: smart_ptr<PassMacro>&)

Adds an AstPassMacro adapter to the optimization pass of a specific module.

Arguments
ast::add_reader_macro(module: Module?; annotation: smart_ptr<ReaderMacro>&)

Adds an AstReaderMacro adapter to the specified module.

Arguments
ast::add_simulate_macro(module: Module?; annotation: smart_ptr<SimulateMacro>&)

Adds an AstSimulateMacro adapter to the specified module.

Arguments

10.2.12.3. add_structure_annotation

ast::add_structure_annotation(structure: smart_ptr<Structure>; annotation: smart_ptr<StructureAnnotation>&)

Adds a structure annotation to the given object, calling apply if applicable.

Arguments
ast::add_structure_annotation(module: Module?; annotation: smart_ptr<StructureAnnotation>&)
ast::add_structure_annotation(structure: smart_ptr<Structure>; annotation: smart_ptr<AnnotationDeclaration>&)

ast::add_type_macro(module: Module?; annotation: smart_ptr<TypeMacro>&)

Adds an AstTypeMacro adapter to the specified module.

Arguments
ast::add_typeinfo_macro(module: Module?; annotation: smart_ptr<TypeInfoMacro>&)

Adds an AstTypeInfoMacro adapter to the specified module.

Arguments
ast::add_variant_macro(module: Module?; annotation: smart_ptr<VariantMacro>&)

Adds an AstVariantMacro adapter to the specified module.

Arguments

10.2.13. Adding objects to objects

ast::add_alias(module: Module?; structure: smart_ptr<TypeDecl>&) : bool()

Adds a type alias to the specified module.

Arguments
  • module : Module? implicit

  • structure : smart_ptr< TypeDecl>& implicit

ast::add_enumeration_entry(enum: smart_ptr<Enumeration>; name: string) : int()

Adds a new entry to an enumeration annotation.

Arguments
  • enum : smart_ptr< Enumeration> implicit

  • name : string implicit

ast::add_function(module: Module?; function: smart_ptr<Function>&) : bool()

Adds a function to a module, returning false if a duplicate already exists.

Arguments
ast::add_generic(module: Module?; function: smart_ptr<Function>&) : bool()

Adds a generic function to a module, returning false if a duplicate already exists.

Arguments
ast::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

ast::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

ast::add_structure(module: Module?; structure: smart_ptr<Structure>&) : bool()

Adds a structure to a module, returning false if a duplicate already exists.

Arguments
ast::add_structure_alias(structure: Structure?; aliasName: string; alias: smart_ptr<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 : smart_ptr< TypeDecl>& implicit

ast::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

ast::add_variable(module: Module?; variable: smart_ptr<Variable>&) : bool()

Adds a variable to a module, returning false if a duplicate already exists.

Arguments

10.2.14. Program and module access

ast::compiling_module() : Module?()

Returns the module currently being compiled.

ast::compiling_program() : smart_ptr<Program>()

Returns the program currently being compiled.

ast::this_module() : Module?()

Returns the main module attached to the current context, throwing an error if RTTI is disabled.

ast::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

ast::das_to_string(type: Type) : string()

Returns the name of the corresponding daslang base type as a string.

Arguments

10.2.15.1. describe

ast::describe(expr: smart_ptr<Function>) : auto()

Produces a daslang source code string representation of the given AST object.

Arguments
ast::describe(expr: smart_ptr<Expression>) : auto()
ast::describe(decl: smart_ptr<TypeDecl>; extra: bool = true; contracts: bool = true; modules: bool = true) : auto()

ast::describe_cpp(decl: smart_ptr<TypeDecl>; substitureRef: bool = false; skipRef: bool = false; skipConst: bool = false; redundantConst: bool = true; chooseSmartPtr: bool = true) : auto()

Produces a C++ source code string representation of the given TypeDecl.

Arguments
  • decl : smart_ptr< TypeDecl>

  • substitureRef : bool

  • skipRef : bool

  • skipConst : bool

  • redundantConst : bool

  • chooseSmartPtr : bool

ast::describe_expression(expression: smart_ptr<Expression>) : string()

Returns a string description of the Expression matching the corresponding daslang source code.

Arguments
ast::describe_function(function: smart_ptr<Function>) : string()

Returns a string description of the Function matching the corresponding daslang function declaration.

Arguments
  • function : smart_ptr< Function> implicit

ast::describe_typedecl(type: smart_ptr<TypeDecl>; extra: bool; contracts: bool; module: bool) : string()

Returns a string description of the TypeDecl matching the corresponding daslang type declaration.

Arguments
  • type : smart_ptr< TypeDecl> implicit

  • extra : bool

  • contracts : bool

  • module : bool

ast::describe_typedecl_cpp(type: smart_ptr<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 : smart_ptr< TypeDecl> implicit

  • substitueRef : bool

  • skipRef : bool

  • skipConst : bool

  • redundantConst : bool

  • choose_smart_ptr : bool

10.2.16. Searching

ast::find_bitfield_name(bit: smart_ptr<TypeDecl>; value: bitfield) : string()

Finds the name of a bitfield value in the specified type.

Arguments
  • bit : smart_ptr< TypeDecl> implicit

  • value : bitfield<>

ast::find_call_macro(module: Module?; name: string) : CallMacro?()

Finds a CallMacro by name in the specified module.

Arguments
  • module : Module? implicit

  • name : string implicit

ast::find_compiling_function_by_mangled_name_hash(moduleName: string; mangledNameHash: uint64) : smart_ptr<Function>()

Returns a Function from the currently compiling program given its mangled name hash.

Arguments
  • moduleName : string implicit

  • mangledNameHash : uint64

ast::find_compiling_module(name: string) : Module?()

Finds a module by name in the currently compiling program.

Arguments
  • name : string

ast::find_enum_name(enum: Enumeration?; value: int64) : string()

Finds the name corresponding to an enumeration value in the specified type.

Arguments

10.2.16.1. find_enum_value

ast::find_enum_value(enum: Enumeration?; value: string) : int64()

Finds the integer value corresponding to an enumeration name in the specified type.

Arguments
ast::find_enum_value(enum: smart_ptr<Enumeration>; value: string) : int64()

ast::find_matching_variable(program: Program?; function: Function?; name: string; seePrivate: bool; block: block<(array<smart_ptr<Variable>>#):void>)

Finds a global or shared variable accessible from the given function, according to visibility and privacy rules.

Arguments
  • program : Program? implicit

  • function : Function? implicit

  • name : string implicit

  • seePrivate : bool

  • block : block<(array<smart_ptr< Variable>>#):void> implicit

10.2.16.2. find_module

ast::find_module(name: string) : Module?()

Finds a module by name in the specified program.

Arguments
  • name : string

ast::find_module(prog: smart_ptr<Program>; name: string) : Module?()

ast::find_module_function_via_rtti(module: Module?; function: function<():void>) : smart_ptr<Function>()

Finds a function by name in the specified module using RTTI.

Arguments
  • module : Module? implicit

  • function : function<void>

ast::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

ast::find_struct_field_parent(structure: smart_ptr<Structure>; name: string) : Structure const?()

Finds the parent structure that declares the specified field.

Arguments
  • structure : smart_ptr< Structure> implicit

  • name : string implicit

ast::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

ast::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

ast::find_variable(module: Module?; variable: string) : smart_ptr<Variable>()

Finds a variable by name in the specified module.

Arguments
  • module : Module? implicit

  • variable : string implicit

10.2.17. Iterating

ast::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

ast::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

ast::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

ast::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

ast::for_each_enumeration(module: Module?; block: block<(smart_ptr<Enumeration>):void>)

Iterates through every enumeration in the specified module.

Arguments
ast::for_each_field(annotation: BasicStructureAnnotation; block: block<(string;string;smart_ptr<TypeDecl>;uint):void>)

Iterates through every field in a BuiltinStructure handled type.

Arguments
ast::for_each_for_loop_macro(module: Module?; block: block<(smart_ptr<ForLoopMacro>):void>)

Iterates through every for-loop macro in the specified module.

Arguments
ast::for_each_function(module: Module?; name: string; block: block<(smart_ptr<Function>):void>)

Iterates through each function in the given module, matching all functions if the name is empty.

Arguments
  • module : Module? implicit

  • name : string implicit

  • block : block<(smart_ptr< Function>):void> implicit

10.2.17.1. for_each_generic

ast::for_each_generic(module: Module?; name: string; block: block<(smart_ptr<Function>):void>)

Iterates through each generic function in the given module.

Arguments
  • module : Module? implicit

  • name : string implicit

  • block : block<(smart_ptr< Function>):void> implicit

ast::for_each_generic(module: Module?; block: block<(smart_ptr<Function>):void>)

ast::for_each_global(module: Module?; block: block<(smart_ptr<Variable>):void>)

Iterates through every global variable in the specified module.

Arguments
  • module : Module? implicit

  • block : block<(smart_ptr< Variable>):void> implicit

ast::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

ast::for_each_module_function(module: Module?; blk: block<(smart_ptr<Function>):void>)

Iterates through each function in the given module.

Arguments
  • module : Module? implicit

  • blk : block<(smart_ptr< Function>):void> implicit

ast::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

ast::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

ast::for_each_structure(module: Module?; block: block<(smart_ptr<Structure>):void>)

Iterates through every structure in the specified module.

Arguments
  • module : Module? implicit

  • block : block<(smart_ptr< Structure>):void> implicit

ast::for_each_structure_alias(structure: Structure?; block: block<(smart_ptr<TypeDecl>):void>)

Iterates over all structure aliases defined in the given structure type, invoking the provided block for each alias.

Arguments
  • structure : Structure? implicit

  • block : block<(smart_ptr< TypeDecl>):void> implicit

ast::for_each_typedef(module: Module?; block: block<(string#;smart_ptr<TypeDecl>):void>)

Iterates through every typedef in the specified module.

Arguments
  • module : Module? implicit

  • block : block<(string#;smart_ptr< TypeDecl>):void> implicit

ast::for_each_typeinfo_macro(module: Module?; block: block<(smart_ptr<TypeInfoMacro>):void>)

Iterates through each typeinfo macro in the given module.

Arguments
ast::for_each_typemacro(module: Module?; block: block<(smart_ptr<TypeMacro>):void>)

Iterates over all type macros registered in the given module, invoking the provided block for each one.

Arguments
  • module : Module? implicit

  • block : block<(smart_ptr< TypeMacro>):void> implicit

ast::for_each_variant_macro(module: Module?; block: block<(smart_ptr<VariantMacro>):void>)

Iterates through each variant macro in the given module.

Arguments

10.2.18. Cloning

ast::clone_expression(expression: smart_ptr<Expression>) : smart_ptr<Expression>()

Clones an Expression along with all its subexpressions and corresponding type information.

Arguments
ast::clone_file_info(name: string; tab_size: int) : FileInfo?()

Clones a FileInfo structure.

Arguments
  • name : string implicit

  • tab_size : int

10.2.18.1. clone_function

ast::clone_function(function: smart_ptr<Function>) : smart_ptr<Function>()

Clones a Function and all of its contents.

Arguments
  • function : smart_ptr< Function> implicit

ast::clone_function(fn: Function?) : FunctionPtr()

ast::clone_structure(structure: Structure const?) : smart_ptr<Structure>()

Returns a deep clone of the specified Structure.

Arguments
ast::clone_type(type: smart_ptr<TypeDecl>) : smart_ptr<TypeDecl>()

Clones a TypeDecl along with all its subtypes.

Arguments
ast::clone_variable(variable: smart_ptr<Variable>) : smart_ptr<Variable>()

Clones a Variable and all of its contents.

Arguments
  • variable : smart_ptr< Variable> implicit

10.2.19. Mangled name

10.2.19.1. get_mangled_name

ast::get_mangled_name(function: smart_ptr<Function>) : string()

Returns the mangled name of the specified object.

Arguments
  • function : smart_ptr< Function> implicit

ast::get_mangled_name(type: smart_ptr<TypeDecl>) : string()
ast::get_mangled_name(variable: smart_ptr<Variable>) : string()
ast::get_mangled_name(variable: smart_ptr<ExprBlock>) : string()
ast::get_mangled_name(decl: TypeDecl?) : auto()
ast::get_mangled_name(fn: Function?) : auto()
ast::get_mangled_name(decl: Variable?) : auto()
ast::get_mangled_name(decl: ExprBlock?) : auto()

ast::parse_mangled_name(txt: string; lib: ModuleGroup; thisModule: Module?) : smart_ptr<TypeDecl>()

Parses a mangled name string and creates the corresponding TypeDecl.

Arguments

10.2.20. Size and offset

ast::any_array_size(array: void?) : int()

Returns the size of an array from a pointer to an array<> object.

Arguments
  • array : void? implicit

ast::any_table_size(table: void?) : int()

Returns the size of a table from a pointer to a table<> object.

Arguments
  • table : void? implicit

ast::get_handled_type_field_offset(type: smart_ptr<TypeAnnotation>; field: string) : uint()

Returns the byte offset of a field in a ManagedStructure handled type.

Arguments
ast::get_tuple_field_offset(typle: smart_ptr<TypeDecl>; index: int) : int()

Returns the byte offset of a tuple field.

Arguments
  • typle : smart_ptr< TypeDecl> implicit

  • index : int

ast::get_variant_field_offset(variant: smart_ptr<TypeDecl>; index: int) : int()

Returns the byte offset of a variant field.

Arguments
  • variant : smart_ptr< TypeDecl> implicit

  • index : int

10.2.21. Evaluations

ast::eval_single_expression(expr: smart_ptr<Expression> const&; ok: bool&) : float4()

Warning

This is unsafe operation.

Simulates and evaluates a single expression on a separate context.

Arguments
  • expr : smart_ptr< Expression>& implicit

  • ok : bool& implicit

10.2.22. Error reporting

ast::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

10.2.23. Location and context

ast::collect_dependencies(function: smart_ptr<Function>; block: block<(array<Function?>;array<Variable?>):void>)

Collects dependencies of a given function, including other functions it calls and global variables it accesses.

Arguments

10.2.23.1. force_at

ast::force_at(function: smart_ptr<Function> const&; at: LineInfo)

Replaces line info in an expression, its subexpressions, and their types.

Arguments
ast::force_at(expression: smart_ptr<Expression> const&; at: LineInfo)

ast::get_ast_context(program: smart_ptr<Program>; expression: smart_ptr<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

ast::get_use_functions(func: smart_ptr<Function>; block: block<(smart_ptr<Function>):void>)

Invokes a block with the list of all functions called by the specified function.

Arguments
  • func : smart_ptr< Function> implicit

  • block : block<(smart_ptr< Function>):void> implicit

ast::get_use_global_variables(func: smart_ptr<Function>; block: block<(smart_ptr<Variable>):void>)

Invokes a block with the list of all global variables accessed by the specified function.

Arguments
  • func : smart_ptr< Function> implicit

  • block : block<(smart_ptr< Variable>):void> implicit

10.2.25. Log

ast::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

ast::remove_structure(module: Module?; structure: smart_ptr<Structure>&) : bool()

Removes a structure declaration from the specified module.

Arguments

10.2.27. Properties

ast::can_access_global_variable(variable: smart_ptr<Variable> const&; module: Module?; thisModule: Module?) : bool()

Returns true if a global variable is accessible from the specified module.

Arguments
ast::get_aot_arg_prefix(func: Function?; call: ExprCallFunc?; argIndex: int) : string()

Returns the AOT argument prefix string for the specified function.

Arguments
ast::get_aot_arg_suffix(func: Function?; call: ExprCallFunc?; argIndex: int) : string()

Returns the AOT argument suffix string for the specified function.

Arguments
ast::get_aot_name(func: Function?; call: ExprCallFunc?) : string()

Returns the AOT-generated name for the specified function.

Arguments
ast::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

ast::get_field_type(type: smart_ptr<TypeDecl>; fieldName: string; constant: bool) : smart_ptr<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 : smart_ptr< TypeDecl> implicit

  • fieldName : string implicit

  • constant : bool

ast::get_func_aot_prefix(ann: FunctionAnnotation?; stg: StringBuilderWriter?; call: ExprCallFunc?)

Returns the AOT function prefix string for the specified function.

Arguments
ast::get_function_aot_hash(fun: Function const?) : uint64()

Returns the hash of a function used for AOT matching.

Arguments
ast::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

ast::get_handled_type_field_type(type: smart_ptr<TypeAnnotation>; field: string) : TypeInfo?()

Returns the type of a field in a ManagedStructure handled type.

Arguments
ast::get_handled_type_field_type_declaration(type: smart_ptr<TypeAnnotation>; field: string; isConst: bool) : smart_ptr<TypeDecl>()

Returns the type declaration of a field in a ManagedStructure handled type.

Arguments
  • type : smart_ptr< TypeAnnotation> implicit

  • field : string implicit

  • isConst : bool

ast::get_handled_type_index_type_declaration(type: TypeAnnotation?; src: Expression?; idx: Expression?) : smart_ptr<TypeDecl>()

Returns the type declaration of the index operator for a handled type.

Arguments
ast::get_struct_aot_prefix(ann: StructureAnnotation?; structure: Structure?; args: AnnotationArgumentList; stg: StringBuilderWriter?)

Returns the AOT prefix string for the specified structure.

Arguments
ast::get_structure_alias(structure: Structure?; aliasName: string) : smart_ptr<TypeDecl>()

Finds and returns a structure alias type by its alias name.

Arguments
  • structure : Structure? implicit

  • aliasName : string implicit

ast::get_underlying_value_type(type: smart_ptr<TypeDecl>) : smart_ptr<TypeDecl>()

Returns the daslang type aliased by a ManagedValue handled type.

Arguments
ast::get_vector_length(vec: void?; type: smart_ptr<TypeDecl>) : int()

Returns the length of a vector given a pointer to the vector object and its TypeDeclPtr.

Arguments
  • vec : void? implicit

  • type : smart_ptr< TypeDecl> implicit

ast::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

ast::has_field(type: smart_ptr<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 : smart_ptr< TypeDecl> implicit

  • fieldName : string implicit

  • constant : bool

ast::is_expr_const(expression: smart_ptr<Expression> const&) : bool()

Returns true if the expression is or inherits from ExprConst.

Arguments
ast::is_expr_like_call(expression: smart_ptr<Expression> const&) : bool()

Returns true if the expression is or inherits from ExprLooksLikeCall.

Arguments

10.2.27.1. is_same_type

ast::is_same_type(leftType: smart_ptr<TypeDecl>; rightType: smart_ptr<TypeDecl>; refMatters: RefMatters; constMatters: ConstMatters; tempMatters: TemporaryMatters) : bool()

Compares two types using the given comparison parameters and returns true if they match.

Arguments
ast::is_same_type(argType: smart_ptr<TypeDecl>; passType: smart_ptr<TypeDecl>; refMatters: bool; constMatters: bool; temporaryMatters: bool; allowSubstitute: bool) : bool()

ast::is_temp_type(type: smart_ptr<TypeDecl>; refMatters: bool) : bool()

Returns true if the specified type can be temporary.

Arguments
  • type : smart_ptr< TypeDecl> implicit

  • refMatters : bool

ast::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

ast::infer_generic_type(type: smart_ptr<TypeDecl>; passType: smart_ptr<TypeDecl>; topLevel: bool; isPassType: bool) : smart_ptr<TypeDecl>()

Infers a concrete type from a generic type declaration and a pass type.

Arguments
  • type : smart_ptr< TypeDecl> implicit

  • passType : smart_ptr< TypeDecl> implicit

  • topLevel : bool

  • isPassType : bool

ast::update_alias_map(program: smart_ptr<Program>; argType: smart_ptr<TypeDecl>; passType: smart_ptr<TypeDecl>)

Updates the alias map for the specified type during inference.

Arguments
  • program : smart_ptr< Program> implicit

  • argType : smart_ptr< TypeDecl> implicit

  • passType : smart_ptr< TypeDecl> implicit

10.2.29. Module queries

ast::module_find_annotation(module: Module const?; name: string) : smart_ptr<Annotation>()

Finds an annotation by name in the specified module.

Arguments
  • module : Module? implicit

  • name : string implicit

ast::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

ast::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

ast::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

ast::debug_helper_find_struct_cppname(helper: smart_ptr<DebugInfoHelper> const&; struct_info: StructInfo?) : string()

Finds a structure in the DebugInfoHelper and returns its C++ name.

Arguments
ast::debug_helper_find_type_cppname(helper: smart_ptr<DebugInfoHelper> const&; type_info: TypeInfo?) : string()

Finds a type in the DebugInfoHelper and returns its C++ name.

Arguments
ast::debug_helper_iter_enums(helper: smart_ptr<DebugInfoHelper>; blk: block<(string;EnumInfo?):void>)

Iterates through all enumerations in the DebugInfoHelper, invoking the provided block for each one.

Arguments
ast::debug_helper_iter_funcs(helper: smart_ptr<DebugInfoHelper>; blk: block<(string;FuncInfo?):void>)

Iterates through all functions in the DebugInfoHelper, invoking the provided block for each one.

Arguments
ast::debug_helper_iter_structs(helper: smart_ptr<DebugInfoHelper>; blk: block<(string;StructInfo?):void>)

Iterates through all structures in the DebugInfoHelper, invoking the provided block for each one.

Arguments
ast::debug_helper_iter_types(helper: smart_ptr<DebugInfoHelper>; blk: block<(string;TypeInfo?):void>)

Iterates through all types in the DebugInfoHelper, invoking the provided block for each one.

Arguments
ast::debug_helper_iter_vars(helper: smart_ptr<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

ast::aot_need_type_info(macro: TypeInfoMacro const?; expr: smart_ptr<Expression>) : bool()

Returns true if a TypeInfo? is needed for the specified type in a typeinfo expression.

Arguments
ast::aot_previsit_get_field(ann: TypeAnnotation?; ss: StringBuilderWriter?; name: string)

Performs the pre-visit step for field access during AOT code generation.

Arguments
ast::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
ast::aot_require(mod: Module?; ss: StringBuilderWriter?) : bool()

Writes data to the require section of an AOT module.

Arguments
ast::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
ast::aot_visit_get_field(ann: TypeAnnotation?; ss: StringBuilderWriter?; name: string)

Performs the visit step for field access during AOT code generation.

Arguments
ast::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

ast::macro_aot_infix(macro: TypeInfoMacro?; ss: StringBuilderWriter?; expr: smart_ptr<Expression>) : bool()

Returns true if the macro requires an AOT infix operator for the specified handled type.

Arguments
ast::write_aot_body(structure: StructureAnnotation?; st: smart_ptr<Structure>; args: AnnotationArgumentList; writer: StringBuilderWriter?)

Writes the AOT body code for the specified StructureAnnotation.

Arguments
ast::write_aot_macro_prefix(macro: TypeInfoMacro?; ss: StringBuilderWriter?; expr: smart_ptr<Expression>)

Writes the AOT macro prefix code for the specified TypeInfoMacro.

Arguments
ast::write_aot_macro_suffix(macro: TypeInfoMacro?; ss: StringBuilderWriter?; expr: smart_ptr<Expression>)

Writes the AOT macro suffix code for the specified TypeInfoMacro.

Arguments
ast::write_aot_suffix(structure: StructureAnnotation?; st: smart_ptr<Structure>; args: AnnotationArgumentList; writer: StringBuilderWriter?)

Writes the AOT suffix code for the specified StructureAnnotation.

Arguments

10.2.32. String builder writer

ast::string_builder_clear(ss: StringBuilderWriter?)

Clears a StringBuilder object given a pointer to it.

Arguments
ast::string_builder_str(ss: StringBuilderWriter?) : string()

Returns the accumulated string from a StringBuilder object given a pointer to it.

Arguments