Skip to content

Commit

Permalink
feat: add symbols, split empty type
Browse files Browse the repository at this point in the history
  • Loading branch information
storycraft committed Dec 11, 2024
1 parent f9ab2b6 commit d391be7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/builder/src/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AstType } from './ast/type.js';
* identifier for ast types
*/
type Ast<T extends string> = {
kind: T,
readonly kind: T,
span: Span,
}

Expand Down
1 change: 0 additions & 1 deletion packages/builder/src/fn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Span } from '@mcslib/core';
import { McsEmpty } from './primitive.js';
import { VarType } from './var.js';


export type Fn<Sig extends FnSig = FnSig> = {
span: Span,
args: CallArgs<Sig['args']>,
Expand Down
8 changes: 1 addition & 7 deletions packages/builder/src/primitive.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import { AstType } from './ast/type.js';
import { Primitive } from './primitive/base.js';

export * from './primitive/empty.js';
export * from './primitive/number.js';
export * from './primitive/string.js';

export class McsEmpty extends Primitive {
static readonly type: AstType = 'empty';
}
6 changes: 6 additions & 0 deletions packages/builder/src/primitive/empty.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { AstType } from '@/ast/type.js';
import { Primitive } from './base.js';

export class McsEmpty extends Primitive {
static readonly type: AstType = 'empty';
}
11 changes: 11 additions & 0 deletions packages/builder/src/symbol.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const McsSymbol = Object.freeze({
serialize: Symbol('McsSymbol.serialize'),

add: Symbol('McsSymbol.add'),
sub: Symbol('McsSymbol.sub'),
mul: Symbol('McsSymbol.mul'),
div: Symbol('McsSymbol.div'),
remi: Symbol('McsSymbol.remi'),

iterable: Symbol('McsSymbol.iterable'),
});

0 comments on commit d391be7

Please sign in to comment.