mirror of
https://github.com/irmen/prog8.git
synced 2025-01-10 20:30:23 +00:00
working on codegen fixes
This commit is contained in:
parent
117d848466
commit
48c9349ce9
@ -71,7 +71,8 @@ internal class BuiltinFunctionsAsmGen(private val program: PtProgram,
|
||||
"callrom" -> funcCallRom(fcall)
|
||||
else -> throw AssemblyError("missing asmgen for builtin func ${fcall.name}")
|
||||
}
|
||||
TODO("return correct function result type")
|
||||
|
||||
return BuiltinFunctions.getValue(fcall.name).returnType
|
||||
}
|
||||
|
||||
private fun funcRsave() {
|
||||
|
@ -59,7 +59,12 @@ fun PtExpression.isSimple(): Boolean {
|
||||
}
|
||||
|
||||
internal fun PtIdentifier.targetStatement(program: PtProgram): PtNode? {
|
||||
TODO("Not yet implemented")
|
||||
TODO("Not yet implemented target stmt for ${this.name}")
|
||||
// if(nameInSource.size==1 && nameInSource[0] in program.builtinFunctions.names)
|
||||
// BuiltinFunctionPlaceholder(nameInSource[0], position, parent)
|
||||
// else
|
||||
// definingScope.lookup(nameInSource)
|
||||
//
|
||||
}
|
||||
|
||||
internal fun PtIdentifier.targetVarDecl(program: PtProgram): PtVariable? =
|
||||
|
@ -2,10 +2,7 @@ package prog8.codegen.cpu6502.assignment
|
||||
|
||||
import prog8.code.ast.*
|
||||
import prog8.code.core.*
|
||||
import prog8.codegen.cpu6502.AsmGen
|
||||
import prog8.codegen.cpu6502.asConstInteger
|
||||
import prog8.codegen.cpu6502.returnsWhatWhere
|
||||
import prog8.codegen.cpu6502.targetSubroutine
|
||||
import prog8.codegen.cpu6502.*
|
||||
|
||||
|
||||
internal enum class TargetStorageKind {
|
||||
@ -57,7 +54,9 @@ internal class AsmAssignTarget(val kind: TargetStorageKind,
|
||||
with(assign.target) {
|
||||
when {
|
||||
identifier != null -> {
|
||||
val parameter: PtSubroutineParameter = TODO("search subroutine parameter that it may refer to ${assign.target.identifier!!.name}") // identifier!!.targetVarDecl(program)?.subroutineParameter
|
||||
val paramName = identifier!!.targetVarDecl(program)?.name
|
||||
val parameter = identifier!!.targetStatement(program)?.definingSub()?.parameters?.singleOrNull { it.name===paramName }
|
||||
println("assign to ${identifier!!.name} param=$parameter") // TODO WEG
|
||||
if (parameter!=null) {
|
||||
val sub = parameter.definingAsmSub()
|
||||
if (sub!=null) {
|
||||
|
@ -5,8 +5,13 @@
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
ubyte @shared ub = asmfoo(42)
|
||||
ub = normalfoo(42)
|
||||
rsavex()
|
||||
|
||||
ubyte @shared ub
|
||||
void asmfoo(42)
|
||||
main.asmfoo.arg = 42
|
||||
main.normalfoo.arg=99
|
||||
; normalfoo(42)
|
||||
somelabel:
|
||||
ub++
|
||||
txt.print_ub(ub)
|
||||
|
Loading…
x
Reference in New Issue
Block a user