提取 expandCore 函数作为变量展开的核心实现, 消除 Expand 和 ExpandString 方法中的重复代码。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>