Repository navigation
Important
修复版本:解构和可选链的三处行为和 Node 一致了,多个运行时共用内置构造函数时的数据竞争已修复。API 没有破坏性变化,最低 Go 版本仍是 1.25。
A bug-fix release: three destructuring and optional-chain cases now behave as in Node, and a data race between runtimes that share the built-in constructors is fixed. No API breaks, and Go 1.25 is still the minimum.
中文
- 解构和可选链:
catch ({ x = x })的默认值读取自身绑定时抛出 ReferenceError,对null解构时在计算属性键之前就抛出 TypeError。(o?.tag)作为模板标签调用时,this是o。(#13,修复 #12,感谢 @seefs001) - 数据竞争:修复了多个 goroutine 上的运行时以共享的内置构造函数作
new.target时(如Reflect.construct(F, [], Object))的数据竞争。(#15,修复 #14,感谢 @baranwang) Runtime.RunContext(新增):一个 context 管住Load、Call和结果解码,取消或超时时中断 JavaScript,返回*InterruptedError。用法见 guide。(#10,感谢 @yuluo-yx)- 字符串和正则:
indexOf和lastIndexOf在重复前缀的输入上是线性时间,之前最坏 O(n×m)。(#9,感谢 @yuluo-yx)用新模式构造 RegExp 快了约一倍。(#11,感谢 @zbysir) - Go 值转换:
Unmarshal、ToGoInto和FromGo经过encoding/json的部分改用 moego 的 json,结果和错误都与encoding/json相同。moego 升级到 v0.1.0-alpha.3。
English
- Destructuring and optional chains: In
catch ({ x = x }), a default that reads its own binding throws a ReferenceError, and destructuringnullthrows its TypeError before evaluating computed property names.(o?.tag)as a template tag getsoasthis. (#13, fixes #12, thanks to @seefs001) - Data race: Fixed a race between runtimes on several goroutines that construct with a shared built-in constructor as
new.target, as inReflect.construct(F, [], Object). (#15, fixes #14, thanks to @baranwang) Runtime.RunContext(new): One context coversLoad,Calland decoding the result. Canceling it or a timeout interrupts the JavaScript and returns an*InterruptedError(see the guide). (#10, thanks to @yuluo-yx)- Strings and regular expressions:
indexOfandlastIndexOftake linear time on inputs with repeated prefixes, where the worst case was O(n×m). (#9, thanks to @yuluo-yx) Building a RegExp from a new pattern takes about half the time. (#11, thanks to @zbysir) - Go value conversion: The parts of
Unmarshal,ToGoIntoandFromGothat go throughencoding/jsonnow use moego's json, with the same results and errors asencoding/json. moego is now v0.1.0-alpha.3.
What's Changed
- perf(engine): avoid quadratic UTF-16 string searches by @yuluo-yx in #9
- perf(engine): build RegExps of new patterns ~2× faster by @zbysir in #11
- feat: add context by @yuluo-yx in #10
- Fix destructuring TDZ, null-check order, and optional-chain tag this by @seefs001 in #13
- Do not write ctorSlots of a shared intrinsic new.target by @baranwang in #15
New Contributors
- @zbysir made their first contribution in #11
- @seefs001 made their first contribution in #13
- @baranwang made their first contribution in #15
Full Changelog: v0.1.0...v0.1.1