removed BuiltinFunctionCallStatement redundant ast node type

This commit is contained in:
Irmen de Jong
2024-11-15 19:23:11 +01:00
parent 51a05ec4b7
commit d640cfbe13
9 changed files with 20 additions and 102 deletions
@@ -94,14 +94,6 @@ class Inliner(private val program: Program, private val options: CompilationOpti
false
}
is BuiltinFunctionCallStatement -> {
val inline =
stmt.args.size <= 1 && stmt.args.all { it is NumericLiteral || it is IdentifierReference }
if (inline)
makeFullyScoped(stmt)
inline
}
is FunctionCallStatement -> {
val inline =
stmt.args.size <= 1 && stmt.args.all { it is NumericLiteral || it is IdentifierReference }
@@ -133,14 +125,6 @@ class Inliner(private val program: Program, private val options: CompilationOpti
}
}
private fun makeFullyScoped(call: BuiltinFunctionCallStatement) {
val scopedArgs = makeScopedArgs(call.args)
if(scopedArgs.any()) {
val scopedCall = BuiltinFunctionCallStatement(call.target.copy(), scopedArgs.toMutableList(), call.position)
modifications += IAstModification.ReplaceNode(call, scopedCall, call.parent)
}
}
private fun makeFullyScoped(call: FunctionCallStatement) {
makeFullyScoped(call.target)
call.target.targetSubroutine(program)?.let { sub ->