Skip to content

Commit 6de294c

Browse files
committed
remove obsolete code
1 parent a13ec34 commit 6de294c

File tree

1 file changed

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

1 file changed

+4
-12
lines changed

packages/svelte/src/compiler/phases/1-parse/read/context.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,16 @@ import { locator } from '../../../state.js';
1414

1515
/**
1616
* @param {import('../index.js').Parser} parser
17-
* @param {boolean} [optional_allowed]
1817
* @returns {import('estree').Pattern}
1918
*/
20-
export default function read_pattern(parser, optional_allowed = false) {
19+
export default function read_pattern(parser) {
2120
const start = parser.index;
2221
let i = parser.index;
2322

2423
const code = full_char_code_at(parser.template, i);
2524
if (isIdentifierStart(code, true)) {
2625
const name = /** @type {string} */ (parser.read_identifier());
27-
const annotation = read_type_annotation(parser, optional_allowed);
26+
const annotation = read_type_annotation(parser);
2827

2928
return {
3029
type: 'Identifier',
@@ -84,7 +83,7 @@ export default function read_pattern(parser, optional_allowed = false) {
8483
parse_expression_at(`${space_with_newline}(${pattern_string} = 1)`, parser.ts, start - 1)
8584
).left;
8685

87-
expression.typeAnnotation = read_type_annotation(parser, optional_allowed);
86+
expression.typeAnnotation = read_type_annotation(parser);
8887
if (expression.typeAnnotation) {
8988
expression.end = expression.typeAnnotation.end;
9089
}
@@ -97,19 +96,12 @@ export default function read_pattern(parser, optional_allowed = false) {
9796

9897
/**
9998
* @param {import('../index.js').Parser} parser
100-
* @param {boolean} [optional_allowed]
10199
* @returns {any}
102100
*/
103-
function read_type_annotation(parser, optional_allowed = false) {
101+
function read_type_annotation(parser) {
104102
const start = parser.index;
105103
parser.allow_whitespace();
106104

107-
if (optional_allowed && parser.eat('?')) {
108-
// Acorn-TS puts the optional info as a property on the surrounding node.
109-
// We spare the work here because it doesn't matter for us anywhere else.
110-
parser.allow_whitespace();
111-
}
112-
113105
if (!parser.eat(':')) {
114106
parser.index = start;
115107
return undefined;

0 commit comments

Comments
 (0)