Lint: Drop nil declaration assignments
This commit is contained in:
parent
056f3f62c1
commit
c81f2a7901
|
@ -375,8 +375,8 @@ func (a *ATNDeserializer) generateRuleBypassTransition(atn *ATN, idx int) {
|
|||
|
||||
bypassStop.startState = bypassStart
|
||||
|
||||
var excludeTransition Transition = nil
|
||||
var endState ATNState = nil
|
||||
var excludeTransition Transition
|
||||
var endState ATNState
|
||||
|
||||
if atn.ruleToStartState[idx].isPrecedenceRule {
|
||||
// wrap from the beginning of the rule to the StarLoopEntryState
|
||||
|
|
|
@ -88,7 +88,7 @@ func LexerActionExecutorappend(lexerActionExecutor *LexerActionExecutor, lexerAc
|
|||
// for all position-dependent lexer actions.
|
||||
// /
|
||||
func (l *LexerActionExecutor) fixOffsetBeforeMatch(offset int) *LexerActionExecutor {
|
||||
var updatedLexerActions []LexerAction = nil
|
||||
var updatedLexerActions []LexerAction
|
||||
for i := 0; i < len(l.lexerActions); i++ {
|
||||
_, ok := l.lexerActions[i].(*LexerIndexedCustomAction)
|
||||
if l.lexerActions[i].getIsPositionDependent() && !ok {
|
||||
|
|
|
@ -631,7 +631,7 @@ func (l *LexerATNSimulator) addDFAEdge(from_ *DFAState, tk int, to *DFAState, cf
|
|||
func (l *LexerATNSimulator) addDFAState(configs ATNConfigSet) *DFAState {
|
||||
|
||||
var proposed = NewDFAState(-1, configs)
|
||||
var firstConfigWithRuleStopState ATNConfig = nil
|
||||
var firstConfigWithRuleStopState ATNConfig
|
||||
|
||||
for _, cfg := range configs.GetItems() {
|
||||
|
||||
|
|
|
@ -385,7 +385,7 @@ func (p *ParserATNSimulator) execATNWithFullContext(dfa *DFA, D *DFAState, s0 AT
|
|||
|
||||
var fullCtx = true
|
||||
var foundExactAmbig = false
|
||||
var reach ATNConfigSet = nil
|
||||
var reach ATNConfigSet
|
||||
var previous = s0
|
||||
input.Seek(startIndex)
|
||||
var t = input.LA(1)
|
||||
|
@ -504,7 +504,7 @@ func (p *ParserATNSimulator) computeReachSet(closure ATNConfigSet, t int, fullCt
|
|||
// ensure that the alternative Matching the longest overall sequence is
|
||||
// chosen when multiple such configurations can Match the input.
|
||||
|
||||
var SkippedStopStates []*BaseATNConfig = nil
|
||||
var SkippedStopStates []*BaseATNConfig
|
||||
|
||||
// First figure out where we can reach on input t
|
||||
for _, c := range closure.GetItems() {
|
||||
|
@ -540,7 +540,7 @@ func (p *ParserATNSimulator) computeReachSet(closure ATNConfigSet, t int, fullCt
|
|||
}
|
||||
}
|
||||
// Now figure out where the reach operation can take us...
|
||||
var reach ATNConfigSet = nil
|
||||
var reach ATNConfigSet
|
||||
|
||||
// This block optimizes the reach operation for intermediate sets which
|
||||
// trivially indicate a termination state for the overall
|
||||
|
@ -1190,7 +1190,7 @@ func (p *ParserATNSimulator) precedenceTransition(config ATNConfig,
|
|||
fmt.Println("context surrounding pred is " + fmt.Sprint(p.parser.GetRuleInvocationStack(nil)))
|
||||
}
|
||||
}
|
||||
var c *BaseATNConfig = nil
|
||||
var c *BaseATNConfig
|
||||
if collectPredicates && inContext {
|
||||
if fullCtx {
|
||||
// In full context mode, we can evaluate predicates on-the-fly
|
||||
|
@ -1226,7 +1226,7 @@ func (p *ParserATNSimulator) predTransition(config ATNConfig, pt *PredicateTrans
|
|||
fmt.Println("context surrounding pred is " + fmt.Sprint(p.parser.GetRuleInvocationStack(nil)))
|
||||
}
|
||||
}
|
||||
var c *BaseATNConfig = nil
|
||||
var c *BaseATNConfig
|
||||
if collectPredicates && ((pt.isCtxDependent && inContext) || !pt.isCtxDependent) {
|
||||
if fullCtx {
|
||||
// In full context mode, we can evaluate predicates on-the-fly
|
||||
|
@ -1304,7 +1304,7 @@ func (p *ParserATNSimulator) getConflictingAlts(configs ATNConfigSet) *BitSet {
|
|||
//
|
||||
|
||||
func (p *ParserATNSimulator) getConflictingAltsOrUniqueAlt(configs ATNConfigSet) *BitSet {
|
||||
var conflictingAlts *BitSet = nil
|
||||
var conflictingAlts *BitSet
|
||||
if configs.GetUniqueAlt() != ATNInvalidAltNumber {
|
||||
conflictingAlts = NewBitSet()
|
||||
conflictingAlts.add(configs.GetUniqueAlt())
|
||||
|
|
|
@ -480,7 +480,7 @@ func mergeSingletons(a, b *BaseSingletonPredictionContext, rootIsWildcard bool,
|
|||
}
|
||||
// a != b payloads differ
|
||||
// see if we can collapse parents due to $+x parents if local ctx
|
||||
var singleParent PredictionContext = nil
|
||||
var singleParent PredictionContext
|
||||
if a == b || (a.parentCtx != nil && a.parentCtx == b.parentCtx) { // ax +
|
||||
// bx =
|
||||
// [a,b]x
|
||||
|
@ -753,7 +753,7 @@ func getCachedBasePredictionContext(context PredictionContext, contextCache *Pre
|
|||
visited[context] = context
|
||||
return context
|
||||
}
|
||||
var updated PredictionContext = nil
|
||||
var updated PredictionContext
|
||||
if len(parents) == 0 {
|
||||
updated = BasePredictionContextEMPTY
|
||||
} else if len(parents) == 1 {
|
||||
|
|
|
@ -432,7 +432,7 @@ func PredictionModehasConflictingAltSet(altsets []*BitSet) bool {
|
|||
// others, otherwise {@code false}
|
||||
//
|
||||
func PredictionModeallSubsetsEqual(altsets []*BitSet) bool {
|
||||
var first *BitSet = nil
|
||||
var first *BitSet
|
||||
|
||||
for i := 0; i < len(altsets); i++ {
|
||||
var alts = altsets[i]
|
||||
|
|
|
@ -80,7 +80,7 @@ func (p *Predicate) evalPrecedence(parser Recognizer, outerContext RuleContext)
|
|||
|
||||
func (p *Predicate) evaluate(parser Recognizer, outerContext RuleContext) bool {
|
||||
|
||||
var localctx RuleContext = nil
|
||||
var localctx RuleContext
|
||||
|
||||
if p.isCtxDependent {
|
||||
localctx = outerContext
|
||||
|
@ -195,7 +195,7 @@ func NewAND(a, b SemanticContext) *AND {
|
|||
var precedencePredicates = PrecedencePredicatefilterPrecedencePredicates(operands)
|
||||
if len(precedencePredicates) > 0 {
|
||||
// interested in the transition with the lowest precedence
|
||||
var reduced *PrecedencePredicate = nil
|
||||
var reduced *PrecedencePredicate
|
||||
|
||||
for _, p := range precedencePredicates {
|
||||
if reduced == nil || p.precedence < reduced.precedence {
|
||||
|
@ -278,7 +278,7 @@ func (a *AND) evalPrecedence(parser Recognizer, outerContext RuleContext) Semant
|
|||
return SemanticContextNone
|
||||
}
|
||||
|
||||
var result SemanticContext = nil
|
||||
var result SemanticContext
|
||||
|
||||
for _, o := range operands {
|
||||
if result == nil {
|
||||
|
@ -335,7 +335,7 @@ func NewOR(a, b SemanticContext) *OR {
|
|||
var precedencePredicates = PrecedencePredicatefilterPrecedencePredicates(operands)
|
||||
if len(precedencePredicates) > 0 {
|
||||
// interested in the transition with the lowest precedence
|
||||
var reduced *PrecedencePredicate = nil
|
||||
var reduced *PrecedencePredicate
|
||||
|
||||
for _, p := range precedencePredicates {
|
||||
if reduced == nil || p.precedence > reduced.precedence {
|
||||
|
@ -413,7 +413,7 @@ func (o *OR) evalPrecedence(parser Recognizer, outerContext RuleContext) Semanti
|
|||
// all elements were false, so the OR context is false
|
||||
return nil
|
||||
}
|
||||
var result SemanticContext = nil
|
||||
var result SemanticContext
|
||||
|
||||
for _, o := range operands {
|
||||
if result == nil {
|
||||
|
|
Loading…
Reference in New Issue