コード例 #1
0
ファイル: CodeScope.php プロジェクト: microcosmx/experiments
 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;
 }
コード例 #2
0
 function getVariableNameForScope($variableName, $variableFlags)
 {
     return $this->currentScope->getScopedVariable($variableName, $variableFlags, true);
 }