lang: Pass through the Fs and the FsURI

This should give us options as to how a function should interact with an
FS. I feel like it's cleaner to go through the World API, and passing in
the FsURI lets us do that, but I passed in the Fs at the same time in
case it's useful for some reason. I think using it is a boundary
violation, but it's just a hunch. Does anything break when we move from
one deploy to the next?
This commit is contained in:
James Shubin
2019-07-23 01:26:00 -04:00
parent 4b6b91c08b
commit 066048f4de
8 changed files with 47 additions and 9 deletions

View File

@@ -3241,7 +3241,9 @@ func (obj *StmtProg) importScopeWithInputs(s string, scope *interfaces.Scope, pa
logf("init...")
// init and validate the structure of the AST
data := &interfaces.Data{
// TODO: add missing fields here if/when needed
Fs: obj.data.Fs,
FsURI: obj.data.FsURI,
Base: output.Base, // new base dir (absolute path)
Files: files,
Imports: parentVertex, // the parent vertex that imported me
@@ -6690,7 +6692,9 @@ func (obj *ExprFunc) Init(data *interfaces.Data) error {
// TODO: do we want to pass in the full obj.data instead ?
if dataFunc, ok := obj.function.(interfaces.DataFunc); ok {
dataFunc.SetData(&interfaces.FuncData{
Base: obj.data.Base,
Fs: obj.data.Fs,
FsURI: obj.data.FsURI,
Base: obj.data.Base,
})
}
}
@@ -6776,7 +6780,9 @@ func (obj *ExprFunc) Copy() (interfaces.Expr, error) {
// TODO: do we want to pass in the full obj.data instead ?
if dataFunc, ok := function.(interfaces.DataFunc); ok {
dataFunc.SetData(&interfaces.FuncData{
Base: obj.data.Base,
Fs: obj.data.Fs,
FsURI: obj.data.FsURI,
Base: obj.data.Base,
})
}
copied = true