From df92f55df6092407025ab0eba766d9a767a085fa Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Thu, 19 Jun 2025 14:01:00 +0200 Subject: [PATCH] Simplified compiler interface --- src/cli/build.go | 3 +-- src/compiler/Compile.go | 8 ++++++-- src/compiler/Compile_test.go | 3 +-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/cli/build.go b/src/cli/build.go index 88aae64..a56ae36 100644 --- a/src/cli/build.go +++ b/src/cli/build.go @@ -6,7 +6,6 @@ import ( "git.urbach.dev/cli/q/src/build" "git.urbach.dev/cli/q/src/compiler" - "git.urbach.dev/cli/q/src/scanner" ) // _build parses the arguments and creates a build. @@ -17,7 +16,7 @@ func _build(args []string) int { return exit(err) } - _, err = compiler.Compile(scanner.Scan(b)) + _, err = compiler.Compile(b) if err != nil { return exit(err) diff --git a/src/compiler/Compile.go b/src/compiler/Compile.go index 3b47936..4cf57e6 100644 --- a/src/compiler/Compile.go +++ b/src/compiler/Compile.go @@ -1,8 +1,12 @@ package compiler -import "git.urbach.dev/cli/q/src/scanner" +import ( + "git.urbach.dev/cli/q/src/build" + "git.urbach.dev/cli/q/src/scanner" +) // Compile waits for the scan to finish and compiles all functions. -func Compile(scan scanner.Result) (Result, error) { +func Compile(b *build.Build) (Result, error) { + scanner.Scan(b) return Result{}, nil } \ No newline at end of file diff --git a/src/compiler/Compile_test.go b/src/compiler/Compile_test.go index 858e3ea..926ef78 100644 --- a/src/compiler/Compile_test.go +++ b/src/compiler/Compile_test.go @@ -5,12 +5,11 @@ import ( "git.urbach.dev/cli/q/src/build" "git.urbach.dev/cli/q/src/compiler" - "git.urbach.dev/cli/q/src/scanner" "git.urbach.dev/go/assert" ) func TestCompile(t *testing.T) { b := build.New("../../examples/hello") - _, err := compiler.Compile(scanner.Scan(b)) + _, err := compiler.Compile(b) assert.Nil(t, err) } \ No newline at end of file