Skip to content

Commit acbd5cf

Browse files
committed
parser changes are no longer needed
1 parent afee1d6 commit acbd5cf

File tree

1 file changed

+4
-4
lines changed
  • packages/svelte/src/compiler/phases/1-parse/state

1 file changed

+4
-4
lines changed

packages/svelte/src/compiler/phases/1-parse/state/element.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,6 @@ function read_attribute(parser) {
506506
const colon_index = name.indexOf(':');
507507
const type = colon_index !== -1 && get_directive_type(name.slice(0, colon_index));
508508

509-
/** @type {Expression | null} */
510-
let expression = null;
511-
512509
/** @type {true | AST.ExpressionTag | Array<AST.Text | AST.ExpressionTag>} */
513510
let value = true;
514511
if (parser.eat('=')) {
@@ -543,12 +540,15 @@ function read_attribute(parser) {
543540

544541
const first_value = value === true ? undefined : Array.isArray(value) ? value[0] : value;
545542

543+
/** @type {Expression | null} */
544+
let expression = null;
545+
546546
if (first_value) {
547547
const attribute_contains_text =
548548
/** @type {any[]} */ (value).length > 1 || first_value.type === 'Text';
549549
if (attribute_contains_text) {
550550
e.directive_invalid_value(/** @type {number} */ (first_value.start));
551-
} else if (expression === null) {
551+
} else {
552552
// TODO throw a parser error in a future version here if this `[ExpressionTag]` instead of `ExpressionTag`,
553553
// which means stringified value, which isn't allowed for some directives?
554554
expression = first_value.expression;

0 commit comments

Comments
 (0)