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
17 class _nout defVarExpr: public expr {
18 BY(ADT(defVarExpr, expr), VISIT())
19
20 public:
21 defVarExpr(const std::string& name, const node* rhs);
22 defVarExpr(const std::string& name, const node* rhs, const node* to, const src& src, const modifier& mod);
23
24 public:
25 using super::run;
26 str run(const args& a) override;
27
28 const std::string& getName() const;
29
30 node* getRight();
31 const node* getRight() const BY_CONST_FUNC(getRight())
32 void setRight(const node& rhs);
33
34 node* getTo();
35 const node* getTo() const BY_CONST_FUNC(getTo())
36 nbool isToFrame() const;
37 void setTo(const node& to);
38
39 str getEval() const override;
40
41 void onCloneDeep(const clonable& rhs) override;
42
43 str makeNewOrigin();
44
45 const modifier& getNewModifier() const;
46
47 protected:
48 virtual str _onMakeNew() = 0;
49
50 private:
51 str _makeNew();
52
53 private:
54 std::string _name;
55 str _rhs;
56 str _to;
57 tstr<src> _src;
58 tstr<modifier> _mod;
59 };
60} // namespace by
Function call arguments container.
Definition: args.hpp:13
Interface for objects that can be cloned.
Definition: clonable.hpp:12
Variable definition expression base class.
Definition: defVarExpr.hpp:17
str getEval() const override
Base class for all expressions.
Definition: expr.hpp:15
Access modifier for class members and func.
Definition: modifier.hpp:12
Base class for all AST nodes in byeol language.
Definition: node.hpp:30
Source location information.
Definition: src.hpp:11