Skip to content

Commit

Permalink
Adding FunctionTranspilerNode which will replace SLIFO ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
avishek-sen-gupta committed Nov 17, 2024
1 parent 7d26c73 commit 9aac240
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.smojol.common.transpiler;

import com.google.common.collect.ImmutableList;
import org.smojol.common.ast.SemanticCategory;

public class FunctionTranspilerNode extends TranspilerNode {
private final String name;
private final TranspilerCodeBlockNode body;

public FunctionTranspilerNode(String name, TranspilerCodeBlockNode body) {
super(ImmutableList.of(body), ImmutableList.of(SemanticCategory.FUNCTION));
this.name = name;
this.body = body;
}
@Override
public String description() {
return String.format("function %s()\n%s", name, body.description());
}
}

0 comments on commit 9aac240

Please sign in to comment.