Simple codegen for function calls
This commit is contained in:
parent
61de3b100f
commit
6b65cd4fd4
@ -13,7 +13,7 @@ impl Transpilable for Expression {
|
|||||||
match self {
|
match self {
|
||||||
Expression::Number(value) => format!("{}", value),
|
Expression::Number(value) => format!("{}", value),
|
||||||
Expression::String(value) => {
|
Expression::String(value) => {
|
||||||
format!("\"{}\"", *value)
|
format!("{}", *value)
|
||||||
}
|
}
|
||||||
Expression::Boolean(value) => String::from(if *value { "true" } else { "false" }),
|
Expression::Boolean(value) => String::from(if *value { "true" } else { "false" }),
|
||||||
Expression::Identifier(value) => format!("{}", *value),
|
Expression::Identifier(value) => format!("{}", *value),
|
||||||
|
9
src/codegen/function_call.rs
Normal file
9
src/codegen/function_call.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
use crate::syntax::ast::functions::FunctionCall;
|
||||||
|
|
||||||
|
use super::Transpilable;
|
||||||
|
|
||||||
|
impl Transpilable for FunctionCall {
|
||||||
|
fn transpile(&self) -> String {
|
||||||
|
format!("{}();", self.identifier)
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@ use crate::syntax::ast::ModuleAST;
|
|||||||
mod binding;
|
mod binding;
|
||||||
mod block;
|
mod block;
|
||||||
mod expression;
|
mod expression;
|
||||||
|
mod function_call;
|
||||||
mod function_declaration;
|
mod function_declaration;
|
||||||
mod module_ast;
|
mod module_ast;
|
||||||
mod statement;
|
mod statement;
|
||||||
|
@ -4,6 +4,9 @@ use super::Transpilable;
|
|||||||
|
|
||||||
impl Transpilable for Statement {
|
impl Transpilable for Statement {
|
||||||
fn transpile(&self) -> String {
|
fn transpile(&self) -> String {
|
||||||
String::from("// TODO (statement)")
|
match self {
|
||||||
|
Statement::Binding(binding) => binding.transpile(),
|
||||||
|
Statement::FunctionCall(function_call) => function_call.transpile(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user