Closed 64kramsystem closed 6 years ago
An expression of the form:
def test (@instance = 1) end
crashes the interpreter.
If the parenthesis are removed, or the code is expressed in a single line, the interpreter won't crash.
This is the crash message/stack:
panic: interface conversion: ast.Expression is *ast.InstanceVariable, not *ast.Identifier goroutine 1 [running]: github.com/goby-lang/goby/compiler/bytecode.(*Generator).compileDefStmt(0xc4201d2d80, 0xc4201d6910, 0xc4201d9bc0, 0xc420177878) /path/to/workspace/go/src/github.com/goby-lang/goby/compiler/bytecode/statement_generation.go:203 +0x12fe github.com/goby-lang/goby/compiler/bytecode.(*Generator).compileStatement(0xc4201d2d80, 0xc4201d6910, 0x1091d80, 0xc4201d9bc0, 0xc420177878, 0xc4201bfb00) /path/to/workspace/go/src/github.com/goby-lang/goby/compiler/bytecode/statement_generation.go:47 +0x50f github.com/goby-lang/goby/compiler/bytecode.(*Generator).compileCodeBlock(0xc4201d2d80, 0xc4201d6910, 0xc4201bf9c0, 0xc420177878, 0xc4201bfb00) /path/to/workspace/go/src/github.com/goby-lang/goby/compiler/bytecode/generator.go:73 +0x7e github.com/goby-lang/goby/compiler/bytecode.(*Generator).compileClassStmt(0xc4201d2d80, 0xc4201d67d0, 0xc4201d9b80, 0xc4201d2e10, 0xc4201bf640) /path/to/workspace/go/src/github.com/goby-lang/goby/compiler/bytecode/statement_generation.go:149 +0x42e github.com/goby-lang/goby/compiler/bytecode.(*Generator).compileStatement(0xc4201d2d80, 0xc4201d67d0, 0x1091cc0, 0xc4201d9b80, 0xc4201d2e10, 0xc4201bf640) /path/to/workspace/go/src/github.com/goby-lang/goby/compiler/bytecode/statement_generation.go:49 +0x10b github.com/goby-lang/goby/compiler/bytecode.(*Generator).compileStatements(0xc4201d2d80, 0xc4201c7ce0, 0x1, 0x1, 0xc4201d2e10, 0xc4201bf640) /path/to/workspace/go/src/github.com/goby-lang/goby/compiler/bytecode/statement_generation.go:22 +0xd0 github.com/goby-lang/goby/compiler/bytecode.(*Generator).GenerateInstructions(0xc4201d2d80, 0xc4201c7ce0, 0x1, 0x1, 0x3, 0xc4201d0da0, 0xf) /path/to/workspace/go/src/github.com/goby-lang/goby/compiler/bytecode/generator.go:54 +0x5b github.com/goby-lang/goby/igb.StartIgb(0xbd4e34, 0x7) /path/to/workspace/go/src/github.com/goby-lang/goby/igb/repl.go:224 +0xcd8 main.main() /path/to/workspace/go/src/github.com/goby-lang/goby/goby.go:29 +0x954
@saveriomiroddi thanks for report, I'll looking into it
@shes50103 here's another case that'll crash the parser
got it I will fix it
An expression of the form:
crashes the interpreter.
If the parenthesis are removed, or the code is expressed in a single line, the interpreter won't crash.
This is the crash message/stack: