26 lines
466 B
Go
26 lines
466 B
Go
package core
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"git.urbach.dev/cli/q/src/scope"
|
|
)
|
|
|
|
// Identifier looks up an identifier which can be a variable or a function.
|
|
func (f *Function) Identifier(name string) (*scope.Variable, *Function) {
|
|
variable := f.VariableByName(name)
|
|
|
|
if variable != nil {
|
|
return variable, nil
|
|
}
|
|
|
|
uniqueName := fmt.Sprintf("%s.%s", f.Package, name)
|
|
function, exists := f.All.Functions[uniqueName]
|
|
|
|
if exists {
|
|
return nil, function
|
|
}
|
|
|
|
return nil, nil
|
|
}
|