Skip to content

Commit 0c0ccf2

Browse files
committed
extract compile parse-error aggregation helper
1 parent 69bb703 commit 0c0ccf2

3 files changed

Lines changed: 18 additions & 15 deletions

File tree

docs/architecture.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Key files:
9292
- `vibes/ast.go`
9393
- `vibes/execution_compile.go` (AST lowering into compiled script functions/classes)
9494
- `vibes/execution_compile_classes.go` (class/property/method lowering helpers for compile)
95+
- `vibes/execution_compile_errors.go` (parse error aggregation for compile failures)
9596

9697
## Modules (`require`)
9798

vibes/execution_compile.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package vibes
22

33
import (
4-
"errors"
54
"fmt"
65
)
76

@@ -36,17 +35,3 @@ func (e *Engine) Compile(source string) (*Script, error) {
3635
script.bindFunctionOwnership()
3736
return script, nil
3837
}
39-
40-
func combineErrors(errs []error) error {
41-
if len(errs) == 1 {
42-
return errs[0]
43-
}
44-
msg := ""
45-
for _, err := range errs {
46-
if msg != "" {
47-
msg += "\n\n"
48-
}
49-
msg += err.Error()
50-
}
51-
return errors.New(msg)
52-
}

vibes/execution_compile_errors.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package vibes
2+
3+
import "errors"
4+
5+
func combineErrors(errs []error) error {
6+
if len(errs) == 1 {
7+
return errs[0]
8+
}
9+
msg := ""
10+
for _, err := range errs {
11+
if msg != "" {
12+
msg += "\n\n"
13+
}
14+
msg += err.Error()
15+
}
16+
return errors.New(msg)
17+
}

0 commit comments

Comments
 (0)