Skip to content

Commit

Permalink
Merge pull request #1561 from glimmerjs/revise-ast-changes
Browse files Browse the repository at this point in the history
[CLEANUP] Remove unused ASTv1 nodes
  • Loading branch information
chancancode authored Feb 7, 2024
2 parents d735053 + 85cc0f0 commit 1cb493b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 55 deletions.
2 changes: 1 addition & 1 deletion packages/@glimmer/syntax/lib/generation/printer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function getVoidTags() {
const NON_WHITESPACE = /^\S/u;

export interface PrinterOptions {
entityEncoding: 'transformed' | 'raw';
entityEncoding: ASTv1.EntityEncodingState;

/**
* Used to override the mechanism of printing a given AST.Node.
Expand Down
46 changes: 1 addition & 45 deletions packages/@glimmer/syntax/lib/v1/nodes-v1.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,7 @@
import type { Dict, Nullable, PresentArray, WireFormat } from '@glimmer/interfaces';
import type { Nullable, PresentArray } from '@glimmer/interfaces';

import type * as src from '../source/api';

export interface Symbols {
symbols: string[];

has(name: string): boolean;
get(name: string): number;

getLocalsMap(): Dict<number>;
getDebugInfo(): WireFormat.Core.DebugInfo;

allocateFree(name: string): number;
allocateNamed(name: string): number;
allocateBlock(name: string): number;
allocate(identifier: string): number;

child(locals: string[]): BlockSymbols;
}

export interface BlockSymbols extends Symbols {
slots: number[];
}

export interface ProgramSymbols extends Symbols {
freeVariables: string[];
}

export interface BaseNode {
// Every leaf interface that extends BaseNode must specify a type property.
// The type property should be a string literal. For example, Identifier
Expand All @@ -43,7 +18,6 @@ export interface CommonProgram extends BaseNode {

export interface Program extends CommonProgram {
type: 'Program';
symbols?: Symbols;
}

export interface Block extends CommonProgram {
Expand Down Expand Up @@ -130,12 +104,6 @@ export interface MustacheCommentStatement extends BaseNode {
value: string;
}

export interface NamedBlockName {
type: 'NamedBlockName';
name: string;
loc: src.SourceLocation;
}

export interface ElementName {
type: 'ElementName';
name: string;
Expand Down Expand Up @@ -241,18 +209,6 @@ export interface VarHead {
loc: src.SourceLocation;
}

export interface FreeVarHead {
type: 'FreeVarHead';
name: string;
loc: src.SourceLocation;
}

export interface LocalVarHead {
type: 'LocalVarHead';
name: string;
loc: src.SourceLocation;
}

export type PathHead = ThisHead | AtHead | VarHead;

export interface MinimalPathExpression extends BaseNode {
Expand Down
9 changes: 0 additions & 9 deletions packages/@glimmer/syntax/lib/v1/public-builders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,14 +369,6 @@ function buildHeadFromString(head: string, loc: SourceLocation): ASTv1.PathHead
}
}

function buildNamedBlockName(name: string, loc?: SourceLocation): ASTv1.NamedBlockName {
return {
type: 'NamedBlockName',
name,
loc: buildLoc(loc || null),
};
}

function buildCleanPath(
head: ASTv1.PathHead,
tail: string[],
Expand Down Expand Up @@ -572,7 +564,6 @@ export default {
at: buildAtName,
var: buildVar,
this: buildThis,
blockName: buildNamedBlockName,

string: literal('StringLiteral') as (value: string) => ASTv1.StringLiteral,
boolean: literal('BooleanLiteral') as (value: boolean) => ASTv1.BooleanLiteral,
Expand Down

0 comments on commit 1cb493b

Please sign in to comment.