check for concreteness in specialized types

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2021-12-07 14:03:07 -05:00
parent 6aa4f6b8b3
commit 201ac391b4
7 changed files with 57 additions and 70 deletions

View File

@@ -54,6 +54,10 @@ func (c *fsContext) New(result bkgw.Reference) *FS {
return fs
}
func (c *fsContext) Contains(v *compiler.Value) bool {
return v.LookupPath(fsIDPath).Exists()
}
func (c *fsContext) FromValue(v *compiler.Value) (*FS, error) {
c.l.RLock()
defer c.l.RUnlock()

View File

@@ -55,6 +55,10 @@ func (c *secretContext) New(plaintext string) *Secret {
return secret
}
func (c *secretContext) Contains(v *compiler.Value) bool {
return v.LookupPath(secretIDPath).Exists()
}
func (c *secretContext) FromValue(v *compiler.Value) (*Secret, error) {
c.l.RLock()
defer c.l.RUnlock()

View File

@@ -62,6 +62,10 @@ func (c *serviceContext) New(unix, npipe string) *Service {
return s
}
func (c *serviceContext) Contains(v *compiler.Value) bool {
return v.LookupPath(serviceIDPath).Exists()
}
func (c *serviceContext) FromValue(v *compiler.Value) (*Service, error) {
c.l.RLock()
defer c.l.RUnlock()