Move $this->mParser setters up one level

Two motivations:

1. I want the two deeper nested functions guardedRef() and
guardedReferences() to have less side effects.

2. In guardedReferences() guardedRef() is called. Both set the
property. That's redundant. The new code avoids this.

Change-Id: I48146f8b6d91122a904be0a552ffe3b03bc0481f
This commit is contained in:
Thiemo Kreuz 2019-11-11 20:16:05 +01:00
parent d2cc18d38a
commit bd72636b95

View file

@ -203,6 +203,7 @@ class Cite {
}
$this->mCallCnt++;
$this->mParser = $parser;
$this->mInCite = true;
$ret = $this->guardedRef( $text, $argv, $parser );
@ -235,8 +236,6 @@ class Cite {
array $argv,
Parser $parser
) {
$this->mParser = $parser;
# The key here is the "name" attribute.
list( $key, $group, $follow, $dir, $refines ) = $this->refArg( $argv );
// empty string indicate invalid dir
@ -654,10 +653,13 @@ class Cite {
}
return htmlspecialchars( "<references>$text</references>" );
}
$this->mCallCnt++;
$this->mParser = $parser;
$this->mInReferences = true;
$ret = $this->guardedReferences( $text, $argv, $parser );
$this->mInReferences = false;
$frame->setVolatile();
return $ret;
}
@ -678,8 +680,6 @@ class Cite {
) {
global $wgCiteResponsiveReferences;
$this->mParser = $parser;
$group = $argv['group'] ?? self::DEFAULT_GROUP;
unset( $argv['group'] );