From a593bba4d72e23d07c272b5842e79c9836cad5f4 Mon Sep 17 00:00:00 2001 From: Garrit Franke Date: Sun, 6 Dec 2020 16:07:38 +0100 Subject: [PATCH] Remove uneeded compount statement --- examples/hello_world.sb | 6 ++++-- examples_out/out.js | 7 ++++--- src/generator/js.rs | 1 - src/parser/node_type.rs | 1 - 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/examples/hello_world.sb b/examples/hello_world.sb index a9f36ba..fdb0b0e 100644 --- a/examples/hello_world.sb +++ b/examples/hello_world.sb @@ -1,7 +1,9 @@ +// main.sb fn main() { - foo(2, 1); + return foo(2); } fn foo(x) { return x; -} \ No newline at end of file +} + diff --git a/examples_out/out.js b/examples_out/out.js index a2f284f..6b2a7c4 100644 --- a/examples_out/out.js +++ b/examples_out/out.js @@ -1,7 +1,8 @@ +// out.js function main() { -foo(2,1) + return foo(2); } function foo(x) { -return x + return x; } -console.log(main()) \ No newline at end of file +console.log(main()); diff --git a/src/generator/js.rs b/src/generator/js.rs index f3139ab..1168622 100644 --- a/src/generator/js.rs +++ b/src/generator/js.rs @@ -43,7 +43,6 @@ fn generate_statement(statement: Statement) -> String { Statement::Return(ret) => generate_return(ret), Statement::Declare(_, _) => todo!(), Statement::Exp(val) => generate_expression(val), - Statement::Compound(_) => todo!(), Statement::If(_, _, _) => todo!(), Statement::While(_, _) => todo!(), } diff --git a/src/parser/node_type.rs b/src/parser/node_type.rs index 01878bd..5e0ce30 100644 --- a/src/parser/node_type.rs +++ b/src/parser/node_type.rs @@ -23,7 +23,6 @@ pub enum Statement { If(Expression, Box, Option>), While(Expression, Box), Exp(Expression), - Compound(Vec), } #[derive(Debug, Eq, PartialEq)]