wip(compiler): adjust statement positions

This commit is contained in:
Evan You
2019-09-25 15:09:58 -04:00
parent b43f3b61b7
commit ff2313e43a
5 changed files with 43 additions and 20 deletions

View File

@@ -71,10 +71,10 @@ return function render() {
`;
exports[`compiler: codegen function mode preamble 1`] = `
"const { helperOne, helperTwo } = Vue
"const _Vue = Vue
return function render() {
with (this) {
const { helperOne, helperTwo } = _Vue
return null
}
}"
@@ -147,10 +147,10 @@ return function render() {
exports[`compiler: codegen statements 1`] = `
"
return function render() {
const a = 1
const b = 2
with (this) {
const a = 1
const b = 2
return null
}
}"

View File

@@ -55,7 +55,8 @@ describe('compiler: codegen', () => {
imports: [`helperOne`, `helperTwo`]
})
const { code } = generate(root, { mode: 'function' })
expect(code).toMatch(`const { helperOne, helperTwo } = Vue`)
expect(code).toMatch(`const _Vue = Vue`)
expect(code).toMatch(`const { helperOne, helperTwo } = _Vue`)
expect(code).toMatchSnapshot()
})

View File

@@ -9,10 +9,10 @@ test('basic source map support', async () => {
filename: `foo.vue`
})
expect(code).toMatch(
`const { toString } = Vue
`const _Vue = Vue
return function render() {
with (this) {
const { toString } = _Vue
return [
"hello ",
toString(world)