[Swift] Remove unused constructors.

Remove unused constructors from ATNConfig and DFAState, and merge two
by using a default parameter instead.
This commit is contained in:
Ewan Mellor 2018-11-14 21:44:43 -08:00
parent 176d92d373
commit 8f42439943
No known key found for this signature in database
GPG Key ID: 7CE1C6BC9EC8645D
2 changed files with 2 additions and 24 deletions

View File

@ -66,25 +66,10 @@ public class ATNConfig: Hashable, CustomStringConvertible {
public final let semanticContext: SemanticContext
public init(_ old: ATNConfig) {
// dup
self.state = old.state
self.alt = old.alt
self.context = old.context
self.semanticContext = old.semanticContext
self.reachesIntoOuterContext = old.reachesIntoOuterContext
}
public convenience init(_ state: ATNState,
_ alt: Int,
_ context: PredictionContext?) {
self.init(state, alt, context, SemanticContext.NONE)
}
public init(_ state: ATNState,
_ alt: Int,
_ context: PredictionContext?,
_ semanticContext: SemanticContext) {
_ semanticContext: SemanticContext = SemanticContext.NONE) {
self.state = state
self.alt = alt
self.context = context

View File

@ -34,7 +34,7 @@
public final class DFAState: Hashable, CustomStringConvertible {
public internal(set) var stateNumber = -1
public internal(set) var configs = ATNConfigSet()
public internal(set) var configs: ATNConfigSet
///
/// `edges[symbol]` points to target of symbol. Shift up by 1 so (-1)
@ -96,13 +96,6 @@ public final class DFAState: Hashable, CustomStringConvertible {
}
}
public init() {
}
public init(_ stateNumber: Int) {
self.stateNumber = stateNumber
}
public init(_ configs: ATNConfigSet) {
self.configs = configs
}