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 | 1x 1x 1x 1x 1x 1x 1x 21x 21x 21x 21x 21x 4x 4x 17x 21x 17x 17x 17x 1x | import {INode} from "../../nodes/_inode";
import {AnyType, DataReference, DataType, UnknownType, VoidType} from "../../types/basic";
import {AbstractType} from "../../types/basic/_abstract_type";
import {CheckSyntaxKey, SyntaxInput, syntaxIssue} from "../_syntax_input";
export class Dereference {
public static runSyntax(node: INode, type: AbstractType | undefined, input: SyntaxInput): AbstractType | undefined {
if (type instanceof VoidType
|| type instanceof AnyType
|| type instanceof DataType
|| type === undefined
|| type instanceof UnknownType) {
return type;
}
if (!(type instanceof DataReference)) {
const message = "Not a data reference, cannot be dereferenced";
input.issues.push(syntaxIssue(input, node.getFirstToken(), message));
return VoidType.get(CheckSyntaxKey);
}
return type.getType();
}
} |