[Swift] Make ParserATNSimulator.precedenceTransition return a nullable value.

This was always clearly a possibility, looking at the body of the method.
The newly-enabled performance tests expose this bug (and I don't know how
we've gotten away with it otherwise for so long).

The Java runtime also returns null at this point.
This commit is contained in:
Ewan Mellor 2018-11-09 10:51:44 -08:00
parent 237ba0f9e1
commit d275a8c97f
No known key found for this signature in database
GPG Key ID: 7CE1C6BC9EC8645D
1 changed files with 2 additions and 2 deletions

View File

@ -1722,7 +1722,7 @@ open class ParserATNSimulator: ATNSimulator {
_ pt: PrecedencePredicateTransition,
_ collectPredicates: Bool,
_ inContext: Bool,
_ fullCtx: Bool) throws -> ATNConfig {
_ fullCtx: Bool) throws -> ATNConfig? {
if debug {
print("PRED (collectPredicates=\(collectPredicates)) \(pt.precedence)>=_p, ctx dependent=true")
//if ( parser != nil ) {
@ -1757,7 +1757,7 @@ open class ParserATNSimulator: ATNSimulator {
if debug {
print("config from pred transition=\(c?.description ?? "nil")")
}
return c!
return c
}