35 lines
412 B
JavaScript
35 lines
412 B
JavaScript
export class Literal {
|
|
|
|
static type() {
|
|
return 'literal';
|
|
}
|
|
|
|
constructor() {
|
|
this.value = null;
|
|
}
|
|
|
|
clone(other) {
|
|
this.value = other.value;
|
|
}
|
|
|
|
fromJSON(json) {
|
|
this.value = json.value;
|
|
return this;
|
|
}
|
|
|
|
get(context) {
|
|
return this.value;
|
|
}
|
|
|
|
set(value) {
|
|
this.value = value;
|
|
}
|
|
|
|
toJSON() {
|
|
return {
|
|
type: 'literal',
|
|
value: this.value,
|
|
}
|
|
}
|
|
}
|