mirror of
https://github.com/KarolS/millfork.git
synced 2024-12-24 15:29:23 +00:00
Fix nested #ifs
This commit is contained in:
parent
fae64c52a1
commit
c580ba33ea
@ -74,6 +74,8 @@
|
|||||||
|
|
||||||
* Fixed `#pragma` not respecting `#if`.
|
* Fixed `#pragma` not respecting `#if`.
|
||||||
|
|
||||||
|
* Fixed nested `#if`s.
|
||||||
|
|
||||||
* Fixed `@long` and `@long_be` array filters.
|
* Fixed `@long` and `@long_be` array filters.
|
||||||
|
|
||||||
* Fixed for-each loops with non-constant arrays.
|
* Fixed for-each loops with non-constant arrays.
|
||||||
|
@ -119,7 +119,7 @@ object Preprocessor {
|
|||||||
enabled = false
|
enabled = false
|
||||||
} else {
|
} else {
|
||||||
val value = evalParam(param, pos)
|
val value = evalParam(param, pos)
|
||||||
enabled = value != 0
|
enabled = i.enabledBefore && value != 0
|
||||||
ifStack.push(ifStack.pop().copy(hadEnabled = enabled))
|
ifStack.push(ifStack.pop().copy(hadEnabled = enabled))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ object Preprocessor {
|
|||||||
if (i.hadEnabled) {
|
if (i.hadEnabled) {
|
||||||
enabled = false
|
enabled = false
|
||||||
} else {
|
} else {
|
||||||
enabled = !enabled
|
enabled = i.enabledBefore && !enabled
|
||||||
}
|
}
|
||||||
ifStack.push(ifStack.pop().copy(hadEnabled = true, hadElse = true))
|
ifStack.push(ifStack.pop().copy(hadEnabled = true, hadElse = true))
|
||||||
}
|
}
|
||||||
|
@ -229,6 +229,15 @@ class BasicSymonTest extends FunSuite with Matchers {
|
|||||||
| #error A should be defined
|
| #error A should be defined
|
||||||
| #endif
|
| #endif
|
||||||
|
|
|
|
||||||
|
| #if 0
|
||||||
|
| #error inside if 0
|
||||||
|
| #if 0
|
||||||
|
| #error inside second if 0
|
||||||
|
| #else
|
||||||
|
| #error really shouldn't happen
|
||||||
|
| #endif
|
||||||
|
| #endif
|
||||||
|
|
|
||||||
| #if 1 + 1 == 2
|
| #if 1 + 1 == 2
|
||||||
| #info 1
|
| #info 1
|
||||||
| #if 1 == 3
|
| #if 1 == 3
|
||||||
|
Loading…
Reference in New Issue
Block a user