@@ -23,7 +23,7 @@ namespace CppUtils::Language::IR::Compiler
2323
2424 static void compileComma (const Lexer::ASTNode& astNode, Context& context)
2525 {
26- for (const auto & child : astNode.childs )
26+ for (const auto & child : astNode.children )
2727 context.compiler .get ().compile (child, context);
2828 }
2929
@@ -51,9 +51,9 @@ namespace CppUtils::Language::IR::Compiler
5151 {
5252 using namespace Type ::Literals;
5353 const auto lhsIsDeref = (astNode.getChildValue (0 ) == " deref" _token);
54- context.compiler .get ().compile (lhsIsDeref ? astNode.childs .at (0 ).childs .at (0 ) : astNode.childs .at (0 ), context);
54+ context.compiler .get ().compile (lhsIsDeref ? astNode.children .at (0 ).children .at (0 ) : astNode.children .at (0 ), context);
5555 const auto lhs = context.returnRegister ;
56- context.compiler .get ().compile (astNode.childs .at (1 ), context);
56+ context.compiler .get ().compile (astNode.children .at (1 ), context);
5757 const auto rhs = context.returnRegister ;
5858 context.returnRegister = lhs;
5959 context.addInstruction (context.createInstruction (lhsIsDeref ? " write" _token : " copy" _token, lhs, rhs));
@@ -62,9 +62,9 @@ namespace CppUtils::Language::IR::Compiler
6262 static void compileEq (const Lexer::ASTNode& astNode, Context& context)
6363 {
6464 using namespace Type ::Literals;
65- context.compiler .get ().compile (astNode.childs .at (0 ), context);
65+ context.compiler .get ().compile (astNode.children .at (0 ), context);
6666 const auto lhs = context.returnRegister ;
67- context.compiler .get ().compile (astNode.childs .at (1 ), context);
67+ context.compiler .get ().compile (astNode.children .at (1 ), context);
6868 const auto rhs = context.returnRegister ;
6969 context.returnRegister = lhs;
7070 context.addInstruction (context.createInstruction (" eq" _token, lhs, rhs));
@@ -73,9 +73,9 @@ namespace CppUtils::Language::IR::Compiler
7373 static void compileAdd (const Lexer::ASTNode& astNode, Context& context)
7474 {
7575 using namespace Type ::Literals;
76- context.compiler .get ().compile (astNode.childs .at (0 ), context);
76+ context.compiler .get ().compile (astNode.children .at (0 ), context);
7777 const auto lhs = context.returnRegister ;
78- context.compiler .get ().compile (astNode.childs .at (1 ), context);
78+ context.compiler .get ().compile (astNode.children .at (1 ), context);
7979 const auto rhs = context.returnRegister ;
8080 context.returnRegister = lhs;
8181 context.addInstruction (context.createInstruction (" add" _token, lhs, rhs));
@@ -84,32 +84,32 @@ namespace CppUtils::Language::IR::Compiler
8484 static void compileSub (const Lexer::ASTNode& astNode, Context& context)
8585 {
8686 using namespace Type ::Literals;
87- context.compiler .get ().compile (astNode.childs .at (0 ), context);
87+ context.compiler .get ().compile (astNode.children .at (0 ), context);
8888 const auto lhs = context.returnRegister ;
89- context.compiler .get ().compile (astNode.childs .at (1 ), context);
89+ context.compiler .get ().compile (astNode.children .at (1 ), context);
9090 const auto rhs = context.returnRegister ;
9191 context.returnRegister = lhs;
9292 context.addInstruction (context.createInstruction (" sub" _token, lhs, rhs));
9393 }
9494
9595 static void compileLabel (const Lexer::ASTNode& astNode, Context& context)
9696 {
97- const auto & label = std::get<Type::Token>(astNode.childs .at (1 ).value );
97+ const auto & label = std::get<Type::Token>(astNode.children .at (1 ).value );
9898 context.addFunction (label, 0 );
99- context.compiler .get ().compile (astNode.childs .at (2 ), context);
99+ context.compiler .get ().compile (astNode.children .at (2 ), context);
100100 }
101101
102102 static void compileRet (const Lexer::ASTNode& astNode, Context& context)
103103 {
104104 using namespace Type ::Literals;
105- context.compiler .get ().compile (astNode.childs .at (0 ), context);
105+ context.compiler .get ().compile (astNode.children .at (0 ), context);
106106 context.addInstruction (context.createInstruction (" ret" _token, context.returnRegister ));
107107 }
108108
109109 static void compileDeref (const Lexer::ASTNode& astNode, Context& context)
110110 {
111111 using namespace Type ::Literals;
112- context.compiler .get ().compile (astNode.childs .at (0 ), context);
112+ context.compiler .get ().compile (astNode.children .at (0 ), context);
113113 context.addInstruction (context.createInstruction (" read" _token, context.returnRegister ));
114114 }
115115
@@ -120,7 +120,7 @@ namespace CppUtils::Language::IR::Compiler
120120 const auto returnRegister = context.newRegister (), functionLabel = context.newRegister ();
121121 context.addInstruction (context.createInstruction (functionLabel, functionName.name ));
122122 auto parameters = std::vector<std::uintptr_t >{returnRegister, functionLabel};
123- std::transform (astNode.childs .begin () + 1 , astNode.childs .end (), std::back_inserter (parameters), [&context](const auto & astNode) -> std::uintptr_t {
123+ std::transform (astNode.children .begin () + 1 , astNode.children .end (), std::back_inserter (parameters), [&context](const auto & astNode) -> std::uintptr_t {
124124 context.compiler .get ().compile (astNode, context);
125125 return context.returnRegister ;
126126 });
@@ -131,10 +131,10 @@ namespace CppUtils::Language::IR::Compiler
131131 static void compileIf (const Lexer::ASTNode& astNode, Context& context)
132132 {
133133 using namespace Type ::Literals;
134- context.compiler .get ().compile (astNode.childs .at (0 ), context);
134+ context.compiler .get ().compile (astNode.children .at (0 ), context);
135135 auto * ifnz = context.createInstruction (" ifnz" _token, context.returnRegister );
136136 context.addInstruction (ifnz);
137- context.compiler .get ().compile (astNode.childs .at (1 ), context);
137+ context.compiler .get ().compile (astNode.children .at (1 ), context);
138138 ifnz->conditionInstruction = ifnz->nextInstruction ;
139139 auto * nop = context.createInstruction ();
140140 context.addInstruction (nop);
@@ -144,10 +144,10 @@ namespace CppUtils::Language::IR::Compiler
144144 static void compileWhile (const Lexer::ASTNode& astNode, Context& context)
145145 {
146146 using namespace Type ::Literals;
147- context.compiler .get ().compile (astNode.childs .at (0 ), context);
147+ context.compiler .get ().compile (astNode.children .at (0 ), context);
148148 auto * ifnz = context.createInstruction (" ifnz" _token, context.returnRegister );
149149 context.addInstruction (ifnz);
150- context.compiler .get ().compile (astNode.childs .at (1 ), context);
150+ context.compiler .get ().compile (astNode.children .at (1 ), context);
151151 ifnz->conditionInstruction = ifnz->nextInstruction ;
152152 auto * endThen = context.lastInstruction ;
153153 auto * nop = context.createInstruction ();
0 commit comments