Skip to content

Conversation

Copy link

Copilot AI commented Dec 22, 2025

The call tag was not updating exported scene variables. Assignments like <call method="hoge = 1" /> created local variables instead of modifying the scene context, breaking conditional logic and variable expansion.

Root Cause

executeCode() passed scene properties by value, making assignments local-only:

// Before: assignments create local variables
const context = { ...this.sceneFile }
const func = new Function(...Object.keys(context), code)
return func.apply(null, Object.values(context))

Changes

  • Modified executeCode() to use Proxy: Intercepts property access/assignment to modify sceneFile directly
  • Uses with statement: Enables natural variable syntax while maintaining reference to source object
  • Added comprehensive unit tests: Covers assignment, conditions, expansion, and the reported if_test scenario
// After: assignments modify sceneFile properties
const context = new Proxy(this.sceneFile, {
  get: (target, key) => target[key],
  set: (target, key, value) => {
    target[key] = value
    return true
  }
})
const func = new Function('context', `with(context) { ${code} }`)
return func.call(null, context)

Verification

Manual test confirms proper behavior:

Test Results

Variable assignments now propagate correctly to conditionals (if="hoge==1") and expansions ({{hoge}}).

Original prompt

This section details on the original issue you should resolve

<issue_title>callタグが機能しない</issue_title>
<issue_description>IF属性デモで、値が変わらない


Trelloから移行 (doing): https://trello.com/c/zxmRmJus</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits December 22, 2025 05:03
Use Proxy and 'with' statement to execute code in sceneFile context, allowing assignments to modify the original properties instead of creating local variables.

Co-authored-by: EndoHizumi <[email protected]>
Copilot AI changed the title [WIP] Fix call tag functionality in IF attribute demo Fix call tag variable assignments using Proxy-based context Dec 22, 2025
Copilot AI requested a review from EndoHizumi December 22, 2025 05:12
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.

callタグが機能しない

2 participants