diff --git a/src/main.ts b/src/main.ts index 79af291d..c23b00aa 100644 --- a/src/main.ts +++ b/src/main.ts @@ -11,7 +11,7 @@ import { namedTypes } from "./gen/namedTypes"; import { builders } from "./gen/builders"; import { Visitor } from "./gen/visitor"; -const { +let { astNodesAreEquivalent, builders, builtInTypes, @@ -45,6 +45,27 @@ const { // retaining its member types. Object.assign(namedTypes, n); +export function overrideDefs(defs: ReturnType) { + astNodesAreEquivalent = defs.astNodesAreEquivalent; + builders = defs.builders; + builtInTypes = defs.builtInTypes; + defineMethod = defs.defineMethod; + eachField = defs.eachField; + finalize = defs.finalize; + getBuilderName = defs.getBuilderName; + getFieldNames = defs.getFieldNames; + getFieldValue = defs.getFieldValue; + getSupertypeNames = defs.getSupertypeNames; + Object.assign(namedTypes, defs.namedTypes); + NodePath = defs.NodePath; + Path = defs.Path; + PathVisitor = defs.PathVisitor; + someField = defs.someField; + Type = defs.Type; + use = defs.use; + visit = defs.visit; +} + export { AnyType, ASTNode,