• dearblue's avatar
    Print error before cleanup in `codegen_error()` · 26338fe6
    dearblue authored
    Previously, it always pointed to the highest scope as the location of the error.
    
      - example code `code.rb`
    
        ```ruby
        huge_num = "1" + "0" * 300; eval <<CODE, nil, "test.rb", 1
        class Object
          module A
            #{huge_num}
          end
        end
        CODE
        ```
    
      - Before this patch
    
        ```console
        % bin/mruby code.rb
        test.rb:1: integer too big
        trace (most recent call last):
                [1] code.rb:1
        code.rb:1:in eval: codegen error (ScriptError)
        ```
    
      - After this patch
    
        ```console
        % bin/mruby code.rb
        test.rb:3: integer too big
        trace (most recent call last):
                [1] code.rb:1
        code.rb:1:in eval: codegen error (ScriptError)
        ```
    26338fe6
codegen.c 87.6 KB