Replace generic resolution recording with intent methods
This commit is contained in:
@@ -112,11 +112,21 @@ func (r *Resolution) SourceContext(id string) (ResourceContext, bool) {
|
||||
return r.activeState().input.sourceContext(id)
|
||||
}
|
||||
|
||||
// Record declares the intent for a resolver mutation. A container path covers
|
||||
// mutations to its descendants.
|
||||
func (r *Resolution) Record(path Path, kind ChangeKind, reason string, dependencies ...Path) {
|
||||
// RecordDerivedDefault declares a derived-default intent for a resolver
|
||||
// mutation already performed by application code. A container path covers
|
||||
// mutations to its descendants. This does not assign a value or suppress work
|
||||
// for explicit input.
|
||||
func (r *Resolution) RecordDerivedDefault(path Path, reason string, dependencies ...Path) {
|
||||
state := r.activeState()
|
||||
state.addRecord(path, kind, reason, dependencies, nil)
|
||||
state.addRecord(path, ChangeDerivedDefault, reason, dependencies, nil)
|
||||
}
|
||||
|
||||
// RecordNormalization declares a normalization intent for a resolver mutation
|
||||
// already performed by application code. A container path covers mutations to
|
||||
// its descendants. This does not assign a value.
|
||||
func (r *Resolution) RecordNormalization(path Path, reason string, dependencies ...Path) {
|
||||
state := r.activeState()
|
||||
state.addRecord(path, ChangeNormalization, reason, dependencies, nil)
|
||||
}
|
||||
|
||||
// Error reports a safe, value-free resolution error at path.
|
||||
@@ -219,10 +229,6 @@ func (state *resolutionState) addRecord(path Path, kind ChangeKind, reason strin
|
||||
if !state.validPath(path) {
|
||||
return
|
||||
}
|
||||
if kind != ChangeDerivedDefault && kind != ChangeNormalization {
|
||||
state.addDiagnostic(CodeResolveInvalidKind, path, "resolution record has an invalid change kind")
|
||||
return
|
||||
}
|
||||
if reason == "" {
|
||||
state.addDiagnostic(CodeResolveInvalidRecord, path, "resolution record requires a safe reason")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user