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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 16x 16x 16x 3x 3x 3x 13x 16x 8x 8x 8x 8x 8x 8x 8x 1x 1x 1x 1x 8x 7x 7x 5x 16x 2x 2x 5x 5x 5x 5x 5x 1x 1x | import * as Expressions from "../../2_statements/expressions";
import {ExpressionNode, StatementNode} from "../../nodes";
import {TableType, UnknownType, VoidType} from "../../types/basic";
import {SyntaxInput, syntaxIssue} from "../_syntax_input";
import {SQLSetOpGroup} from "./sql_set_op_group";
import {SQLSource} from "./sql_source";
export class SQLIn {
public static runSyntax(node: ExpressionNode | StatementNode, input: SyntaxInput): void {
const setop = node.findDirectExpression(Expressions.SQLSetOpGroup);
if (setop) {
SQLSetOpGroup.runSyntax(setop, input);
return;
}
if (node.getChildren().length === 2) {
const insource = node.findFirstExpression(Expressions.SQLSource);
if (insource) {
const intype = SQLSource.runSyntax(insource, input);
if (intype &&
!(intype instanceof VoidType) &&
!(intype instanceof UnknownType) &&
!(intype instanceof TableType)) {
const message = "IN, not a table";
input.issues.push(syntaxIssue(input, node.getFirstToken(), message));
return;
}
}
return;
}
for (const s of node.findDirectExpressions(Expressions.SQLSource)) {
SQLSource.runSyntax(s, input);
}
for (const s of node.findDirectExpressions(Expressions.SQLSourceNoSpace)) {
SQLSource.runSyntax(s, input);
}
}
}
|