refactor: readonly 属性位置被编译到 class property 之后了, 先这样绕过

This commit is contained in:
力皓 2021-06-03 21:21:10 +08:00
parent f54f5b5775
commit a971bc786c
2 changed files with 10 additions and 6 deletions

View File

@ -41,10 +41,9 @@ export class Props implements IPropParent {
return this; return this;
} }
private stash = new PropStash(this, prop => { readonly owner: Node;
this.items.push(prop);
prop.parent = this; private stash: PropStash;
});
/** /**
* *
@ -55,7 +54,12 @@ export class Props implements IPropParent {
@obx type: 'map' | 'list' = 'map'; @obx type: 'map' | 'list' = 'map';
constructor(readonly owner: Node, value?: PropsMap | PropsList | null, extras?: object) { constructor(owner: Node, value?: PropsMap | PropsList | null, extras?: object) {
this.owner = owner;
this.stash = new PropStash(this, prop => {
this.items.push(prop);
prop.parent = this;
});
if (Array.isArray(value)) { if (Array.isArray(value)) {
this.type = 'list'; this.type = 'list';
this.items = value.map(item => new Prop(this, item.value, item.name, item.spread, { skipSetSlot: true })); this.items = value.map(item => new Prop(this, item.value, item.name, item.spread, { skipSetSlot: true }));

View File

@ -1,6 +1,6 @@
{ {
"entry": { "entry": {
"engine-core": "../engine/src/index-core.ts", "engine-core": "../engine/src/index.ts",
"vision-polyfill": "../vision-polyfill/src/index.ts", "vision-polyfill": "../vision-polyfill/src/index.ts",
"react-simulator-renderer": "../react-simulator-renderer/src/index.ts", "react-simulator-renderer": "../react-simulator-renderer/src/index.ts",
"rax-simulator-renderer": "../rax-simulator-renderer/src/index.ts" "rax-simulator-renderer": "../rax-simulator-renderer/src/index.ts"