Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deconflict dev mode block function names again #3907

Merged
merged 3 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"acorn": "^7.1.0",
"agadoo": "^1.1.0",
"c8": "^5.0.1",
"code-red": "0.0.20",
"code-red": "0.0.21",
"codecov": "^3.5.0",
"css-tree": "1.0.0-alpha22",
"eslint": "^6.3.0",
Expand Down
22 changes: 11 additions & 11 deletions src/compiler/compile/render_dom/Block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export default class Block {
: this.chunks.hydrate
);

properties.create = x`function create() {
properties.create = x`function #create() {
${this.chunks.create}
${hydrate}
}`;
Expand All @@ -276,23 +276,23 @@ export default class Block {
if (this.chunks.claim.length === 0 && this.chunks.hydrate.length === 0) {
properties.claim = noop;
} else {
properties.claim = x`function claim(#nodes) {
properties.claim = x`function #claim(#nodes) {
${this.chunks.claim}
${this.renderer.options.hydratable && this.chunks.hydrate.length > 0 && b`this.h();`}
}`;
}
}

if (this.renderer.options.hydratable && this.chunks.hydrate.length > 0) {
properties.hydrate = x`function hydrate() {
properties.hydrate = x`function #hydrate() {
${this.chunks.hydrate}
}`;
}

if (this.chunks.mount.length === 0) {
properties.mount = noop;
} else {
properties.mount = x`function mount(#target, anchor) {
properties.mount = x`function #mount(#target, anchor) {
${this.chunks.mount}
}`;
}
Expand All @@ -302,23 +302,23 @@ export default class Block {
properties.update = noop;
} else {
const ctx = this.maintain_context ? x`#new_ctx` : x`#ctx`;
properties.update = x`function update(#changed, ${ctx}) {
properties.update = x`function #update(#changed, ${ctx}) {
${this.maintain_context && b`#ctx = ${ctx};`}
${this.chunks.update}
}`;
}
}

if (this.has_animation) {
properties.measure = x`function measure() {
properties.measure = x`function #measure() {
${this.chunks.measure}
}`;

properties.fix = x`function fix() {
properties.fix = x`function #fix() {
${this.chunks.fix}
}`;

properties.animate = x`function animate() {
properties.animate = x`function #animate() {
${this.chunks.animate}
}`;
}
Expand All @@ -327,7 +327,7 @@ export default class Block {
if (this.chunks.intro.length === 0) {
properties.intro = noop;
} else {
properties.intro = x`function intro(#local) {
properties.intro = x`function #intro(#local) {
${this.has_outros && b`if (#current) return;`}
${this.chunks.intro}
}`;
Expand All @@ -336,7 +336,7 @@ export default class Block {
if (this.chunks.outro.length === 0) {
properties.outro = noop;
} else {
properties.outro = x`function outro(#local) {
properties.outro = x`function #outro(#local) {
${this.chunks.outro}
}`;
}
Expand All @@ -345,7 +345,7 @@ export default class Block {
if (this.chunks.destroy.length === 0) {
properties.destroy = noop;
} else {
properties.destroy = x`function destroy(detaching) {
properties.destroy = x`function #destroy(detaching) {
${this.chunks.destroy}
}`;
}
Expand Down
6 changes: 6 additions & 0 deletions test/runtime/samples/deconflict-block-methods/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
compileOptions: {
dev: true
},
html: `<div>deconflicted</div>`
};
5 changes: 5 additions & 0 deletions test/runtime/samples/deconflict-block-methods/main.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
const create = 'deconflicted';
</script>

<div>{create}</div>