Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | 26891x 26891x 26891x 21510x 4x 9938x 7x 5x 26917x | /**
* Parallels Spring TypedValue
*
* Wraps evaluation result with type descriptor; core data carrier in the evaluation pipeline.
*/
import type { NumericKind } from './type/numeric.js';
export class TypedValue {
private readonly value: unknown;
private readonly typeDescriptor: unknown;
private readonly numericKind: NumericKind | undefined;
constructor(value: unknown, typeDescriptor?: unknown, numericKind?: NumericKind) {
this.value = value;
this.typeDescriptor = typeDescriptor ?? null;
this.numericKind = numericKind;
}
/**
* Get raw value
*/
public getValue(): unknown {
return this.value;
}
/**
* Get type descriptor
*/
public getTypeDescriptor(): unknown {
return this.typeDescriptor;
}
/**
* The Java numeric kind of this value, when it is numeric.
*
* JavaScript numbers carry no such distinction, so the kind has to travel
* with the value: it is what lets `8 / 5` evaluate to `1` rather than `1.6`.
* Values that did not originate from a numeric literal or a numeric operator
* report `undefined`, and callers fall back to {@link inferKind}.
*/
public getNumericKind(): NumericKind | undefined {
return this.numericKind;
}
/**
* Whether is null
*/
public isNull(): boolean {
return this.value === null || this.value === undefined;
}
public toString(): string {
return String(this.value);
}
/**
* TypedValue.NULL singleton, represents null-typed value
*/
public static readonly NULL = new TypedValue(null);
}
|