Skip to content

Commit 408955d

Browse files
committed
rename stuff
1 parent 19fae20 commit 408955d

File tree

16 files changed

+29
-29
lines changed

16 files changed

+29
-29
lines changed

packages/svelte/src/compiler/phases/3-transform/client/transform-template/template.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class Template {
3131
* @param {string} name
3232
* @param {number} start
3333
*/
34-
create_element(name, start) {
34+
push_element(name, start) {
3535
this.#element = {
3636
type: 'element',
3737
name,
@@ -47,12 +47,12 @@ export class Template {
4747
}
4848

4949
/** @param {string} [data] */
50-
create_anchor(data) {
51-
this.#fragment.push({ type: 'anchor', data });
50+
push_comment(data) {
51+
this.#fragment.push({ type: 'comment', data });
5252
}
5353

5454
/** @param {AST.Text[]} nodes */
55-
create_text(nodes) {
55+
push_text(nodes) {
5656
this.#fragment.push({ type: 'text', nodes });
5757
}
5858

@@ -75,8 +75,8 @@ export class Template {
7575

7676
as_objects() {
7777
// if the first item is a comment we need to add another comment for effect.start
78-
if (this.nodes[0].type === 'anchor') {
79-
this.nodes.unshift({ type: 'anchor', data: undefined });
78+
if (this.nodes[0].type === 'comment') {
79+
this.nodes.unshift({ type: 'comment', data: undefined });
8080
}
8181

8282
return b.array(this.nodes.map(objectify));
@@ -91,7 +91,7 @@ function stringify(item) {
9191
return item.nodes.map((node) => node.raw).join('');
9292
}
9393

94-
if (item.type === 'anchor') {
94+
if (item.type === 'comment') {
9595
return item.data ? `<!--${item.data}-->` : '<!>';
9696
}
9797

@@ -120,7 +120,7 @@ function objectify(item) {
120120
return b.literal(item.nodes.map((node) => node.data).join(''));
121121
}
122122

123-
if (item.type === 'anchor') {
123+
if (item.type === 'comment') {
124124
return item.data ? b.array([b.literal(`// ${item.data}`)]) : null;
125125
}
126126

packages/svelte/src/compiler/phases/3-transform/client/transform-template/types.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export interface Text {
1414
nodes: AST.Text[];
1515
}
1616

17-
export interface Anchor {
18-
type: 'anchor';
17+
export interface Comment {
18+
type: 'comment';
1919
data: string | undefined;
2020
}
2121

22-
export type Node = Element | Text | Anchor;
22+
export type Node = Element | Text | Comment;

packages/svelte/src/compiler/phases/3-transform/client/visitors/AwaitBlock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { get_value } from './shared/declarations.js';
1111
* @param {ComponentContext} context
1212
*/
1313
export function AwaitBlock(node, context) {
14-
context.state.template.create_anchor();
14+
context.state.template.push_comment();
1515

1616
// Visit {#await <expression>} first to ensure that scopes are in the correct order
1717
const expression = b.thunk(/** @type {Expression} */ (context.visit(node.expression)));

packages/svelte/src/compiler/phases/3-transform/client/visitors/Comment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
*/
88
export function Comment(node, context) {
99
// We'll only get here if comments are not filtered out, which they are unless preserveComments is true
10-
context.state.template.create_anchor(node.data);
10+
context.state.template.push_comment(node.data);
1111
}

packages/svelte/src/compiler/phases/3-transform/client/visitors/EachBlock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function EachBlock(node, context) {
3232
);
3333

3434
if (!each_node_meta.is_controlled) {
35-
context.state.template.create_anchor();
35+
context.state.template.push_comment();
3636
}
3737

3838
let flags = 0;

packages/svelte/src/compiler/phases/3-transform/client/visitors/Fragment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export function Fragment(node, context) {
140140
flags |= TEMPLATE_USE_IMPORT_NODE;
141141
}
142142

143-
if (state.template.nodes.length === 1 && state.template.nodes[0].type === 'anchor') {
143+
if (state.template.nodes.length === 1 && state.template.nodes[0].type === 'comment') {
144144
// special case — we can use `$.comment` instead of creating a unique template
145145
body.push(b.var(id, b.call('$.comment')));
146146
} else {

packages/svelte/src/compiler/phases/3-transform/client/visitors/HtmlTag.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import * as b from '#compiler/builders';
99
* @param {ComponentContext} context
1010
*/
1111
export function HtmlTag(node, context) {
12-
context.state.template.create_anchor();
12+
context.state.template.push_comment();
1313

1414
const expression = /** @type {Expression} */ (context.visit(node.expression));
1515

packages/svelte/src/compiler/phases/3-transform/client/visitors/IfBlock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as b from '#compiler/builders';
88
* @param {ComponentContext} context
99
*/
1010
export function IfBlock(node, context) {
11-
context.state.template.create_anchor();
11+
context.state.template.push_comment();
1212
const statements = [];
1313

1414
const consequent = /** @type {BlockStatement} */ (context.visit(node.consequent));

packages/svelte/src/compiler/phases/3-transform/client/visitors/KeyBlock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as b from '#compiler/builders';
88
* @param {ComponentContext} context
99
*/
1010
export function KeyBlock(node, context) {
11-
context.state.template.create_anchor();
11+
context.state.template.push_comment();
1212

1313
const key = /** @type {Expression} */ (context.visit(node.expression));
1414
const body = /** @type {Expression} */ (context.visit(node.fragment));

packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import { visit_event_attribute } from './shared/events.js';
3636
* @param {ComponentContext} context
3737
*/
3838
export function RegularElement(node, context) {
39-
context.state.template.create_element(node.name, node.start);
39+
context.state.template.push_element(node.name, node.start);
4040

4141
if (node.name === 'noscript') {
4242
context.state.template.pop_element();

0 commit comments

Comments
 (0)