mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
revert(context): plain {} registers and getRegister ||
Registers are only mutated by tag implementations, not templates; keep null-prototype scopes/createScope for push frames. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -13,7 +13,7 @@ export class Context {
|
||||
* for tags like `{% capture %}` `{% assign %}` to operate
|
||||
*/
|
||||
private scopes: Scope[] = [createScope()]
|
||||
private registers: Record<string, any> = Object.create(null)
|
||||
private registers = {}
|
||||
/**
|
||||
* user passed in scope
|
||||
* `{% increment %}`, `{% decrement %}` changes this scope,
|
||||
@@ -49,7 +49,7 @@ export class Context {
|
||||
this.renderLimit = renderLimit ?? new Limiter('template render', getPerformance().now() + (renderOptions.renderLimit ?? opts.renderLimit))
|
||||
}
|
||||
public getRegister<T> (key: string, defaultValue: T = undefined as T): T {
|
||||
return (this.registers[key] = this.registers[key] ?? defaultValue)
|
||||
return (this.registers[key] = this.registers[key] || defaultValue)
|
||||
}
|
||||
public setRegister (key: string, value: any) {
|
||||
return (this.registers[key] = value)
|
||||
|
||||
Reference in New Issue
Block a user