Skip to content

fix(dncl): do not run the body of a defined function when running the Japanese program #2609

Done

Description

@smalruby3-editor-bot

autopilot-base: topic/japanese-mode-1731

不具合(B26)

日本語タブで関数を定義すると、実行ボタンでも緑の旗でも、関数の本体が 1 回、引数 0 で動く。

関数 greet(name):
    表示する("やあ " + name)
表示する("おわり")
  • 期待: おわり だけが表示される(呼んでいないので本体は動かない)
  • 実際: やあ 0 → おわり(実行ボタン・緑の旗の両方)

呼び出しがあると、呼んだ分に加えて 1 回多く動く(greet("たろう") があると やあ 0 → やあ たろう)。戻り値だけの関数(n * 2 を返す)は表示が無いので目立たない。

原因の見当

日本語のプログラムはハットの無いスクリプトになり、日本語タブでは実行ボタン・緑の旗でそれらを動かす(dncl-green-flag.js など)。そのとき、procedures_definition のスクリプトも動かしている。スクリプトの先頭は ["procedures_definition","smalrubyConsole_print"]。

確かめ方

プレビュー(https://preview.smalruby.app/topic-japanese-mode-1731-33b729d5/?locale=ja&tab=japanese )で上のプログラムを実行する。最終レビュー R10 を AI が確かめたときに見つけた。

Activity

  1. moved this to Sprint Backlog in Autopiloton Nov 28, 2026
  2. added
    🤖 autopilot
    on Nov 28, 2026
  3. moved this from Sprint Backlog to In Progress in Autopiloton Nov 28, 2026
  4. smalruby3-editor-bot commented on Nov 28, 2026

    @smalruby3-editor-bot
    Author

    🤖 対応 PR: #2617 (base: topic/japanese-mode-1731)

    この PR は非デフォルト base 宛てのため GitHub の Development 欄に表示されません。このコメントは autopilot が管理します(編集しないでください)。

  5. moved this from In Progress to Review in Autopiloton Nov 28, 2026
  6. added a commit that references this issue on Nov 28, 2026
  7. moved this from Review to Close in Autopiloton Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🤖 autopilot

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions