mirror of
https://github.com/irmen/prog8.git
synced 2025-02-16 22:30:46 +00:00
fix compiler crash for undefined symbol in expression
This commit is contained in:
parent
582d31263c
commit
0af5582ca7
@ -768,10 +768,10 @@ data class IdentifierReference(val nameInSource: List<String>, override val posi
|
||||
|
||||
override fun inferType(program: Program): InferredTypes.InferredType {
|
||||
val targetStmt = targetStatement(program.namespace)
|
||||
if(targetStmt is VarDecl) {
|
||||
return InferredTypes.knownFor(targetStmt.datatype)
|
||||
return if(targetStmt is VarDecl) {
|
||||
InferredTypes.knownFor(targetStmt.datatype)
|
||||
} else {
|
||||
throw FatalAstException("cannot get datatype from identifier reference ${this}, pos=$position")
|
||||
InferredTypes.InferredType.unknown()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -716,9 +716,9 @@ internal class AstChecker(private val program: Program,
|
||||
override fun visit(expr: BinaryExpression) {
|
||||
val leftIDt = expr.left.inferType(program)
|
||||
val rightIDt = expr.right.inferType(program)
|
||||
if(!leftIDt.isKnown || !rightIDt.isKnown) {
|
||||
throw FatalAstException("can't determine datatype of both expression operands $expr")
|
||||
}
|
||||
if(!leftIDt.isKnown || !rightIDt.isKnown)
|
||||
return // hopefully this error will be detected elsewhere
|
||||
|
||||
val leftDt = leftIDt.typeOrElse(DataType.STRUCT)
|
||||
val rightDt = rightIDt.typeOrElse(DataType.STRUCT)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user