Fix emitter usage.

This commit is contained in:
lzwdgc 2020-12-08 18:41:33 +03:00
parent d16180dce7
commit 58e1c6eafb

View file

@ -107,7 +107,7 @@ global_statements: global_statement
{ {
auto &ctx = $1; auto &ctx = $1;
ctx.addLine(); ctx.addLine();
ctx.addEmitter($2); ctx.addEmitter(std::move($2));
$$ = std::move(ctx); $$ = std::move(ctx);
} }
; ;
@ -140,7 +140,7 @@ procedure: procedure_begin proc_statements END
{ {
Emitter ctx; Emitter ctx;
ctx.beginBlock($1); ctx.beginBlock($1);
ctx.addEmitter($2); ctx.addEmitter(std::move($2));
ctx.endBlock(); ctx.endBlock();
$$ = std::move(ctx); $$ = std::move(ctx);
} }
@ -155,7 +155,7 @@ procedure: procedure_begin proc_statements END
{ {
Emitter ctx; Emitter ctx;
ctx.beginBlock($1); ctx.beginBlock($1);
ctx.addEmitter($3); ctx.addEmitter(std::move($3));
ctx.endBlock(); ctx.endBlock();
$$ = std::move(ctx); $$ = std::move(ctx);
} }
@ -171,7 +171,7 @@ proc_statements: proc_statement
| proc_statements proc_statement | proc_statements proc_statement
{ {
auto &ctx = $1; auto &ctx = $1;
ctx.addEmitter($2); ctx.addEmitter(std::move($2));
$$ = std::move(ctx); $$ = std::move(ctx);
} }
; ;
@ -202,7 +202,7 @@ statements: statement
| statements statement | statements statement
{ {
auto &ctx = $1; auto &ctx = $1;
ctx.addEmitter($2); ctx.addEmitter(std::move($2));
$$ = std::move(ctx); $$ = std::move(ctx);
} }
; ;
@ -244,7 +244,7 @@ condition: condition_begin
{ {
auto &ctx = $1; auto &ctx = $1;
ctx.beginBlock("else"); ctx.beginBlock("else");
ctx.addEmitter($4); ctx.addEmitter(std::move($4));
ctx.endBlock(); ctx.endBlock();
$$ = std::move(ctx); $$ = std::move(ctx);
} }
@ -253,7 +253,7 @@ condition_begin: IF L_BRACKET condition_body R_BRACKET L_CURLY_BRACKET statement
{ {
Emitter ctx; Emitter ctx;
ctx.beginBlock("if (" + $3 + ")"); ctx.beginBlock("if (" + $3 + ")");
ctx.addEmitter($6); ctx.addEmitter(std::move($6));
ctx.endBlock(); ctx.endBlock();
$$ = std::move(ctx); $$ = std::move(ctx);
} }
@ -261,7 +261,7 @@ condition_begin: IF L_BRACKET condition_body R_BRACKET L_CURLY_BRACKET statement
{ {
Emitter ctx; Emitter ctx;
ctx.beginBlock("if (" + $3 + ")"); ctx.beginBlock("if (" + $3 + ")");
ctx.addEmitter($5); ctx.addEmitter(std::move($5));
ctx.endBlock(); ctx.endBlock();
$$ = std::move(ctx); $$ = std::move(ctx);
} }