From 4914c8cd68710b8deed757886d7fc78509b072b4 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 24 May 2021 12:05:02 +0200 Subject: [PATCH] Move type/gentype back into compiler where it belongs --- implementations/javascript/packages/schema/src/compiler.ts | 4 ++-- .../javascript/packages/schema/src/compiler/context.ts | 2 +- .../javascript/packages/schema/src/compiler/genconverter.ts | 4 ++-- .../javascript/packages/schema/src/compiler/genctor.ts | 2 +- .../javascript/packages/schema/src/{ => compiler}/gentype.ts | 2 +- .../javascript/packages/schema/src/compiler/rendertype.ts | 2 +- .../javascript/packages/schema/src/{ => compiler}/type.ts | 0 implementations/javascript/packages/schema/src/index.ts | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) rename implementations/javascript/packages/schema/src/{ => compiler}/gentype.ts (99%) rename implementations/javascript/packages/schema/src/{ => compiler}/type.ts (100%) diff --git a/implementations/javascript/packages/schema/src/compiler.ts b/implementations/javascript/packages/schema/src/compiler.ts index ee8f4bc..dd6d990 100644 --- a/implementations/javascript/packages/schema/src/compiler.ts +++ b/implementations/javascript/packages/schema/src/compiler.ts @@ -2,9 +2,9 @@ import { stringify } from "@preserves/core"; import * as M from "./meta"; import { CompilerOptions, ModuleContext } from "./compiler/context"; import { Formatter, block, seq } from "./compiler/block"; -import { typeForDefinition } from "./gentype"; +import { typeForDefinition } from "./compiler/gentype"; import { converterForDefinition } from "./compiler/genconverter"; -import { Type } from "./type"; +import { Type } from "./compiler/type"; import { renderType } from "./compiler/rendertype"; import { genConstructor } from "./compiler/genctor"; import { unconverterForDefinition } from "./compiler/genunconverter"; diff --git a/implementations/javascript/packages/schema/src/compiler/context.ts b/implementations/javascript/packages/schema/src/compiler/context.ts index 7636719..3a3a888 100644 --- a/implementations/javascript/packages/schema/src/compiler/context.ts +++ b/implementations/javascript/packages/schema/src/compiler/context.ts @@ -2,7 +2,7 @@ import { Dictionary, KeyedSet, Position } from "@preserves/core"; import { refPosition } from "../reader"; import * as M from "../meta"; import { block, braces, commas, formatItems, Item, keyvalue, seq } from "./block"; -import { ANY_TYPE, FieldType, Type } from "../type"; +import { ANY_TYPE, FieldType, Type } from "./type"; import { renderType, variantInitFor } from "./rendertype"; export interface CompilerOptions { diff --git a/implementations/javascript/packages/schema/src/compiler/genconverter.ts b/implementations/javascript/packages/schema/src/compiler/genconverter.ts index 16e0689..43399ae 100644 --- a/implementations/javascript/packages/schema/src/compiler/genconverter.ts +++ b/implementations/javascript/packages/schema/src/compiler/genconverter.ts @@ -1,9 +1,9 @@ import { FunctionContext } from "./context"; import * as M from '../meta'; import { Item, seq } from "./block"; -import { simpleType, typeFor } from "../gentype"; +import { simpleType, typeFor } from "./gentype"; import { refPosition } from "../reader"; -import { ANY_TYPE, Type } from "../type"; +import { ANY_TYPE, Type } from "./type"; export function converterForDefinition( ctx: FunctionContext, diff --git a/implementations/javascript/packages/schema/src/compiler/genctor.ts b/implementations/javascript/packages/schema/src/compiler/genctor.ts index ebdb859..3fafd4b 100644 --- a/implementations/javascript/packages/schema/src/compiler/genctor.ts +++ b/implementations/javascript/packages/schema/src/compiler/genctor.ts @@ -1,6 +1,6 @@ import * as M from '../meta'; import { block, braces, Item, keyvalue, parens, seq } from "./block"; -import { FieldType, SimpleType } from "../type"; +import { FieldType, SimpleType } from "./type"; import { renderType } from "./rendertype"; export function genConstructor( diff --git a/implementations/javascript/packages/schema/src/gentype.ts b/implementations/javascript/packages/schema/src/compiler/gentype.ts similarity index 99% rename from implementations/javascript/packages/schema/src/gentype.ts rename to implementations/javascript/packages/schema/src/compiler/gentype.ts index 33249b6..aae855a 100644 --- a/implementations/javascript/packages/schema/src/gentype.ts +++ b/implementations/javascript/packages/schema/src/compiler/gentype.ts @@ -1,4 +1,4 @@ -import * as M from "./meta"; +import * as M from "../meta"; import { ANY_TYPE, FieldType, FieldMap, SimpleType, Type } from "./type"; export type RefResolver = (ref: M.Ref) => FieldType; diff --git a/implementations/javascript/packages/schema/src/compiler/rendertype.ts b/implementations/javascript/packages/schema/src/compiler/rendertype.ts index b2fc868..a93bf13 100644 --- a/implementations/javascript/packages/schema/src/compiler/rendertype.ts +++ b/implementations/javascript/packages/schema/src/compiler/rendertype.ts @@ -1,4 +1,4 @@ -import { SimpleType, Type } from "../type"; +import { SimpleType, Type } from "./type"; import { anglebrackets, braces, Item, keyvalue, opseq, seq } from "./block"; export function variantInitFor(variantName: string | undefined) : Item[] { diff --git a/implementations/javascript/packages/schema/src/type.ts b/implementations/javascript/packages/schema/src/compiler/type.ts similarity index 100% rename from implementations/javascript/packages/schema/src/type.ts rename to implementations/javascript/packages/schema/src/compiler/type.ts diff --git a/implementations/javascript/packages/schema/src/index.ts b/implementations/javascript/packages/schema/src/index.ts index 6ce94af..363f262 100644 --- a/implementations/javascript/packages/schema/src/index.ts +++ b/implementations/javascript/packages/schema/src/index.ts @@ -3,4 +3,4 @@ export * from './error'; export * from './reader'; export * from './compiler'; export * as Meta from './meta'; -export * as Type from './type'; +export * as Type from './compiler/type';