]> gitweb.ps.run Git - toc/blobdiff - src/repr.h
toc now uses internal representation instead of ast
[toc] / src / repr.h
index ce176efa455abdeb9b9998c191ecb1026a054986..6737ef4ce35d2b9b8a9fac64406811dc6656ceea 100644 (file)
@@ -43,6 +43,7 @@ struct Body {
 };\r
 \r
 struct Function {\r
+  Type returnType;\r
   std::string name;\r
   std::vector<Variable> parameters;\r
   Body body;\r
@@ -65,7 +66,7 @@ enum class ExprType {
 };\r
 \r
 struct CallExpr {\r
-  Function function;\r
+  std::string functionName;\r
   std::vector<Expr> arguments;\r
 };\r
 \r
@@ -78,11 +79,8 @@ struct VariableExpr {
 };\r
 \r
 struct BracketsExpr {\r
-  BracketsExpr() {}\r
-  BracketsExpr(const BracketsExpr &) {}\r
-  BracketsExpr & operator=(const BracketsExpr &) {return *this;};\r
-  std::unique_ptr<Expr> lexpr;\r
-  std::unique_ptr<Expr> rexpr;\r
+  std::shared_ptr<Expr> lexpr;\r
+  std::shared_ptr<Expr> rexpr;\r
 };\r
 \r
 enum class OperatorType {\r
@@ -92,19 +90,13 @@ enum class OperatorType {
 };\r
 \r
 struct OperatorExpr {\r
-  OperatorExpr() {}\r
-  OperatorExpr(const OperatorExpr &) {}\r
-  OperatorExpr & operator=(const OperatorExpr &) {return *this;};\r
-  std::unique_ptr<Expr> lexpr;\r
-  std::unique_ptr<Expr> rexpr;\r
+  std::shared_ptr<Expr> lexpr;\r
+  std::shared_ptr<Expr> rexpr;\r
   OperatorType type;\r
 };\r
 \r
 struct DotExpr {\r
-  DotExpr() {}\r
-  DotExpr(const DotExpr &) {}\r
-  DotExpr & operator=(const DotExpr &) {return *this;};\r
-  std::unique_ptr<Expr> lexpr;\r
+  std::shared_ptr<Expr> lexpr;\r
   std::string name;\r
 };\r
 \r