We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f28ac1 commit 26715ddCopy full SHA for 26715dd
Sources/WAT/Parser.swift
@@ -94,7 +94,12 @@ internal struct Parser {
94
}
95
switch sign {
96
case .plus, nil: return fromBitPattern(value)
97
- case .minus: return fromBitPattern(~value &+ 1)
+ case .minus:
98
+ let casted = fromBitPattern(~value &+ 1)
99
+ guard casted <= 0 else {
100
+ throw WatParserError("invalid literal \(token.text(from: lexer))", location: token.location(in: lexer))
101
+ }
102
+ return casted
103
104
105
0 commit comments