OpenClonk
C4AulCompiler::PreparseAstVisitor Class Reference
Inheritance diagram for C4AulCompiler::PreparseAstVisitor:
[legend]
Collaboration diagram for C4AulCompiler::PreparseAstVisitor:
[legend]

Public Member Functions

 PreparseAstVisitor (C4ScriptHost *host, C4ScriptHost *source_host, C4AulScriptFunc *func=nullptr)
 
 PreparseAstVisitor (C4AulScriptFunc *func)
 
 ~PreparseAstVisitor () override=default
 
void visit (const ::aul::ast::RangeLoop *n) override
 
void visit (const ::aul::ast::VarDecl *n) override
 
void visit (const ::aul::ast::FunctionDecl *n) override
 
void visit (const ::aul::ast::CallExpr *n) override
 
void visit (const ::aul::ast::ParExpr *n) override
 
void visit (const ::aul::ast::AppendtoPragma *n) override
 
void visit (const ::aul::ast::IncludePragma *n) override
 
void visit (const ::aul::ast::Script *n) override
 
void visit (const ::aul::ast::ArrayLit *n) override
 
void visit (const ::aul::ast::ProplistLit *n) override
 
void visit (const ::aul::ast::UnOpExpr *n) override
 
void visit (const ::aul::ast::BinOpExpr *n) override
 
void visit (const ::aul::ast::AssignmentExpr *n) override
 
void visit (const ::aul::ast::SubscriptExpr *n) override
 
void visit (const ::aul::ast::SliceExpr *n) override
 
void visit (const ::aul::ast::Block *n) override
 
void visit (const ::aul::ast::Return *n) override
 
void visit (const ::aul::ast::ForLoop *n) override
 
void visit (const ::aul::ast::DoLoop *n) override
 
void visit (const ::aul::ast::WhileLoop *n) override
 
void visit (const ::aul::ast::If *n) override
 
void visit (const ::aul::ast::FunctionExpr *n) override
 
virtual void visit (const ::aul::ast::Noop *)
 
virtual void visit (const ::aul::ast::StringLit *)
 
virtual void visit (const ::aul::ast::IntLit *)
 
virtual void visit (const ::aul::ast::BoolLit *)
 
virtual void visit (const ::aul::ast::NilLit *)
 
virtual void visit (const ::aul::ast::ThisLit *)
 
virtual void visit (const ::aul::ast::VarExpr *n)
 
virtual void visit (const ::aul::ast::Break *)
 
virtual void visit (const ::aul::ast::Continue *)
 
template<class T >
void visit (const T *)=delete
 

Detailed Description

Definition at line 124 of file C4AulCompiler.cpp.

Constructor & Destructor Documentation

◆ PreparseAstVisitor() [1/2]

C4AulCompiler::PreparseAstVisitor::PreparseAstVisitor ( C4ScriptHost host,
C4ScriptHost source_host,
C4AulScriptFunc func = nullptr 
)
inline

Definition at line 134 of file C4AulCompiler.cpp.

134 : target_host(host), host(source_host), Fn(func) {}

◆ PreparseAstVisitor() [2/2]

C4AulCompiler::PreparseAstVisitor::PreparseAstVisitor ( C4AulScriptFunc func)
inlineexplicit

Definition at line 135 of file C4AulCompiler.cpp.

References visit(), and ~PreparseAstVisitor().

135 : Fn(func), target_host(func->pOrgScript), host(target_host) {}
C4ScriptHost * pOrgScript
Here is the call graph for this function:

◆ ~PreparseAstVisitor()

C4AulCompiler::PreparseAstVisitor::~PreparseAstVisitor ( )
overridedefault

Referenced by PreparseAstVisitor().

Here is the caller graph for this function:

Member Function Documentation

◆ visit() [1/32]

virtual void aul::AstVisitor::visit ( const ::aul::ast::Noop )
inlinevirtualinherited

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 63 of file C4AulAST.h.

63 {}

◆ visit() [2/32]

virtual void aul::AstVisitor::visit ( const ::aul::ast::StringLit )
inlinevirtualinherited

Reimplemented in C4AulCompiler::ConstexprEvaluator, and C4AulCompiler::CodegenAstVisitor.

Definition at line 64 of file C4AulAST.h.

64 {}

◆ visit() [3/32]

virtual void aul::AstVisitor::visit ( const ::aul::ast::IntLit )
inlinevirtualinherited

Reimplemented in C4AulCompiler::ConstexprEvaluator, and C4AulCompiler::CodegenAstVisitor.

Definition at line 65 of file C4AulAST.h.

65 {}

◆ visit() [4/32]

virtual void aul::AstVisitor::visit ( const ::aul::ast::BoolLit )
inlinevirtualinherited

Reimplemented in C4AulCompiler::ConstexprEvaluator, and C4AulCompiler::CodegenAstVisitor.

Definition at line 66 of file C4AulAST.h.

66 {}

◆ visit() [5/32]

virtual void aul::AstVisitor::visit ( const ::aul::ast::NilLit )
inlinevirtualinherited

Reimplemented in C4AulCompiler::ConstexprEvaluator, and C4AulCompiler::CodegenAstVisitor.

Definition at line 69 of file C4AulAST.h.

69 {}

◆ visit() [6/32]

virtual void aul::AstVisitor::visit ( const ::aul::ast::ThisLit )
inlinevirtualinherited

Reimplemented in C4AulCompiler::ConstexprEvaluator, and C4AulCompiler::CodegenAstVisitor.

Definition at line 70 of file C4AulAST.h.

70 {}

◆ visit() [7/32]

virtual void aul::AstVisitor::visit ( const ::aul::ast::VarExpr n)
inlinevirtualinherited

Reimplemented in C4AulCompiler::ConstexprEvaluator, and C4AulCompiler::CodegenAstVisitor.

Definition at line 71 of file C4AulAST.h.

71 {}

◆ visit() [8/32]

virtual void aul::AstVisitor::visit ( const ::aul::ast::Break )
inlinevirtualinherited

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 85 of file C4AulAST.h.

85 {}

◆ visit() [9/32]

virtual void aul::AstVisitor::visit ( const ::aul::ast::Continue )
inlinevirtualinherited

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 86 of file C4AulAST.h.

86 {}

◆ visit() [10/32]

template<class T >
void aul::AstVisitor::visit ( const T *  )
deleteinherited

◆ visit() [11/32]

void C4AulCompiler::PreparseAstVisitor::visit ( const ::aul::ast::RangeLoop n)
overridevirtual

Reimplemented from aul::DefaultRecursiveVisitor.

Definition at line 462 of file C4AulCompiler.cpp.

Referenced by C4AulCompiler::CodegenAstVisitor::CodegenAstVisitor(), C4AulCompiler::Preparse(), PreparseAstVisitor(), C4AulCompiler::ConstantResolver::resolve(), and C4AulCompiler::ConstexprEvaluator::visit().

463 {
464  const char *cname = n->var.c_str();
465  if (n->scoped_var)
466  {
467  Fn->VarNamed.AddName(cname);
468  }
469  else
470  {
471  // Loop variable not explicitly declared here. Look it up in
472  // the function and warn if it hasn't been declared at all.
473  if (Fn->VarNamed.GetItemNr(cname) == -1)
474  {
475  Warn(target_host, host, n, Fn, C4AulWarningId::implicit_range_loop_var_decl, cname);
476  Fn->VarNamed.AddName(cname);
477  }
478  }
479  DefaultRecursiveVisitor::visit(n);
480 }
std::string var
Definition: C4AulAST.h:307
int32_t AddName(const char *pnName)
Definition: C4ValueMap.cpp:429
C4ValueMapNames VarNamed
int32_t GetItemNr(const char *strName) const
Definition: C4ValueMap.cpp:459
Here is the caller graph for this function:

◆ visit() [12/32]

void C4AulCompiler::PreparseAstVisitor::visit ( const ::aul::ast::VarDecl n)
overridevirtual

Reimplemented from aul::DefaultRecursiveVisitor.

Definition at line 482 of file C4AulCompiler.cpp.

References aul::ast::VarDecl::Global.

483 {
485  {
486  Warn(target_host, host, n, Fn, C4AulWarningId::non_global_var_is_never_const);
487  }
488  for (const auto &var : n->decls)
489  {
490  const char *cname = var.name.c_str();
491  switch (n->scope)
492  {
493  case ::aul::ast::VarDecl::Scope::Func:
494  {
495  assert(Fn && "function-local var declaration outside of function");
496  if (!Fn)
497  throw Error(target_host, host, n, Fn, "internal error: function-local var declaration outside of function");
498 
499  if (target_host)
500  {
501  // if target_host is unset, we're parsing this func for direct execution,
502  // in which case we don't want to warn about variable hiding.
503  if (target_host->Engine->GlobalNamedNames.GetItemNr(cname) >= 0 || target_host->Engine->GlobalConstNames.GetItemNr(cname) >= 0)
504  Warn(target_host, host, n, Fn, C4AulWarningId::variable_shadows_variable, "local variable", cname, "global variable");
505  C4String *s = ::Strings.FindString(cname);
506  if (s && target_host->GetPropList()->HasProperty(s))
507  Warn(target_host, host, n, Fn, C4AulWarningId::variable_shadows_variable, "local variable", cname, "object-local variable");
508  if (Fn->ParNamed.GetItemNr(cname) != -1)
509  {
510  // The parameter order of this warning is correct:
511  // Aul looks up parameters before local variables, so
512  // the parameter actually shadows the local variable.
513  // This doesn't make a whole lot of sense and should
514  // probably be changed.
515  Warn(target_host, host, n, Fn, C4AulWarningId::variable_shadows_variable, "parameter", cname, "local variable");
516  }
517  }
518  Fn->VarNamed.AddName(cname);
519  break;
520  }
522  {
523  if (host->Engine->GlobalNamedNames.GetItemNr(cname) >= 0 || host->Engine->GlobalConstNames.GetItemNr(cname) >= 0)
524  Warn(target_host, host, n, Fn, C4AulWarningId::variable_shadows_variable, "object-local variable", cname, "global variable");
525  C4String *s = ::Strings.RegString(cname);
526  if (target_host->GetPropList()->HasProperty(s))
527  Warn(target_host, host, n, Fn, C4AulWarningId::redeclaration, "object-local variable", cname);
528  else
529  target_host->GetPropList()->SetPropertyByS(s, C4VNull);
530  break;
531  }
532  case ::aul::ast::VarDecl::Scope::Global:
533  assert(!Fn && "global var declaration inside function");
534  if (Fn)
535  throw Error(target_host, host, n, Fn, "internal error: global var declaration inside function");
536 
537  if (host->Engine->GlobalNamedNames.GetItemNr(cname) >= 0 || host->Engine->GlobalConstNames.GetItemNr(cname) >= 0)
538  Warn(target_host, host, n, Fn, C4AulWarningId::redeclaration, "global variable", cname);
539  if (n->constant)
540  host->Engine->GlobalConstNames.AddName(cname);
541  else
542  host->Engine->GlobalNamedNames.AddName(cname);
543  break;
544  }
545  }
546 
548  {
549  // only func-scoped variables can potentially have initializers we care
550  // about in the pre-parsing stage: they may have calls that pass
551  // unnamed parameters
552  DefaultRecursiveVisitor::visit(n);
553  }
554 }
C4ValueMapNames GlobalNamedNames
Definition: C4Aul.h:134
C4ValueMapNames ParNamed
C4String * RegString(StdStrBuf String)
C4AulScriptEngine * Engine
Definition: C4ScriptHost.h:76
virtual C4PropListStatic * GetPropList()
Definition: C4ScriptHost.h:50
C4ValueMapNames GlobalConstNames
Definition: C4Aul.h:141
int32_t AddName(const char *pnName)
Definition: C4ValueMap.cpp:429
C4StringTable Strings
Definition: C4Globals.cpp:42
C4ValueMapNames VarNamed
std::vector< Var > decls
Definition: C4AulAST.h:365
C4Object * Object(C4PropList *_this)
Definition: C4AulDefFunc.h:34
const C4Value C4VNull
Definition: C4Value.cpp:30
int32_t GetItemNr(const char *strName) const
Definition: C4ValueMap.cpp:459
C4String * FindString(const char *strString) const
virtual void SetPropertyByS(C4String *k, const C4Value &to)
Definition: C4PropList.cpp:971
#define s
bool HasProperty(C4String *k) const
Definition: C4PropList.h:118

◆ visit() [13/32]

void C4AulCompiler::PreparseAstVisitor::visit ( const ::aul::ast::FunctionDecl n)
overridevirtual

Reimplemented from aul::DefaultRecursiveVisitor.

Definition at line 556 of file C4AulCompiler.cpp.

References C4AUL_MAX_Par, C4VFunction(), C4ScriptHost::Engine, C4PropList::GetFunc(), C4ScriptHost::GetPropList(), C4AulScriptEngine::GetPropList(), C4ScriptHost::ownedFunctions, and C4PropList::SetPropertyByS().

557 {
558  // create script fn
559  C4PropListStatic *Parent = n->is_global ? target_host->Engine->GetPropList() : target_host->GetPropList();
560  const char *cname = n->name.c_str();
561 
562  assert(!Fn);
563 
564  // Look up the overloaded function before adding the overloading one
565  C4AulFunc *parent_func = Parent->GetFunc(cname);
566 
567  Fn = new C4AulScriptFunc(Parent, target_host, cname, n->loc);
568  host->ownedFunctions.push_back(C4VFunction(Fn));
569  for (const auto &param : n->params)
570  {
571  Fn->AddPar(param.name.c_str(), param.type);
572  }
573  if (n->has_unnamed_params)
574  Fn->ParCount = C4AUL_MAX_Par;
575 
576  // Add function to def/engine
577  Fn->SetOverloaded(parent_func);
578  Parent->SetPropertyByS(Fn->Name, C4VFunction(Fn));
579 
580  try
581  {
582  DefaultRecursiveVisitor::visit(n);
583  Fn = nullptr;
584  }
585  catch (...)
586  {
587  Fn = nullptr;
588  throw;
589  }
590 }
C4PropListStatic * GetPropList()
Definition: C4Aul.h:151
C4AulScriptEngine * Engine
Definition: C4ScriptHost.h:76
virtual C4PropListStatic * GetPropList()
Definition: C4ScriptHost.h:50
std::vector< Parameter > params
Definition: C4AulAST.h:377
#define C4AUL_MAX_Par
Definition: C4AulFunc.h:26
bool has_unnamed_params
Definition: C4AulAST.h:378
void AddPar(const char *Idtf, C4V_Type type=C4V_Any)
const char * loc
Definition: C4AulAST.h:123
void SetOverloaded(C4AulFunc *)
C4AulFunc * GetFunc(C4PropertyName k) const
Definition: C4PropList.h:105
std::string name
Definition: C4AulAST.h:390
C4Value C4VFunction(C4AulFunc *pFn)
Definition: C4Value.h:250
virtual void SetPropertyByS(C4String *k, const C4Value &to)
Definition: C4PropList.cpp:971
C4RefCntPointer< C4String > Name
Definition: C4AulFunc.h:60
std::vector< C4Value > ownedFunctions
Definition: C4ScriptHost.h:96
Here is the call graph for this function:

◆ visit() [14/32]

void C4AulCompiler::PreparseAstVisitor::visit ( const ::aul::ast::CallExpr n)
overridevirtual

Reimplemented from aul::DefaultRecursiveVisitor.

Definition at line 592 of file C4AulCompiler.cpp.

References C4AUL_MAX_Par.

593 {
594  if (n->append_unnamed_pars && Fn->ParCount != C4AUL_MAX_Par)
595  {
596  Fn->ParCount = C4AUL_MAX_Par;
597  }
598  DefaultRecursiveVisitor::visit(n);
599 }
bool append_unnamed_pars
Definition: C4AulAST.h:255
#define C4AUL_MAX_Par
Definition: C4AulFunc.h:26

◆ visit() [15/32]

void C4AulCompiler::PreparseAstVisitor::visit ( const ::aul::ast::ParExpr n)
overridevirtual

Reimplemented from aul::DefaultRecursiveVisitor.

Definition at line 601 of file C4AulCompiler.cpp.

References C4AUL_MAX_Par.

602 {
603  if (Fn->ParCount != C4AUL_MAX_Par)
604  {
605  Warn(target_host, host, n, Fn, C4AulWarningId::undeclared_varargs, "Par()");
606  Fn->ParCount = C4AUL_MAX_Par;
607  }
608  DefaultRecursiveVisitor::visit(n);
609 }
#define C4AUL_MAX_Par
Definition: C4AulFunc.h:26

◆ visit() [16/32]

void C4AulCompiler::PreparseAstVisitor::visit ( const ::aul::ast::AppendtoPragma n)
overridevirtual

Reimplemented from aul::AstVisitor.

Definition at line 611 of file C4AulCompiler.cpp.

References C4ScriptHost::Appends.

612 {
613  if (n->what.empty())
614  host->Appends.emplace_back("*");
615  else
616  host->Appends.emplace_back(n->what.c_str());
617 }
std::list< StdCopyStrBuf > Appends
Definition: C4ScriptHost.h:80

◆ visit() [17/32]

void C4AulCompiler::PreparseAstVisitor::visit ( const ::aul::ast::IncludePragma n)
overridevirtual

Reimplemented from aul::AstVisitor.

Definition at line 619 of file C4AulCompiler.cpp.

References C4ScriptHost::Includes.

620 {
621  host->Includes.emplace_back(n->what.c_str());
622 }
std::list< StdCopyStrBuf > Includes
Definition: C4ScriptHost.h:79

◆ visit() [18/32]

void C4AulCompiler::PreparseAstVisitor::visit ( const ::aul::ast::Script n)
overridevirtual

Reimplemented from aul::DefaultRecursiveVisitor.

Definition at line 624 of file C4AulCompiler.cpp.

References AB_ARRAY_SLICE, AB_ARRAY_SLICE_SET, AB_ARRAYA, AB_ARRAYA_SET, AB_BitAnd, AB_BitNot, AB_BitOr, AB_BitXOr, AB_BOOL, AB_CALL, AB_CALLFS, AB_CARRAY, AB_CFUNCTION, AB_COND, AB_CONDN, AB_CPROPLIST, AB_DEBUG, AB_Dec, AB_Div, AB_DUP, AB_DUP_CONTEXT, AB_EOFN, AB_Equal, AB_ERR, AB_FOREACH_NEXT, AB_FUNC, AB_GLOBALN, AB_GLOBALN_SET, AB_GreaterThan, AB_GreaterThanEqual, AB_Inc, AB_INT, AB_JUMP, AB_JUMPAND, AB_JUMPNNIL, AB_JUMPOR, AB_LeftShift, AB_LessThan, AB_LessThanEqual, AB_LOCALN, AB_LOCALN_SET, AB_Mod, AB_Mul, AB_Neg, AB_NEW_ARRAY, AB_NEW_PROPLIST, AB_NIL, AB_Not, AB_NotEqual, AB_PAR, AB_POP_TO, AB_Pow, AB_PROP, AB_PROP_SET, AB_RETURN, AB_RightShift, AB_STACK, AB_STACK_SET, AB_STRING, AB_Sub, AB_Sum, AB_THIS, C4AulBCC::bccType, C4AUL_MAX_Par, C4ScriptHost::Engine, C4AulScriptEngine::GetErrorHandler(), C4AulErrorHandler::OnError(), C4AulBCC::Par, C4AulError::what(), and X.

625 {
626  for (const auto &d : n->declarations)
627  {
628  try
629  {
630  d->accept(this);
631  }
632  catch (C4AulParseError &e)
633  {
634  target_host->Engine->GetErrorHandler()->OnError(e.what());
635  }
636  }
637 }
C4AulScriptEngine * Engine
Definition: C4ScriptHost.h:76
C4AulErrorHandler * GetErrorHandler() const
Definition: C4Aul.h:173
std::vector< DeclPtr > declarations
Definition: C4AulAST.h:425
const char * what() const noexcept override
Definition: C4Aul.cpp:59
virtual void OnError(const char *msg)=0
Here is the call graph for this function:

◆ visit() [19/32]

void aul::DefaultRecursiveVisitor::visit ( const ::aul::ast::ArrayLit n)
inlineoverridevirtualinherited

Reimplemented from aul::AstVisitor.

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 441 of file C4AulAST.h.

442  {
443  for (const auto &c : n->values)
444  c->accept(this);
445  }
std::vector< ExprPtr > values
Definition: C4AulAST.h:180

◆ visit() [20/32]

void aul::DefaultRecursiveVisitor::visit ( const ::aul::ast::ProplistLit n)
inlineoverridevirtualinherited

Reimplemented from aul::AstVisitor.

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 446 of file C4AulAST.h.

447  {
448  for (const auto &c : n->values)
449  c.second->accept(this);
450  }
std::vector< std::pair< std::string, ExprPtr > > values
Definition: C4AulAST.h:187

◆ visit() [21/32]

void aul::DefaultRecursiveVisitor::visit ( const ::aul::ast::UnOpExpr n)
inlineoverridevirtualinherited

Reimplemented from aul::AstVisitor.

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 451 of file C4AulAST.h.

452  {
453  n->operand->accept(this);
454  }

◆ visit() [22/32]

void aul::DefaultRecursiveVisitor::visit ( const ::aul::ast::BinOpExpr n)
inlineoverridevirtualinherited

Reimplemented from aul::AstVisitor.

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 455 of file C4AulAST.h.

456  {
457  n->lhs->accept(this);
458  n->rhs->accept(this);
459  }

◆ visit() [23/32]

void aul::DefaultRecursiveVisitor::visit ( const ::aul::ast::AssignmentExpr n)
inlineoverridevirtualinherited

Reimplemented from aul::AstVisitor.

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 460 of file C4AulAST.h.

461  {
462  n->lhs->accept(this);
463  n->rhs->accept(this);
464  }

◆ visit() [24/32]

void aul::DefaultRecursiveVisitor::visit ( const ::aul::ast::SubscriptExpr n)
inlineoverridevirtualinherited

Reimplemented from aul::AstVisitor.

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 465 of file C4AulAST.h.

466  {
467  n->object->accept(this);
468  n->index->accept(this);
469  }

◆ visit() [25/32]

void aul::DefaultRecursiveVisitor::visit ( const ::aul::ast::SliceExpr n)
inlineoverridevirtualinherited

Reimplemented from aul::AstVisitor.

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 470 of file C4AulAST.h.

471  {
472  n->object->accept(this);
473  n->start->accept(this);
474  n->end->accept(this);
475  }

◆ visit() [26/32]

void aul::DefaultRecursiveVisitor::visit ( const ::aul::ast::Block n)
inlineoverridevirtualinherited

Reimplemented from aul::AstVisitor.

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 487 of file C4AulAST.h.

References s.

488  {
489  for (const auto &s : n->children)
490  s->accept(this);
491  }
std::vector< StmtPtr > children
Definition: C4AulAST.h:273
#define s

◆ visit() [27/32]

void aul::DefaultRecursiveVisitor::visit ( const ::aul::ast::Return n)
inlineoverridevirtualinherited

Reimplemented from aul::AstVisitor.

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 492 of file C4AulAST.h.

493  {
494  n->value->accept(this);
495  }
ExprPtr value
Definition: C4AulAST.h:284

◆ visit() [28/32]

void aul::DefaultRecursiveVisitor::visit ( const ::aul::ast::ForLoop n)
inlineoverridevirtualinherited

Reimplemented from aul::AstVisitor.

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 496 of file C4AulAST.h.

497  {
498  if (n->init)
499  n->init->accept(this);
500  if (n->cond)
501  n->cond->accept(this);
502  if (n->incr)
503  n->incr->accept(this);
504  n->body->accept(this);
505  }
StmtPtr body
Definition: C4AulAST.h:291
ExprPtr cond
Definition: C4AulAST.h:290

◆ visit() [29/32]

void aul::DefaultRecursiveVisitor::visit ( const ::aul::ast::DoLoop n)
inlineoverridevirtualinherited

Reimplemented from aul::AstVisitor.

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 511 of file C4AulAST.h.

512  {
513  n->body->accept(this);
514  n->cond->accept(this);
515  }
StmtPtr body
Definition: C4AulAST.h:291
ExprPtr cond
Definition: C4AulAST.h:290

◆ visit() [30/32]

void aul::DefaultRecursiveVisitor::visit ( const ::aul::ast::WhileLoop n)
inlineoverridevirtualinherited

Reimplemented from aul::AstVisitor.

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 516 of file C4AulAST.h.

517  {
518  n->cond->accept(this);
519  n->body->accept(this);
520  }
StmtPtr body
Definition: C4AulAST.h:291
ExprPtr cond
Definition: C4AulAST.h:290

◆ visit() [31/32]

void aul::DefaultRecursiveVisitor::visit ( const ::aul::ast::If n)
inlineoverridevirtualinherited

Reimplemented from aul::AstVisitor.

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 521 of file C4AulAST.h.

522  {
523  n->cond->accept(this);
524  n->iftrue->accept(this);
525  if (n->iffalse)
526  n->iffalse->accept(this);
527  }
ExprPtr cond
Definition: C4AulAST.h:338
StmtPtr iftrue
Definition: C4AulAST.h:339
StmtPtr iffalse
Definition: C4AulAST.h:339

◆ visit() [32/32]

void aul::DefaultRecursiveVisitor::visit ( const ::aul::ast::FunctionExpr n)
inlineoverridevirtualinherited

Reimplemented from aul::AstVisitor.

Reimplemented in C4AulCompiler::CodegenAstVisitor.

Definition at line 538 of file C4AulAST.h.

539  {
540  n->body->accept(this);
541  }
std::unique_ptr< Block > body
Definition: C4AulAST.h:379

The documentation for this class was generated from the following file: