lang: Remove the specialized info structs

Since this was an early form of the modern data struct, remove those and
pass in the correct data. This is also important in case we have
something more complex inside our string interpolation!
This commit is contained in:
James Shubin
2019-07-26 03:35:22 -04:00
parent 1e678905c4
commit ee638254c3
2 changed files with 50 additions and 44 deletions

View File

@@ -4929,13 +4929,25 @@ func (obj *ExprStr) Interpolate() (interfaces.Expr, error) {
//Line: -1, // TODO
//Filename: "", // optional source filename, if known
}
info := &InterpolateInfo{
Debug: obj.data.Debug,
data := &interfaces.Data{
// TODO: add missing fields here if/when needed
Fs: obj.data.Fs,
FsURI: obj.data.FsURI,
Base: obj.data.Base,
Files: obj.data.Files,
Imports: obj.data.Imports,
Metadata: obj.data.Metadata,
Modules: obj.data.Modules,
Downloader: obj.data.Downloader,
//World: obj.data.World,
Prefix: obj.data.Prefix,
Debug: obj.data.Debug,
Logf: func(format string, v ...interface{}) {
obj.data.Logf("interpolate: "+format, v...)
},
}
result, err := InterpolateStr(obj.V, pos, info)
result, err := InterpolateStr(obj.V, pos, data)
if err != nil {
return nil, err
}