mirror of
https://github.com/irmen/prog8.git
synced 2024-11-26 11:49:22 +00:00
was not needed
This commit is contained in:
parent
e1b26ae287
commit
62a66d89c6
@ -1 +1 @@
|
||||
1.50
|
||||
1.51-dev
|
||||
|
@ -240,7 +240,6 @@ data class AddressOf(var identifier: IdentifierReference, override val position:
|
||||
identifier.parent=this
|
||||
}
|
||||
|
||||
var scopedname: String? = null // will be set in a later state by the compiler // TODO get rid of this??
|
||||
override fun constValue(program: Program): NumericLiteralValue? = null
|
||||
override fun referencesIdentifiers(vararg name: String) = false
|
||||
override fun inferType(program: Program) = DataType.UWORD
|
||||
|
@ -442,8 +442,6 @@ internal class AstChecker(private val program: Program,
|
||||
if(variable.datatype !in ArrayDatatypes && variable.datatype !in StringDatatypes && variable.datatype!=DataType.STRUCT)
|
||||
checkResult.add(ExpressionError("invalid pointer-of operand type", addressOf.position))
|
||||
}
|
||||
if(addressOf.scopedname==null)
|
||||
throw FatalAstException("the scopedname of AddressOf should have been set by now $addressOf")
|
||||
super.visit(addressOf)
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,6 @@ internal class AstIdentifiersChecker(private val program: Program) : IAstModifyi
|
||||
override fun visit(addressOf: AddressOf): Expression {
|
||||
// register the scoped name of the referenced identifier
|
||||
val variable= addressOf.identifier.targetVarDecl(program.namespace) ?: return addressOf
|
||||
addressOf.scopedname = variable.scopedname
|
||||
return super.visit(addressOf)
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,6 @@ internal class VarInitValueAndAddressOfCreator(private val program: Program): IA
|
||||
val variable = idref.targetVarDecl(program.namespace)
|
||||
if(variable!=null && (variable.datatype in StringDatatypes || variable.datatype in ArrayDatatypes)) {
|
||||
val pointerExpr = AddressOf(idref, idref.position)
|
||||
pointerExpr.scopedname = parent.makeScopedName(idref.nameInSource.single())
|
||||
pointerExpr.linkParents(arglist[argparam.first.index].parent)
|
||||
arglist[argparam.first.index] = pointerExpr
|
||||
}
|
||||
@ -127,7 +126,6 @@ internal class VarInitValueAndAddressOfCreator(private val program: Program): IA
|
||||
// replace the argument with &autovar
|
||||
val autoHeapvarRef = IdentifierReference(listOf(variable.name), strvalue.position)
|
||||
val pointerExpr = AddressOf(autoHeapvarRef, strvalue.position)
|
||||
pointerExpr.scopedname = parent.makeScopedName(variable.name)
|
||||
pointerExpr.linkParents(arglist[argparam.first.index].parent)
|
||||
arglist[argparam.first.index] = pointerExpr
|
||||
}
|
||||
@ -145,7 +143,6 @@ internal class VarInitValueAndAddressOfCreator(private val program: Program): IA
|
||||
throw CompilerException("pass-by-reference parameter isn't an identifier? $argvalue")
|
||||
val addrOf = AddressOf(argvalue, argvalue.position)
|
||||
args[arg.first.index] = addrOf
|
||||
addrOf.scopedname = parent.makeScopedName(argvalue.nameInSource.single())
|
||||
addrOf.linkParents(parent)
|
||||
}
|
||||
}
|
||||
|
@ -1673,8 +1673,7 @@ $endLabel""")
|
||||
}
|
||||
is AddressOf -> {
|
||||
val identifier = (assign.value as AddressOf).identifier
|
||||
val scopedname = (assign.value as AddressOf).scopedname!!
|
||||
assignFromAddressOf(assign.target, identifier, scopedname)
|
||||
assignFromAddressOf(assign.target, identifier)
|
||||
}
|
||||
is DirectMemoryRead -> {
|
||||
val read = (assign.value as DirectMemoryRead)
|
||||
@ -2235,7 +2234,7 @@ $endLabel""")
|
||||
}
|
||||
}
|
||||
|
||||
private fun assignFromAddressOf(target: AssignTarget, name: IdentifierReference, scopedname: String) {
|
||||
private fun assignFromAddressOf(target: AssignTarget, name: IdentifierReference) {
|
||||
val targetIdent = target.identifier
|
||||
val targetArrayIdx = target.arrayindexed
|
||||
val struct = name.memberOfStruct(program.namespace)
|
||||
@ -2248,8 +2247,9 @@ $endLabel""")
|
||||
val firstVar = name.definingScope().lookup(firstVarName, name) as VarDecl
|
||||
firstVar.name
|
||||
} else {
|
||||
fixNameSymbols(scopedname)
|
||||
fixNameSymbols(name.nameInSource.joinToString ("."))
|
||||
}
|
||||
|
||||
when {
|
||||
targetIdent!=null -> {
|
||||
val targetName = asmIdentifierName(targetIdent)
|
||||
|
@ -3,19 +3,38 @@
|
||||
|
||||
main {
|
||||
|
||||
str title="bla"
|
||||
struct Color {
|
||||
ubyte red
|
||||
ubyte green
|
||||
ubyte blue
|
||||
}
|
||||
|
||||
sub start() {
|
||||
str subtitle = "basdf"
|
||||
Color rgb
|
||||
|
||||
for ubyte ax in 0 to 255 {
|
||||
word wcosa = cos8(ax) as word
|
||||
word wsina = sin8(ax) as word
|
||||
derp.dop()
|
||||
|
||||
c64scr.print_ub(ax)
|
||||
c64.CHROUT(':')
|
||||
c64.CHROUT(' ')
|
||||
c64scr.print_w(wcosa)
|
||||
c64.CHROUT(',')
|
||||
c64scr.print_w(wsina)
|
||||
c64.CHROUT('\n')
|
||||
uword zz = &title
|
||||
zz=&main.title
|
||||
zz=&subtitle
|
||||
zz=&main.start.subtitle
|
||||
|
||||
; uword addr = &derp.dop.name ; @todo strange error "pointer-of operand must be the name of a heap variable"
|
||||
; c64scr.print(&derp.dop.name)
|
||||
|
||||
zz=&rgb
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
derp {
|
||||
|
||||
sub dop() {
|
||||
ubyte zzz=33
|
||||
str name="irmen"
|
||||
|
||||
A=54
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user