Skip to content

Commit 7485bc5

Browse files
committed
render tag + slot could occur in legacy mode as well, error there, too
1 parent 85e2790 commit 7485bc5

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

packages/svelte/src/compiler/phases/2-analyze/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,6 @@ export function analyze_component(root, source, options) {
456456
}
457457
}
458458
}
459-
460-
if (analysis.uses_render_tags && (analysis.uses_slots || analysis.slot_names.size > 0)) {
461-
error(analysis.slot_names.values().next().value, 'conflicting-slot-usage');
462-
}
463459
} else {
464460
instance.scope.declare(b.id('$$props'), 'bindable_prop', 'synthetic');
465461
instance.scope.declare(b.id('$$restProps'), 'rest_prop', 'synthetic');
@@ -507,6 +503,10 @@ export function analyze_component(root, source, options) {
507503
analysis.reactive_statements = order_reactive_statements(analysis.reactive_statements);
508504
}
509505

506+
if (analysis.uses_render_tags && (analysis.uses_slots || analysis.slot_names.size > 0)) {
507+
error(analysis.slot_names.values().next().value, 'conflicting-slot-usage');
508+
}
509+
510510
// warn on any nonstate declarations that are a) reassigned and b) referenced in the template
511511
for (const scope of [module.scope, instance.scope]) {
512512
outer: for (const [name, binding] of scope.declarations) {

packages/svelte/src/compiler/phases/2-analyze/validation.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,8 @@ const validation = {
578578
});
579579
},
580580
RenderTag(node, context) {
581+
context.state.analysis.uses_render_tags = true;
582+
581583
const raw_args = unwrap_optional(node.expression).arguments;
582584
for (const arg of raw_args) {
583585
if (arg.type === 'SpreadElement') {
@@ -1195,9 +1197,6 @@ export const validation_runes = merge(validation, a11y_validators, {
11951197
warn(state.analysis.warnings, node, path, 'deprecated-event-handler', node.name);
11961198
}
11971199
},
1198-
RenderTag(_, { state }) {
1199-
state.analysis.uses_render_tags = true;
1200-
},
12011200
// TODO this is a code smell. need to refactor this stuff
12021201
ClassBody: validation_runes_js.ClassBody,
12031202
ClassDeclaration: validation_runes_js.ClassDeclaration,

0 commit comments

Comments
 (0)