8000 no need to test evaluations, since we are already testing the literal… · sveltejs/svelte@cc7c317 · GitHub
[go: up one dir, main page]

Skip to content

Commit cc7c317

Browse files
committed
no need to test evaluations, since we are already testing the literals that they are composed of
1 parent 3f3aab0 commit cc7c317

File tree

2 files changed

+2
-19
lines changed
  • packages/svelte/src/compiler/phases/3-transform

2 files changed

+2
-19
lines changed

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@
44
import { walk } from 'zimmerframe';
55
import { object } from '../../../../../utils/ast.js';
66
import * as b from '#compiler/builders';
7-
import * as w from '../../../../../warnings.js';
87
import { sanitize_template_string } from '../../../../../utils/sanitize_template_string.js';
9-
import {
10-
regex_is_valid_identifier,
11-
regex_bidirectional_control_characters
12-
} from '../../../../patterns.js';
8+
import { regex_is_valid_identifier } from '../../../../patterns.js';
139
import is_reference from 'is-reference';
1410
import { dev, is_ignored, locator } from '../../../../../state.js';
1511
import { create_derived } from '../../utils.js';
@@ -81,9 +77,6 @@ export function build_template_chunk(
8177
// If we have a single expression, then pass that in directly to possibly avoid doing
8278
// extra work in the template_effect (instead we do the work in set_text).
8379
if (evaluated.is_known) {
84-
if (regex_bidirectional_control_characters.test((evaluated.value ?? '') + '')) {
85-
w.bidirectional_control_characters(node);
86-
}
8780
value = b.literal((evaluated.value ?? '') + '');
8881
}
8982

@@ -103,9 +96,6 @@ export function build_template_chunk(
10396
}
10497

10598
if (evaluated.is_known) {
106-
if (regex_bidirectional_control_characters.test((evaluated.value ?? '') + '')) {
107-
w.bidirectional_control_characters(node);
108-
}
10999
quasi.value.cooked += (evaluated.value ?? '') + '';
110100
} else {
111101
if (!evaluated.is_defined) {

packages/svelte/src/compiler/phases/3-transform/server/visitors/shared/utils.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@ import {
99
EMPTY_COMMENT
1010
} from '../../../../../../internal/server/hydration.js';
1111
import * as b from '#compiler/builders';
12-
import * as w from '../../../../../warnings.js';
1312
import { sanitize_template_string } from '../../../../../utils/sanitize_template_string.js';
14-
import {
15-
regex_bidirectional_control_characters,
16-
regex_whitespaces_strict
17-
} from '../../../../patterns.js';
13+
import { regex_whitespaces_strict } from '../../../../patterns.js';
1814

1915
/** Opens an if/each block, so that we can remove nodes in the case of a mismatch */
2016
export const block_open = b.literal(BLOCK_OPEN);
@@ -52,9 +48,6 @@ export function process_children(nodes, { visit, state }) {
5248
const evaluated = state.scope.evaluate(node.expression);
5349

5450
if (evaluated.is_known) {
55-
if (regex_bidirectional_control_characters.test((evaluated.value ?? '') + '')) {
56-
w.bidirectional_control_characters(node);
57-
}
5851
quasi.value.cooked += escape_html((evaluated.value ?? '') + '');
5952
} else {
6053
expressions.push(b.call('$.escape', /** @type {Expression} */ (visit(node.expression))));

0 commit comments

Comments
 (0)
0