mirror of
https://github.com/irmen/prog8.git
synced 2024-09-28 17:54:58 +00:00
correct error message for faulty string variable declarations
This commit is contained in:
parent
f2e2720b15
commit
a1f0cc878b
@ -632,6 +632,14 @@ internal class AstChecker(private val program: Program,
|
||||
}
|
||||
}
|
||||
|
||||
// string assignment is not supported in a vard
|
||||
if(decl.datatype==DataType.STR) {
|
||||
if(decl.value==null)
|
||||
err("string var must be initialized with a string literal")
|
||||
if(decl.value !=null && decl.value !is StringLiteralValue)
|
||||
err("string var can only be initialized with a string literal")
|
||||
}
|
||||
|
||||
super.visit(decl)
|
||||
}
|
||||
|
||||
|
@ -152,8 +152,11 @@ goatsoup {
|
||||
else {
|
||||
if c <= $a4 {
|
||||
ubyte rnr = gen_rnd_number()
|
||||
; TODO recursive call...
|
||||
; soup(self.desc_list[ord(c) - 0x81][(rnr >= 0x33) + (rnr >= 0x66) + (rnr >= 0x99) + (rnr >= 0xCC)])
|
||||
ubyte wordNr = (rnr >= $33) + (rnr >= $66) + (rnr >= $99) + (rnr >= $CC)
|
||||
str source2
|
||||
source2 = getword(c, wordNr) ; TODO good error message
|
||||
; TODO recursive call...:
|
||||
; print_soup(source2)
|
||||
} else {
|
||||
if c == $b0 {
|
||||
txt.chrout(planet_name[0] | 32)
|
||||
|
Loading…
Reference in New Issue
Block a user