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 223x 223x 223x 223x 223x 223x 223x 10x 10x 213x 213x 223x 160x 160x 160x 53x 53x 223x 223x 53x 223x 60x 31x 31x 29x 60x 3x 3x 3x 3x 60x 50x | import {AbstractToken} from "../../1_lexer/tokens/abstract_token";
import {StructureType, UnknownType, VoidType} from "../../types/basic";
import {SyntaxInput, syntaxIssue} from "../_syntax_input";
import {DatabaseTableSource} from "./database_table";
export function checkDatabaseFields(
fields: readonly string[],
dbSources: DatabaseTableSource[],
input: SyntaxInput,
token: AbstractToken,
): void {
if (dbSources.length > 1) {
return;
}
const first = dbSources[0];
if (first === undefined) {
// then its voided
return;
}
const type = first.parseType(input.scope.getRegistry());
if (type instanceof VoidType || type instanceof UnknownType) {
return;
}
if (!(type instanceof StructureType)) {
const message = "checkFields, expected structure, " + type.constructor.name;
input.issues.push(syntaxIssue(input, token, message));
return;
}
for (const field of fields) {
if (field === "*") {
continue;
}
if (/^[A-Z_]\w*$/i.test(field) && type.getComponentByName(field) === undefined) {
const message = `checkFields, field ${field} not found`;
input.issues.push(syntaxIssue(input, token, message));
return;
}
}
}
|