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 64 65 66 67 68 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 28x 28x 28x 28x 28x 28x 24x 24x 14x 24x 6x 6x 10x 4x 4x 24x 24x 24x 28x 121x 121x 4x 4x 4x 4x 4x 2x 2x 4x 119x 119x 22x 22x 22x 28x 2x 2x 2x 2x 22x 28x 1x 1x 22x 28x 2x 2x 28x 28x 1x 1x 22x 22x 1x | import * as Expressions from "../../2_statements/expressions"; import {ExpressionNode, StatementNode} from "../../nodes"; import {CurrentScope} from "../_current_scope"; import {Source} from "../expressions/source"; import {IReferenceExtras, ReferenceType} from "../_reference"; import {ObjectReferenceType, VoidType} from "../../types/basic"; import {StatementSyntax} from "../_statement_syntax"; import {MessageSource} from "../expressions/message_source"; import {RaiseWith} from "../expressions/raise_with"; export class Raise implements StatementSyntax { public runSyntax(node: StatementNode, scope: CurrentScope, filename: string): void { // todo const classTok = node.findDirectExpression(Expressions.ClassName)?.getFirstToken(); const classNam = classTok?.getStr(); if (classNam) { const found = scope.existsObject(classNam); if (found.found === true && found.id) { scope.addReference(classTok, found.id, found.type, filename); } else if (scope.getDDIC().inErrorNamespace(classNam) === false) { const extra: IReferenceExtras = {ooName: classNam, ooType: "Void"}; scope.addReference(classTok, undefined, ReferenceType.ObjectOrientedVoidReference, filename, extra); } else { throw new Error("RAISE, unknown class " + classNam); } } let prev = ""; for (const c of node.getChildren()) { if (c instanceof ExpressionNode && (c.get() instanceof Expressions.SimpleSource2 || c.get() instanceof Expressions.Source)) { const type = new Source().runSyntax(c, scope, filename); if (prev === "EXCEPTION" && type && !(type instanceof VoidType) && !(type instanceof ObjectReferenceType)) { throw new Error("RAISE EXCEPTION, must be object reference, got " + type.constructor.name); } } prev = c.concatTokens().toUpperCase(); } // todo, check parameters vs constructor const param = node.findDirectExpression(Expressions.ParameterListS); if (param) { for (const s of param.findAllExpressions(Expressions.Source)) { new Source().runSyntax(s, scope, filename); } } for (const s of node.findDirectExpressions(Expressions.RaiseWith)) { new RaiseWith().runSyntax(s, scope, filename); } for (const s of node.findDirectExpressions(Expressions.Source)) { new Source().runSyntax(s, scope, filename); } for (const s of node.findDirectExpressions(Expressions.SimpleSource2)) { new Source().runSyntax(s, scope, filename); } for (const s of node.findDirectExpressions(Expressions.MessageSource)) { new MessageSource().runSyntax(s, scope, filename); } } } |