fix: refactored code to use ident.pos
This commit is contained in:
parent
a09d38a40f
commit
31bb23480b
@ -16,13 +16,13 @@ def printError(error: Error)(using errorContent: String): Unit = {
|
|||||||
println("Semantic error:")
|
println("Semantic error:")
|
||||||
error match {
|
error match {
|
||||||
case Error.DuplicateDeclaration(ident) =>
|
case Error.DuplicateDeclaration(ident) =>
|
||||||
printPosition(ident.getPosition)
|
printPosition(ident.pos)
|
||||||
println(s"Duplicate declaration of identifier ${ident.v}")
|
println(s"Duplicate declaration of identifier ${ident.v}")
|
||||||
highlight(ident.getPosition, ident.v.length)
|
highlight(ident.pos, ident.v.length)
|
||||||
case Error.UndefinedIdentifier(ident, identType) =>
|
case Error.UndefinedIdentifier(ident, identType) =>
|
||||||
printPosition(ident.getPosition)
|
printPosition(ident.pos)
|
||||||
println(s"Undefined ${identType.toString.toLowerCase()} ${ident.v}")
|
println(s"Undefined ${identType.toString.toLowerCase()} ${ident.v}")
|
||||||
highlight(ident.getPosition, ident.v.length)
|
highlight(ident.pos, ident.v.length)
|
||||||
case Error.FunctionParamsMismatch(pos, expected, got) =>
|
case Error.FunctionParamsMismatch(pos, expected, got) =>
|
||||||
printPosition(pos)
|
printPosition(pos)
|
||||||
println(s"Function expects $expected parameters, got $got")
|
println(s"Function expects $expected parameters, got $got")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user