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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 10x 10x 10x 10x 10x 10x 10x 10x 3x 3x 10x 10x 10x 7x 7x 3x 2x 2x 1x 1x 1x 1x 1x 3x 1x 1x 1x 3x 7x 10x 10x 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 {UnknownType} from "../../types/basic";
import {TypedIdentifier} from "../../types/_typed_identifier";
import {ReferenceType} from "../_reference";
import {SyntaxInput} from "../_syntax_input";
export class CreateData implements StatementSyntax {
public runSyntax(node: StatementNode, input: SyntaxInput): void {
for (const s of node.findDirectExpressions(Expressions.Source)) {
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);
}
}
}
}
} |