import {CodeNodeDef} from "../parser/definition/types/CodeNodeDef"; import {DummyNodeDef} from "../parser/definition/types/DummyNodeDef"; import {NodeDef} from "../parser/definition/types/NodeDef"; import {StructureNodeDef} from "../parser/definition/types/StructureNodeDef"; import {CompilationTargetId} from "../types/CompilationTargetId"; import {compileCodeNodeDef} from "./compileCodeNodeDef"; import {compileDummyNodeDef} from "./compileDummyNodeDef"; import {compileStructureNodeDef} from "./compileStructureNodeDef"; import {isCodeNodeDef} from "./utils/isCodeNodeDef"; import {isStructureNodeDef} from "./utils/isStructureNodeDef"; export function compileNodeDef( factoryId: string, nodeDef: NodeDef, targetId: CompilationTargetId ): string { if (isCodeNodeDef(nodeDef)) { return compileCodeNodeDef(factoryId, nodeDef as CodeNodeDef, targetId); } else if (isStructureNodeDef(nodeDef)) { return compileStructureNodeDef(factoryId, nodeDef as StructureNodeDef); } else { return compileDummyNodeDef(factoryId, nodeDef as DummyNodeDef); } }