mirror of
https://github.com/irmen/prog8.git
synced 2024-11-25 19:31:36 +00:00
validate string interning
This commit is contained in:
parent
6b7216f4ec
commit
c2cac772e3
@ -282,6 +282,13 @@ class Program(val name: String,
|
||||
}
|
||||
|
||||
fun internString(string: StringLiteralValue, dedup: Boolean): List<String> {
|
||||
// Move a string literal into the internal, deduplicated, string pool
|
||||
// replace it with a variable declaration that points to the entry in the pool.
|
||||
|
||||
if(string.parent is VarDecl) {
|
||||
// deduplication can only be performed safely for known-const strings (=string literals OUTSIDE OF A VARDECL)!
|
||||
throw FatalAstException("cannot intern a string literal that's part of a vardecl")
|
||||
}
|
||||
|
||||
fun getScopedName(string: StringLiteralValue): List<String> {
|
||||
val internedStringsBlock = modules
|
||||
|
Loading…
Reference in New Issue
Block a user