Skip to content

Commit

Permalink
parser: catch unused directives
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Apr 3, 2024
1 parent 44dc715 commit aaef983
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion std/jule/build/log.jule
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub enum LogMsg: str {
IncompatibleTypeForPtrArithmetic = `type @ is incompatible to use for pointer arithmetic`,
ComptimePanic = `compile-time panic: @`,
InvalidTypeForIndexing = `type @ is invalid for indexing`,
UnusedDirective = `this directive is out of scope, cant assign to any define`,
UnusedDirective = `this directive is out of scope, put it where it will be useful or delete it`,
UnsupportedDirective = `directive @ is not supported by define`,
PanicedWithNonStr = `panic function only accepts strings`,
ErrorWithNonExceptional = `error call can only useable for exceptional functions`,
Expand Down
4 changes: 4 additions & 0 deletions std/jule/parser/parser.jule
Original file line number Diff line number Diff line change
Expand Up @@ -1962,5 +1962,9 @@ impl Parser {
break
}
}

if self.directives.len != 0 {
self.push_err(self.directives[0].tag, LogMsg.UnusedDirective)
}
}
}

0 comments on commit aaef983

Please sign in to comment.