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 62 63 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 34x 34x 34x 6x 6x 6x 6x 6x 6x 6x 2x 2x 2x 2x 6x 32x 34x 5x 5x 32x 32x 32x 32x 32x 34x 7x 7x 32x 32x 34x 11x 11x 3x 2x 2x 1x 1x 1x 1x 1x 3x 1x 1x 1x 3x 11x 34x 34x 1x | import * as Expressions from "../../2_statements/expressions";
import {StatementNode} from "../../nodes";
import {Target} from "../expressions/target";
import {Source} from "../expressions/source";
import {Dynamic} from "../expressions/dynamic";
import {StatementSyntax} from "../_statement_syntax";
import {BasicTypes} from "../basic_types";
import {AnyType, TableType, UnknownType, VoidType} from "../../types/basic";
import {TypedIdentifier} from "../../types/_typed_identifier";
import {ReferenceType} from "../_reference";
import {SyntaxInput, syntaxIssue} from "../_syntax_input";
export class CreateData implements StatementSyntax {
public runSyntax(node: StatementNode, input: SyntaxInput): void {
const likeLineOf = node.concatTokens().toUpperCase().includes(" LIKE LINE OF ");
for (const s of node.findDirectExpressions(Expressions.Source)) {
const sourceType = Source.runSyntax(s, input);
if (likeLineOf === true
&& sourceType !== undefined
&& !(sourceType instanceof TableType)
&& !(sourceType instanceof VoidType)
&& !(sourceType instanceof UnknownType)
&& !(sourceType instanceof AnyType)) {
const message = `"${s.concatTokens()}" is not an internal table`;
input.issues.push(syntaxIssue(input, node.getFirstToken(), message));
return;
}
}
for (const s of node.findDirectExpressions(Expressions.SimpleSource3)) {
Source.runSyntax(s, input);
}
for (const t of node.findDirectExpressions(Expressions.Target)) {
Target.runSyntax(t, input);
}
for (const t of node.findDirectExpressions(Expressions.Dynamic)) {
Dynamic.runSyntax(t, input);
}
const type = node.findDirectExpression(Expressions.TypeName);
if (type) {
const found = new BasicTypes(input).resolveTypeName(type);
if (found instanceof UnknownType) {
if (node.concatTokens().toUpperCase().includes(" REF TO ")) {
const def = input.scope.findObjectDefinition(type.concatTokens());
if (def) {
input.scope.addReference(type.getFirstToken(), def, ReferenceType.TypeReference, input.filename);
} else {
const identifier = new TypedIdentifier(type.getFirstToken(), input.filename, found);
input.scope.addReference(type.getFirstToken(), identifier, ReferenceType.TypeReference, input.filename);
}
} else {
const identifier = new TypedIdentifier(type.getFirstToken(), input.filename, found);
input.scope.addReference(type.getFirstToken(), identifier, ReferenceType.TypeReference, input.filename);
}
}
}
}
} |