Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
kazcw committed Sep 27, 2023
1 parent 599641b commit 986bc84
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 3 additions & 1 deletion app/gui2/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*.html
*.css
*.css

**/generated
14 changes: 8 additions & 6 deletions app/gui2/parser-codegen/src/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ import * as fs from 'fs'
import * as ts from 'typescript'
import { factory as tsf } from 'typescript'

type DiscriminantMap = {
[discriminant: number]: string
}
type TypeGraph = {
[id: string]: Schema.Type
}
module Schema {
export type Type = {
name: string
fields: [string, Field][]
parent: string | null
discriminants: [number: string]
discriminants: DiscriminantMap
size: number
}
export type Field = {
Expand All @@ -22,9 +28,6 @@ module Schema {
export type Result = { class: 'result'; type0: TypeRef; type1: TypeRef }
export type PrimitiveType = 'bool' | 'u32' | 'u64' | 'i32' | 'i64' | 'char' | 'string'
}
type TypeGraph = {
[id: string]: Schema.Type
}
type Schema = {
types: TypeGraph
}
Expand Down Expand Up @@ -204,7 +207,6 @@ class Type {
switch (c) {
case 'type':
const ty = types[ref.id]
const parentId = ty.parent
const parent = ty.parent != null ? types[ty.parent] : null
const typeName = namespacedName(ty.name, parent?.name)
const type = tsf.createTypeReferenceNode(typeName)
Expand Down Expand Up @@ -377,7 +379,7 @@ function makeDebugFunction(fields: [string, Schema.Field][]): ts.MethodDeclarati
[],
),
),
...fields.map(([name, field]: [string, Schema.Field]) =>
...fields.map(([name, _field]: [string, Schema.Field]) =>
tsf.createPropertyAssignment(getterIdent(name), debugValue(getterIdent(name))),
),
]),
Expand Down
5 changes: 0 additions & 5 deletions app/gui2/parser-codegen/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"extends": "@tsconfig/node18/tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"target": "es6",
"sourceMap": true,
"outDir": "dist"
},
"lib": ["es2015"],
}

0 comments on commit 986bc84

Please sign in to comment.