Skip to content

Commit

Permalink
Tweaks for transpiling CF to BL
Browse files Browse the repository at this point in the history
  • Loading branch information
bdw429s committed Aug 11, 2024
1 parent 079ad81 commit d62c942
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import ortus.boxlang.compiler.ast.BoxExpression;
import ortus.boxlang.compiler.ast.BoxNode;
import ortus.boxlang.compiler.ast.BoxStatement;
import ortus.boxlang.compiler.ast.comment.BoxSingleLineComment;
import ortus.boxlang.compiler.ast.expression.BoxAccess;
import ortus.boxlang.compiler.ast.expression.BoxArgument;
import ortus.boxlang.compiler.ast.expression.BoxArrayAccess;
Expand All @@ -42,6 +43,7 @@
import ortus.boxlang.compiler.ast.expression.BoxLambda;
import ortus.boxlang.compiler.ast.expression.BoxMethodInvocation;
import ortus.boxlang.compiler.ast.expression.BoxNew;
import ortus.boxlang.compiler.ast.expression.BoxParenthesis;
import ortus.boxlang.compiler.ast.expression.BoxScope;
import ortus.boxlang.compiler.ast.expression.BoxStringConcat;
import ortus.boxlang.compiler.ast.expression.BoxStringLiteral;
Expand Down Expand Up @@ -429,11 +431,11 @@ private BoxNode transpileBIFReturnType( BoxFunctionInvocation node, String name

// wrap up the lambda as an IIFE
return new BoxExpressionInvocation(
lambda,
new BoxParenthesis( lambda, null, null ),
args,
null,
null
);
).addComment( new BoxSingleLineComment( "Transpiler workaround for BIF return type", null, null ) );
}

private List<BoxArgument> generateBIFArgs( List<BoxArgument> args ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ public void processStringInterp( BoxStringInterpolation node, boolean isQuoted )
public void visit( BoxStringLiteral node ) {
printPreComments( node );
print( "\"" );
print( node.getValue().replace( "\"", "\"\"" ) );
print( node.getValue().replace( "\"", "\"\"" ).replace( "#", "##" ) );
print( "\"" );
printPostComments( node );
}
Expand Down Expand Up @@ -990,7 +990,7 @@ public void visit( BoxArgumentDeclaration node ) {

private void doQuotedExpression( BoxExpression node ) {
if ( node instanceof BoxStringLiteral str ) {
print( str.getValue().replace( "\"", "\"\"" ) );
print( str.getValue().replace( "\"", "\"\"" ).replace( "#", "##" ) );
} else if ( node instanceof BoxStringInterpolation interp ) {
processStringInterp( interp, true );
} else if ( node instanceof BoxFQN fqn ) {
Expand Down

0 comments on commit d62c942

Please sign in to comment.