Loading...
Searching...
No Matches
defVarExpr.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include "core/ast/expr.hpp"
5#include "core/ast/param.hpp"
6#include "core/ast/scope.hpp"
8
9namespace by {
10
11 class assignExpr;
12
18 class _nout defVarExpr: public expr {
19 BY(ADT(defVarExpr, expr), VISIT())
20
21 public:
22 defVarExpr(const std::string& name, const node* rhs);
23 defVarExpr(const std::string& name, const node* rhs, const node* to, const src& src, const modifier& mod);
24
25 public:
26 using super::eval;
27 str eval(const args& a) override;
28
29 const std::string& getName() const;
30
31 node* getRight();
32 const node* getRight() const BY_CONST_FUNC(getRight())
33 void setRight(const node& rhs);
34
41 const node* getTo() const BY_CONST_FUNC(getTo())
47 void setTo(const node& to);
48
50
51 void onCloneDeep(const clonable& rhs) override;
52
59 str makeNewOrigin();
60
61 const modifier& getNewModifier() const;
62
64 virtual str _onMakeNew() = 0;
65
66 private:
67 str _makeNew();
68
69 private:
70 std::string _name;
71 str _rhs;
72 str _to;
73 tstr<src> _src;
74 tstr<modifier> _mod;
75 };
76} // namespace by
Function or object evaluation arguments.
Definition args.hpp:22
Variable definition expression base class.
Definition defVarExpr.hpp:18
node * getTo()
Gets the target node where the variable is to be defined.
const node * getTo() const BY_CONST_FUNC(getTo()) nbool isToFrame() const
Checks if the target node ('to') represents a frame.
Base class for all expressions.
Definition expr.hpp:36
Access modifier for type members.
Definition modifier.hpp:13
Base class for all AST nodes in the byeol language.
Definition node.hpp:195
Source location information.
Definition src.hpp:15
Definition tnarr.hpp:9
to Top