Set the listeners list back to null if all listeners are removed from it

This commit is contained in:
Sam Harwell 2012-02-26 15:02:14 -06:00
parent 1e438746be
commit bedc502d33
1 changed files with 9 additions and 2 deletions

View File

@ -175,10 +175,17 @@ public abstract class Parser extends Recognizer<Token, ParserATNSimulator<Token>
public void removeParseListener(ParseListener<Token> l) {
if ( l==null ) return;
if ( _parseListeners!=null ) _parseListeners.remove(l);
if ( _parseListeners!=null ) {
_parseListeners.remove(l);
if (_parseListeners.isEmpty()) {
_parseListeners = null;
}
}
}
public void removeParseListeners() { if ( _parseListeners!=null ) _parseListeners.clear(); }
public void removeParseListeners() {
_parseListeners = null;
}
public void triggerEnterRuleEvent() {
for (ParseListener<Token> l : _parseListeners) {