mirror of
https://github.com/RoBaertschi/tt.git
synced 2025-04-16 05:53:30 +00:00
fixed some bugs
This commit is contained in:
parent
508b3fdc7a
commit
6425cd3b55
@ -175,7 +175,10 @@ func (be *BinaryExpression) String() string {
|
||||
type BlockExpression struct {
|
||||
Token token.Token // The '{'
|
||||
Expressions []Expression
|
||||
ReturnExpression Expression // A expression that does not end with a semicolon, there can only be one of those and it hast to be at the end
|
||||
// NOTE: Nullable
|
||||
//
|
||||
// A expression that does not end with a semicolon, there can only be one of those and it has to be at the end
|
||||
ReturnExpression Expression
|
||||
}
|
||||
|
||||
func (be *BlockExpression) expressionNode() {}
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime/debug"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
@ -149,7 +150,7 @@ func build(outputWriter io.Writer, input string, output string, toPrint ToPrintF
|
||||
|
||||
defer func() {
|
||||
if panicErr := recover(); panicErr != nil {
|
||||
err = fmt.Errorf("panic in build: %#v", panicErr)
|
||||
err = fmt.Errorf("panic in build: %#v\n%s", panicErr, debug.Stack())
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -118,7 +118,9 @@ func VarResolveExpr(s *Scope, e ast.Expression) error {
|
||||
for _, e := range e.Expressions {
|
||||
errs = append(errs, VarResolveExpr(&newS, e))
|
||||
}
|
||||
if e.ReturnExpression != nil {
|
||||
errs = append(errs, VarResolveExpr(&newS, e.ReturnExpression))
|
||||
}
|
||||
|
||||
return errors.Join(errs...)
|
||||
case *ast.IfExpression:
|
||||
@ -145,7 +147,7 @@ func VarResolveExpr(s *Scope, e ast.Expression) error {
|
||||
return errorf(e.Token, "variable %q redefined", e.Identifier)
|
||||
}
|
||||
|
||||
s.SetUniq(e.Identifier)
|
||||
e.Identifier = s.SetUniq(e.Identifier)
|
||||
case *ast.VariableReference:
|
||||
v, ok := s.Get(e.Identifier)
|
||||
if !ok {
|
||||
|
Loading…
x
Reference in New Issue
Block a user