function getScopedVariable($variableName, $variableFlags, $originalScope) { $result = $this->getScopedVariableForScope($variableName, $variableFlags); if ($result == NULL) { if ($this->parentScope != NULL) { $result = $this->parentScope->getScopedVariable($variableName, $variableFlags, FALSE); } } if ($originalScope == TRUE) { if ($result == FALSE) { if (($variableFlags & DECLARATION_TYPE_CLASS) == 0) { //First use of variable in a function - lets add a 'var' to make Javascript happy. $this->addScopedVariable($variableName, $variableFlags); $result = "var {$variableName}"; } else { //The variable really ought to exist in the class scope //But maybe it's been declared after it's use or is a SomeClass::param $result = $variableName; } } } return $result; }
function getVariableNameForScope($variableName, $variableFlags) { return $this->currentScope->getScopedVariable($variableName, $variableFlags, true); }