Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 265d96a

Browse files
EisenbergEffectcaitp
authored andcommitted
refactor(all): remove unneeded getters/setters and obsolete code
Remove unneeded getters/setters. Remove old dccdgroup code. Remove unneeded code from watch record. Improving code paragraphing. Fixing linting errors.
1 parent b7085e7 commit 265d96a

File tree

5 files changed

+489
-664
lines changed

5 files changed

+489
-664
lines changed

src/ast.js

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ function _argsList(list) {
1414

1515
export class AST {
1616
constructor(expression) {
17-
if (typeof expression !== "string") throw "expression must be a string";
17+
if (typeof expression !== "string") {
18+
throw "expression must be a string";
19+
}
20+
1821
this.expression = expression.indexOf('#.') === 0
1922
? expression.substr(2)
2023
: expression;
@@ -43,10 +46,14 @@ export class ContextReferenceAST extends AST {
4346

4447
export class ConstantAST extends AST {
4548
constructor(constant, expression) {
46-
if (arguments.length < 2) expression = null;
49+
if (arguments.length < 2) {
50+
expression = null;
51+
}
52+
4753
super(expression === null
4854
? (typeof constant === "string" ? `"${constant}"` : `${constant}`)
4955
: expression);
56+
5057
this.constant = constant;
5158
}
5259

@@ -59,6 +66,7 @@ export class FieldReadAST extends AST {
5966
constructor(lhs, name) {
6067
this.lhs = lhs;
6168
this.name = name;
69+
6270
super(`${lhs}.${name}`);
6371
}
6472

@@ -72,6 +80,7 @@ export class PureFunctionAST extends AST {
7280
this.fn = fn;
7381
this.argsAST = argsAST;
7482
this.name = name;
83+
7584
super(`${name}(${_argsList(argsAST)})`);
7685
}
7786

@@ -85,6 +94,7 @@ export class MethodAST extends AST {
8594
this.lhsAST = lhsAST;
8695
this.name = name;
8796
this.argsAST = argsAST;
97+
8898
super(`${lhsAST}.${name}(${_argsList(argsAST)})`);
8999
}
90100

@@ -96,6 +106,7 @@ export class MethodAST extends AST {
96106
export class CollectionAST extends AST {
97107
constructor(valueAST) {
98108
this.valueAST = valueAST;
109+
99110
super(`#collection(${valueAST})`);
100111
}
101112

@@ -108,6 +119,7 @@ class _ConstantWatchRecord {
108119
constructor(watchGroup, expression, currentValue) {
109120
this.currentValue = currentValue;
110121
this.handler = new _ConstantHandler(watchGroup, expression, currentValue);
122+
this.field = this.previousValue = this.object = this.nextChange = null;
111123
}
112124

113125
check() {
@@ -117,24 +129,4 @@ class _ConstantWatchRecord {
117129
remove() {
118130
return null;
119131
}
120-
121-
get field() {
122-
return null;
123-
}
124-
125-
get previousValue() {
126-
return null;
127-
}
128-
129-
get object() {
130-
return null;
131-
}
132-
133-
set object(value) {
134-
return null;
135-
}
136-
137-
get nextChange() {
138-
return null;
139-
}
140132
}

0 commit comments

Comments
 (0)