|
|
@@ -16,6 +16,9 @@ export class VariableTable implements IVariableTable {
|
|
|
|
|
|
toDispose = new DisposableCollection();
|
|
|
|
|
|
+ /**
|
|
|
+ * @deprecated
|
|
|
+ */
|
|
|
protected onDataChangeEmitter = new Emitter<void>();
|
|
|
|
|
|
protected variables$: Subject<VariableDeclaration[]> = new Subject<VariableDeclaration[]>();
|
|
|
@@ -71,7 +74,7 @@ export class VariableTable implements IVariableTable {
|
|
|
protected _version: number = 0;
|
|
|
|
|
|
fireChange() {
|
|
|
- this._version++;
|
|
|
+ this.bumpVersion();
|
|
|
this.onDataChangeEmitter.fire();
|
|
|
this.variables$.next(this.variables);
|
|
|
this.parentTable?.fireChange();
|
|
|
@@ -81,13 +84,22 @@ export class VariableTable implements IVariableTable {
|
|
|
return this._version;
|
|
|
}
|
|
|
|
|
|
+ protected bumpVersion() {
|
|
|
+ this._version = this._version + 1;
|
|
|
+ if (this._version === Number.MAX_SAFE_INTEGER) {
|
|
|
+ this._version = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
constructor(
|
|
|
public parentTable?: IVariableTable // 父变量表,会包含所有子表的变量
|
|
|
) {
|
|
|
this.toDispose.pushAll([
|
|
|
this.onDataChangeEmitter,
|
|
|
// active share()
|
|
|
- this.onAnyVariableChange(() => null),
|
|
|
+ this.onAnyVariableChange(() => {
|
|
|
+ this.bumpVersion();
|
|
|
+ }),
|
|
|
]);
|
|
|
}
|
|
|
|