diff --git a/node.go b/node.go index 5575ac4..cd19832 100644 --- a/node.go +++ b/node.go @@ -1284,9 +1284,9 @@ func removeParens(expr string) string { func (this *conversionState) resolveName(n node.Node) (string, error) { // TODO support namespace lookups - paramType := unknownVarType + ret := unknownVarType if n == nil || n == node.Node(nil) { - return paramType, nil + return ret, nil } switch n := n.(type) { @@ -1294,26 +1294,26 @@ func (this *conversionState) resolveName(n node.Node) (string, error) { if len(n.Parts) != 1 { return "", parseErr{n, fmt.Errorf("name has %d parts, expected 1", len(n.Parts))} } - paramType = n.Parts[0].(*name.NamePart).Value + ret = n.Parts[0].(*name.NamePart).Value case *name.Name: if len(n.Parts) != 1 { return "", parseErr{n, fmt.Errorf("name has %d parts, expected 1", len(n.Parts))} } - paramType = n.Parts[0].(*name.NamePart).Value + ret = n.Parts[0].(*name.NamePart).Value default: return "", fmt.Errorf("unexpected name type %#v", n) } // Handle class lookups - if strings.ToLower(paramType) == "parent" { + if strings.ToLower(ret) == "parent" { if this.currentClassParentName == "" { return "", parseErr{n, fmt.Errorf("Lookup of 'parent' while not in an inherited child class context")} } return `this.` + this.currentClassParentName, nil - } else if strings.ToLower(paramType) == "self" { + } else if strings.ToLower(ret) == "self" { // Let it through as-is // return "", parseErr{n, fmt.Errorf("Lookup of 'self::' should have been resolved already")} /* @@ -1322,12 +1322,12 @@ func (this *conversionState) resolveName(n node.Node) (string, error) { } return `this`, nil */ - } else if strings.ToLower(paramType) == "static" { + } else if strings.ToLower(ret) == "static" { return "", parseErr{n, fmt.Errorf("'static::' is not yet supported")} } - return paramType, nil + return ret, nil } func (this *conversionState) convertAssignment(n *assign.Assign, isTopLevelStatement bool) (string, error) {