Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print error before cleanup in codegen_error() #5603

Merged
merged 1 commit into from
Dec 18, 2021

Conversation

dearblue
Copy link
Contributor

Previously, it always pointed to the highest scope as the location of the error.

  • example code code.rb

    huge_num = "1" + "0" * 300; eval <<CODE, nil, "test.rb", 1
    class Object
      module A
        #{huge_num}
      end
    end
    CODE
  • Before this patch

    % 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

    % 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)

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)
    ```
@dearblue dearblue requested a review from matz as a code owner December 17, 2021 14:14
@matz matz merged commit d7812bd into mruby:master Dec 18, 2021
@dearblue dearblue deleted the codegen_error branch January 4, 2022 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants