Implemented dependency tracking
This commit is contained in:
@ -42,7 +42,8 @@ func (f *Function) EvaluateDot(expr *expression.Expression) (eval.Value, error)
|
||||
return value, nil
|
||||
}
|
||||
|
||||
constant, isConst := f.All.Constants[f.Package+"."+leftText+"."+rightText]
|
||||
label := fmt.Sprintf("%s.%s", leftText, rightText)
|
||||
constant, isConst := f.All.Constants[f.Package+"."+label]
|
||||
|
||||
if isConst {
|
||||
number, err := ToNumber(constant.Token, constant.File)
|
||||
@ -73,10 +74,18 @@ func (f *Function) EvaluateDot(expr *expression.Expression) (eval.Value, error)
|
||||
}
|
||||
}
|
||||
|
||||
value := &eval.Label{
|
||||
Typ: types.AnyPointer,
|
||||
Label: fmt.Sprintf("%s.%s", leftText, rightText),
|
||||
function, exists := f.All.Functions[label]
|
||||
|
||||
if exists {
|
||||
f.Dependencies = append(f.Dependencies, function)
|
||||
|
||||
value := &eval.Label{
|
||||
Typ: types.AnyPointer,
|
||||
Label: label,
|
||||
}
|
||||
|
||||
return value, nil
|
||||
}
|
||||
|
||||
return value, nil
|
||||
return nil, errors.New(&errors.UnknownIdentifier{Name: label}, f.File, left.Token.Position)
|
||||
}
|
||||
|
Reference in New Issue
Block a user