Skip to content

v0.1.1

Latest

Choose a tag to compare

@Calcium-Ion Calcium-Ion released this 16 Nov 05:55
b7f49c1

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 destructuring null throws its TypeError before evaluating computed property names. (o?.tag) as a template tag gets o as this. (#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 in Reflect.construct(F, [], Object). (#15, fixes #14, thanks to @baranwang)
  • Runtime.RunContext (new): One context covers Load, Call and 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: indexOf and lastIndexOf take 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, ToGoInto and FromGo that go through encoding/json now use moego's json, with the same results and errors as encoding/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

Full Changelog: v0.1.0...v0.1.1