diff --git a/cmd/tengo/main.go b/cmd/tengo/main.go index f67e2a8..afddd68 100644 --- a/cmd/tengo/main.go +++ b/cmd/tengo/main.go @@ -67,8 +67,7 @@ func main() { os.Exit(1) } } else if filepath.Ext(inputFile) == sourceFileExt { - if len(inputData) > 1 && - bytes.Compare(inputData[:2], []byte("#!")) == 0 { + if len(inputData) > 1 && string(inputData[:2]) == "#!" { copy(inputData, "//") } err := CompileAndRun(modules, inputData, inputFile) diff --git a/compiler.go b/compiler.go index 6ecc986..1e2a494 100644 --- a/compiler.go +++ b/compiler.go @@ -1086,6 +1086,7 @@ func (c *Compiler) fork( child := NewCompiler(file, symbolTable, nil, c.modules, c.trace) child.modulePath = modulePath // module file path child.parent = c // parent to set to current compiler + child.allowFileImport = c.allowFileImport return child }