-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding FunctionTranspilerNode which will replace SLIFO ranges
- Loading branch information
1 parent
7d26c73
commit 9aac240
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
smojol-core/src/main/java/org/smojol/common/transpiler/FunctionTranspilerNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |