fix(compiler): avoid hoisting components and directive calls

This commit is contained in:
Evan You
2019-10-04 14:34:26 -04:00
parent 5047bc8dbe
commit 277651ce89
5 changed files with 66 additions and 38 deletions

View File

@@ -89,7 +89,8 @@ return function render() {
`;
exports[`compiler: codegen hoists 1`] = `
"const _hoisted_1 = hello
"
const _hoisted_1 = hello
const _hoisted_2 = { id: \\"foo\\" }
return function render() {

View File

@@ -35,7 +35,7 @@ return function render() {
class: _ctx.bar.baz
}, [
toString(_ctx.world.burn()),
(openBlock(), (_ctx.ok)
(openBlock(), _ctx.ok)
? createBlock(\\"div\\", { key: 0 }, \\"yes\\")
: createBlock(Fragment, { key: 1 }, [\\"no\\"])),
(openBlock(), createBlock(Fragment, null, renderList(_ctx.list, (value, index) => {
@@ -57,7 +57,7 @@ export default function render() {
class: _ctx.bar.baz
}, [
_toString(_ctx.world.burn()),
(openBlock(), (_ctx.ok)
(openBlock(), _ctx.ok)
? createBlock(\\"div\\", { key: 0 }, \\"yes\\")
: createBlock(Fragment, { key: 1 }, [\\"no\\"])),
(openBlock(), createBlock(Fragment, null, renderList(_ctx.list, (value, index) => {

View File

@@ -71,7 +71,7 @@ return function render() {
const _component_Comp = resolveComponent(\\"Comp\\")
return (openBlock(), createBlock(_component_Comp, null, createSlots({ _compiled: true }, [
(_ctx.ok)
_ctx.ok)
? {
name: \\"one\\",
fn: (props) => [toString(props)]