]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor(compiler): provide _ctx and _cache via arguments
authorEvan You <yyx990803@gmail.com>
Mon, 10 Feb 2020 22:29:12 +0000 (17:29 -0500)
committerEvan You <yyx990803@gmail.com>
Mon, 10 Feb 2020 22:29:12 +0000 (17:29 -0500)
21 files changed:
packages/compiler-core/__tests__/__snapshots__/codegen.spec.ts.snap
packages/compiler-core/__tests__/__snapshots__/compile.spec.ts.snap
packages/compiler-core/__tests__/__snapshots__/scopeId.spec.ts.snap
packages/compiler-core/__tests__/codegen.spec.ts
packages/compiler-core/__tests__/scopeId.spec.ts
packages/compiler-core/__tests__/transforms/__snapshots__/hoistStatic.spec.ts.snap
packages/compiler-core/__tests__/transforms/__snapshots__/transformText.spec.ts.snap
packages/compiler-core/__tests__/transforms/__snapshots__/vFor.spec.ts.snap
packages/compiler-core/__tests__/transforms/__snapshots__/vIf.spec.ts.snap
packages/compiler-core/__tests__/transforms/__snapshots__/vModel.spec.ts.snap
packages/compiler-core/__tests__/transforms/__snapshots__/vOnce.spec.ts.snap
packages/compiler-core/__tests__/transforms/__snapshots__/vSlot.spec.ts.snap
packages/compiler-core/src/codegen.ts
packages/compiler-dom/__tests__/__snapshots__/index.spec.ts.snap
packages/compiler-dom/__tests__/transforms/__snapshots__/vModel.spec.ts.snap
packages/compiler-dom/__tests__/transforms/__snapshots__/vShow.spec.ts.snap
packages/compiler-sfc/__tests__/__snapshots__/compileTemplate.spec.ts.snap
packages/compiler-sfc/__tests__/__snapshots__/templateTransformAssetUrl.spec.ts.snap
packages/compiler-sfc/__tests__/__snapshots__/templateTransformSrcset.spec.ts.snap
packages/compiler-sfc/__tests__/compileTemplate.spec.ts
packages/runtime-core/src/componentRenderUtils.ts

index d38ec84dae90134f6621ab78c0d4ec33f45ae4eb..8adf793ee7e48521343bf0e4532bf713bd8fb1bb 100644 (file)
@@ -2,7 +2,7 @@
 
 exports[`compiler: codegen ArrayExpression 1`] = `
 "
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     return [
       foo,
@@ -14,18 +14,14 @@ return function render() {
 
 exports[`compiler: codegen CacheExpression 1`] = `
 "
-export function render() {
-  const _ctx = this
-  const _cache = _ctx.$cache
+export function render(_ctx, _cache) {
   return _cache[1] || (_cache[1] = foo)
 }"
 `;
 
 exports[`compiler: codegen CacheExpression w/ isVNode: true 1`] = `
 "
-export function render() {
-  const _ctx = this
-  const _cache = _ctx.$cache
+export function render(_ctx, _cache) {
   return _cache[1] || (
     _setBlockTracking(-1),
     _cache[1] = foo,
@@ -37,7 +33,7 @@ export function render() {
 
 exports[`compiler: codegen ConditionalExpression 1`] = `
 "
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     return ok
       ? foo()
@@ -50,7 +46,7 @@ return function render() {
 
 exports[`compiler: codegen Element (callExpression + objectExpression + TemplateChildNode[]) 1`] = `
 "
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     return _createVNode(\\"div\\", {
       id: \\"foo\\",
@@ -65,7 +61,7 @@ return function render() {
 
 exports[`compiler: codegen SequenceExpression 1`] = `
 "
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     return (foo, bar(baz))
   }
@@ -74,7 +70,7 @@ return function render() {
 
 exports[`compiler: codegen assets + temps 1`] = `
 "
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const _component_Foo = _resolveComponent(\\"Foo\\")
     const _component_bar_baz = _resolveComponent(\\"bar-baz\\")
@@ -90,7 +86,7 @@ return function render() {
 
 exports[`compiler: codegen comment 1`] = `
 "
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     return _createCommentVNode(\\"foo\\")
   }
@@ -99,7 +95,7 @@ return function render() {
 
 exports[`compiler: codegen compound expression 1`] = `
 "
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     return _ctx.foo + _toDisplayString(bar) + nested
   }
@@ -108,7 +104,7 @@ return function render() {
 
 exports[`compiler: codegen forNode 1`] = `
 "
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     return (foo, bar)
   }
@@ -118,7 +114,7 @@ return function render() {
 exports[`compiler: codegen function mode preamble 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, resolveDirective: _resolveDirective } = _Vue
 
@@ -130,8 +126,7 @@ return function render() {
 exports[`compiler: codegen function mode preamble w/ prefixIdentifiers: true 1`] = `
 "const { createVNode: _createVNode, resolveDirective: _resolveDirective } = Vue
 
-return function render() {
-  const _ctx = this
+return function render(_ctx, _cache) {
   return null
 }"
 `;
@@ -141,7 +136,7 @@ exports[`compiler: codegen hoists 1`] = `
 const _hoisted_1 = hello
 const _hoisted_2 = { id: \\"foo\\" }
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     return null
   }
@@ -150,7 +145,7 @@ return function render() {
 
 exports[`compiler: codegen ifNode 1`] = `
 "
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     return (foo, bar)
   }
@@ -159,7 +154,7 @@ return function render() {
 
 exports[`compiler: codegen interpolation 1`] = `
 "
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     return _toDisplayString(hello)
   }
@@ -169,8 +164,7 @@ return function render() {
 exports[`compiler: codegen module mode preamble 1`] = `
 "import { createVNode as _createVNode, resolveDirective as _resolveDirective } from \\"vue\\"
 
-export function render() {
-  const _ctx = this
+export function render(_ctx, _cache) {
   return null
 }"
 `;
@@ -181,23 +175,14 @@ exports[`compiler: codegen module mode preamble w/ optimizeBindings: true 1`] =
 // Binding optimization for webpack code-split
 const _createVNode = createVNode, _resolveDirective = resolveDirective
 
-export function render() {
-  const _ctx = this
-  return null
-}"
-`;
-
-exports[`compiler: codegen prefixIdentifiers: true should inject _ctx statement 1`] = `
-"
-return function render() {
-  const _ctx = this
+export function render(_ctx, _cache) {
   return null
 }"
 `;
 
 exports[`compiler: codegen static text 1`] = `
 "
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     return \\"hello\\"
   }
@@ -206,7 +191,7 @@ return function render() {
 
 exports[`compiler: codegen temps 1`] = `
 "
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     let _temp0, _temp1, _temp2
 
index 5b51457ac16b8dc2a474fa02a0e0604bb498fe55..21168dc096a2109452e9919c6033708d074f5ce0 100644 (file)
@@ -3,7 +3,7 @@
 exports[`compiler: integration tests function mode 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { toDisplayString: _toDisplayString, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment, renderList: _renderList, createTextVNode: _createTextVNode } = _Vue
 
@@ -28,8 +28,7 @@ return function render() {
 exports[`compiler: integration tests function mode w/ prefixIdentifiers: true 1`] = `
 "const { toDisplayString: _toDisplayString, createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment, renderList: _renderList, createTextVNode: _createTextVNode } = Vue
 
-return function render() {
-  const _ctx = this
+return function render(_ctx, _cache) {
   return (_openBlock(), _createBlock(\\"div\\", {
     id: \\"foo\\",
     class: _ctx.bar.baz
@@ -50,8 +49,7 @@ return function render() {
 exports[`compiler: integration tests module mode 1`] = `
 "import { toDisplayString as _toDisplayString, createVNode as _createVNode, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, Fragment as _Fragment, renderList as _renderList, createTextVNode as _createTextVNode } from \\"vue\\"
 
-export function render() {
-  const _ctx = this
+export function render(_ctx, _cache) {
   return (_openBlock(), _createBlock(\\"div\\", {
     id: \\"foo\\",
     class: _ctx.bar.baz
index d5e7e571e2aa69c0f32cf765c3ec761483a16e64..6193c0acdf6cb9dd7bb9e6e76469ec8fff84f80c 100644 (file)
@@ -1,7 +1,7 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
 exports[`scopeId compiler support should push scopeId for hoisted nodes 1`] = `
-"import { createVNode as _createVNode, createBlock as _createBlock, openBlock as _openBlock, withScopeId as _withScopeId, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \\"vue\\"
+"import { createVNode as _createVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createBlock as _createBlock, openBlock as _openBlock, withScopeId as _withScopeId, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \\"vue\\"
 const _withId = _withScopeId(\\"test\\")
 
 _pushScopeId(\\"test\\")
@@ -9,10 +9,10 @@ const _hoisted_1 = _createVNode(\\"div\\", null, \\"hello\\")
 const _hoisted_2 = _createVNode(\\"div\\", null, \\"world\\")
 _popScopeId()
 
-export const render = _withId(function render() {
-  const _ctx = this
+export const render = _withId(function render(_ctx, _cache) {
   return (_openBlock(), _createBlock(\\"div\\", null, [
     _hoisted_1,
+    _createTextVNode(_toDisplayString(_ctx.foo), 1 /* TEXT */),
     _hoisted_2
   ]))
 })"
@@ -22,8 +22,7 @@ exports[`scopeId compiler support should wrap default slot 1`] = `
 "import { createVNode as _createVNode, resolveComponent as _resolveComponent, createBlock as _createBlock, openBlock as _openBlock, withScopeId as _withScopeId } from \\"vue\\"
 const _withId = _withScopeId(\\"test\\")
 
-export const render = _withId(function render() {
-  const _ctx = this
+export const render = _withId(function render(_ctx, _cache) {
   const _component_Child = _resolveComponent(\\"Child\\")
 
   return (_openBlock(), _createBlock(_component_Child, null, {
@@ -39,8 +38,7 @@ exports[`scopeId compiler support should wrap dynamic slots 1`] = `
 "import { createVNode as _createVNode, resolveComponent as _resolveComponent, renderList as _renderList, createSlots as _createSlots, createBlock as _createBlock, openBlock as _openBlock, withScopeId as _withScopeId } from \\"vue\\"
 const _withId = _withScopeId(\\"test\\")
 
-export const render = _withId(function render() {
-  const _ctx = this
+export const render = _withId(function render(_ctx, _cache) {
   const _component_Child = _resolveComponent(\\"Child\\")
 
   return (_openBlock(), _createBlock(_component_Child, null, _createSlots({ _compiled: true }, [
@@ -68,8 +66,7 @@ exports[`scopeId compiler support should wrap named slots 1`] = `
 "import { toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createVNode as _createVNode, resolveComponent as _resolveComponent, createBlock as _createBlock, openBlock as _openBlock, withScopeId as _withScopeId } from \\"vue\\"
 const _withId = _withScopeId(\\"test\\")
 
-export const render = _withId(function render() {
-  const _ctx = this
+export const render = _withId(function render(_ctx, _cache) {
   const _component_Child = _resolveComponent(\\"Child\\")
 
   return (_openBlock(), _createBlock(_component_Child, null, {
@@ -88,8 +85,7 @@ exports[`scopeId compiler support should wrap render function 1`] = `
 "import { createVNode as _createVNode, createBlock as _createBlock, openBlock as _openBlock, withScopeId as _withScopeId } from \\"vue\\"
 const _withId = _withScopeId(\\"test\\")
 
-export const render = _withId(function render() {
-  const _ctx = this
+export const render = _withId(function render(_ctx, _cache) {
   return (_openBlock(), _createBlock(\\"div\\"))
 })"
 `;
index 04e6b017bcd8659118cceac279e77a6500b7d98b..02add36a59e699880d8cef2757c36bbbaf582c23 100644 (file)
@@ -183,12 +183,6 @@ describe('compiler: codegen', () => {
     expect(code).toMatchSnapshot()
   })
 
-  test('prefixIdentifiers: true should inject _ctx statement', () => {
-    const { code } = generate(createRoot(), { prefixIdentifiers: true })
-    expect(code).toMatch(`const _ctx = this\n`)
-    expect(code).toMatchSnapshot()
-  })
-
   test('static text', () => {
     const { code } = generate(
       createRoot({
@@ -422,7 +416,6 @@ describe('compiler: codegen', () => {
         prefixIdentifiers: true
       }
     )
-    expect(code).toMatch(`const _cache = _ctx.$cache`)
     expect(code).toMatch(`_cache[1] || (_cache[1] = foo)`)
     expect(code).toMatchSnapshot()
   })
@@ -442,7 +435,6 @@ describe('compiler: codegen', () => {
         prefixIdentifiers: true
       }
     )
-    expect(code).toMatch(`const _cache = _ctx.$cache`)
     expect(code).toMatch(
       `
   _cache[1] || (
@@ -596,7 +588,7 @@ describe('compiler: codegen', () => {
     )
     expect(code).toMatchInlineSnapshot(`
       "
-      return function render() {
+      return function render(_ctx, _cache) {
         with (this) {
           return foo = bar
         }
index 4991ab3497ab0597c54b3baff8ae86f4a2dd2ae4..f009b87a0b115151b5f097f1dec2c6888091edba 100644 (file)
@@ -19,7 +19,7 @@ describe('scopeId compiler support', () => {
     })
     expect(ast.helpers).toContain(WITH_SCOPE_ID)
     expect(code).toMatch(`const _withId = _withScopeId("test")`)
-    expect(code).toMatch(`export const render = _withId(function render() {`)
+    expect(code).toMatch(`export const render = _withId(function render(`)
     expect(code).toMatchSnapshot()
   })
 
@@ -68,7 +68,7 @@ describe('scopeId compiler support', () => {
 
   test('should push scopeId for hoisted nodes', () => {
     const { ast, code } = baseCompile(
-      `<div><div>hello</div><div>world</div></div>`,
+      `<div><div>hello</div>{{ foo }}<div>world</div></div>`,
       {
         mode: 'module',
         scopeId: 'test',
index 5a472c562173a8f6d7a691d96f2eca7526bb4903..0b355441d6d285864fd01260189583dd0a74b5d4 100644 (file)
@@ -6,7 +6,7 @@ const { createVNode: _createVNode } = _Vue
 
 const _hoisted_1 = _createVNode(\\"div\\", { key: \\"foo\\" })
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -26,7 +26,7 @@ const _hoisted_1 = _createVNode(\\"p\\", null, [
   _createVNode(\\"span\\")
 ])
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -45,7 +45,7 @@ const _hoisted_1 = _createVNode(\\"div\\", null, [
   _createCommentVNode(\\"comment\\")
 ])
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createCommentVNode: _createCommentVNode, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -63,7 +63,7 @@ const { createVNode: _createVNode } = _Vue
 const _hoisted_1 = _createVNode(\\"span\\")
 const _hoisted_2 = _createVNode(\\"div\\")
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -81,7 +81,7 @@ const { createVNode: _createVNode } = _Vue
 
 const _hoisted_1 = _createVNode(\\"span\\", { class: \\"inline\\" }, \\"hello\\")
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -98,7 +98,7 @@ const { createVNode: _createVNode } = _Vue
 
 const _hoisted_1 = { id: \\"foo\\" }
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, withDirectives: _withDirectives, resolveDirective: _resolveDirective, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -119,7 +119,7 @@ const { createVNode: _createVNode } = _Vue
 
 const _hoisted_1 = { id: \\"foo\\" }
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -136,7 +136,7 @@ const { createVNode: _createVNode } = _Vue
 
 const _hoisted_1 = { id: \\"foo\\" }
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -157,7 +157,7 @@ const { createVNode: _createVNode } = _Vue
 
 const _hoisted_1 = { class: { foo: true } }
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -179,7 +179,7 @@ const _hoisted_1 = _createVNode(\\"span\\", null, [
   _toDisplayString(true)
 ])
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -196,7 +196,7 @@ const { createVNode: _createVNode } = _Vue
 
 const _hoisted_1 = _createVNode(\\"span\\", { foo: 0 }, _toDisplayString(1))
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { toDisplayString: _toDisplayString, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -210,9 +210,7 @@ return function render() {
 exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist elements with cached handlers 1`] = `
 "import { createVNode as _createVNode, createBlock as _createBlock, openBlock as _openBlock } from \\"vue\\"
 
-export function render() {
-  const _ctx = this
-  const _cache = _ctx.$cache
+export function render(_ctx, _cache) {
   return (_openBlock(), _createBlock(\\"div\\", null, [
     _createVNode(\\"div\\", null, [
       _createVNode(\\"div\\", {
@@ -226,7 +224,7 @@ export function render() {
 exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expressions that refer scope variables (2) 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, toDisplayString: _toDisplayString, createVNode: _createVNode } = _Vue
 
@@ -244,7 +242,7 @@ return function render() {
 exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expressions that refer scope variables (v-slot) 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -261,7 +259,7 @@ return function render() {
 exports[`compiler: hoistStatic transform prefixIdentifiers should NOT hoist expressions that refer scope variables 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, toDisplayString: _toDisplayString, createVNode: _createVNode } = _Vue
 
@@ -279,7 +277,7 @@ return function render() {
 exports[`compiler: hoistStatic transform should NOT hoist components 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -295,7 +293,7 @@ return function render() {
 exports[`compiler: hoistStatic transform should NOT hoist element with dynamic key 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -309,7 +307,7 @@ return function render() {
 exports[`compiler: hoistStatic transform should NOT hoist element with dynamic props 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -323,7 +321,7 @@ return function render() {
 exports[`compiler: hoistStatic transform should NOT hoist element with dynamic ref 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -337,7 +335,7 @@ return function render() {
 exports[`compiler: hoistStatic transform should NOT hoist root node 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -353,7 +351,7 @@ const { createVNode: _createVNode } = _Vue
 const _hoisted_1 = { id: \\"foo\\" }
 const _hoisted_2 = _createVNode(\\"span\\")
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
 
@@ -378,7 +376,7 @@ const _hoisted_1 = {
 }
 const _hoisted_2 = _createVNode(\\"span\\")
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
 
index 227ac7df60bb1c35bb60cdbe9c1cd0a9e1c01f6d..8c133b2193888871bb2df8efde64583e7eda294d 100644 (file)
@@ -3,7 +3,7 @@
 exports[`compiler: transform text <template v-for> 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createTextVNode: _createTextVNode } = _Vue
 
@@ -19,7 +19,7 @@ return function render() {
 exports[`compiler: transform text consecutive text 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { toDisplayString: _toDisplayString } = _Vue
 
@@ -31,7 +31,7 @@ return function render() {
 exports[`compiler: transform text consecutive text between elements 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
 
@@ -47,7 +47,7 @@ return function render() {
 exports[`compiler: transform text consecutive text mixed with elements 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, toDisplayString: _toDisplayString, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
 
@@ -65,7 +65,7 @@ return function render() {
 exports[`compiler: transform text no consecutive text 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { toDisplayString: _toDisplayString } = _Vue
 
@@ -77,7 +77,7 @@ return function render() {
 exports[`compiler: transform text text between elements (static) 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, createTextVNode: _createTextVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
 
@@ -93,8 +93,7 @@ return function render() {
 exports[`compiler: transform text with prefixIdentifiers: true 1`] = `
 "const { toDisplayString: _toDisplayString } = Vue
 
-return function render() {
-  const _ctx = this
+return function render(_ctx, _cache) {
   return _toDisplayString(_ctx.foo) + \\" bar \\" + _toDisplayString(_ctx.baz + _ctx.qux)
 }"
 `;
index e69ff2f46b802cf218911626a0a67b1fcca8173c..884344fe50b62b89760f07aec2515b84624bbded 100644 (file)
@@ -3,7 +3,7 @@
 exports[`compiler: v-for codegen basic v-for 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
 
@@ -17,7 +17,7 @@ return function render() {
 exports[`compiler: v-for codegen keyed template v-for 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
 
@@ -34,7 +34,7 @@ return function render() {
 exports[`compiler: v-for codegen keyed v-for 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
 
@@ -48,7 +48,7 @@ return function render() {
 exports[`compiler: v-for codegen skipped key 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
 
@@ -62,7 +62,7 @@ return function render() {
 exports[`compiler: v-for codegen skipped value & key 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
 
@@ -76,7 +76,7 @@ return function render() {
 exports[`compiler: v-for codegen skipped value 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
 
@@ -90,7 +90,7 @@ return function render() {
 exports[`compiler: v-for codegen template v-for 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
 
@@ -107,7 +107,7 @@ return function render() {
 exports[`compiler: v-for codegen template v-for w/ <slot/> 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, renderSlot: _renderSlot } = _Vue
 
@@ -121,7 +121,7 @@ return function render() {
 exports[`compiler: v-for codegen v-for on <slot/> 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, renderSlot: _renderSlot } = _Vue
 
@@ -135,7 +135,7 @@ return function render() {
 exports[`compiler: v-for codegen v-for on element with custom directive 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode, withDirectives: _withDirectives, resolveDirective: _resolveDirective } = _Vue
 
@@ -153,7 +153,7 @@ return function render() {
 exports[`compiler: v-for codegen v-if + v-for 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode, createCommentVNode: _createCommentVNode } = _Vue
 
@@ -169,7 +169,7 @@ return function render() {
 exports[`compiler: v-for codegen value + key + index 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderList: _renderList, openBlock: _openBlock, createBlock: _createBlock, Fragment: _Fragment, createVNode: _createVNode } = _Vue
 
index 50d992e7cc9ef7ce9549a09172165614acc5d16e..891371495650e0cdadbc1888d6d9e05d0e23c1f6 100644 (file)
@@ -3,7 +3,7 @@
 exports[`compiler: v-if codegen basic v-if 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
 
@@ -17,7 +17,7 @@ return function render() {
 exports[`compiler: v-if codegen template v-if 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, openBlock: _openBlock, Fragment: _Fragment, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
 
@@ -35,7 +35,7 @@ return function render() {
 exports[`compiler: v-if codegen template v-if w/ single <slot/> child 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderSlot: _renderSlot, openBlock: _openBlock, createCommentVNode: _createCommentVNode } = _Vue
 
@@ -49,7 +49,7 @@ return function render() {
 exports[`compiler: v-if codegen v-if + v-else 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
 
@@ -63,7 +63,7 @@ return function render() {
 exports[`compiler: v-if codegen v-if + v-else-if + v-else 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode, Fragment: _Fragment } = _Vue
 
@@ -79,7 +79,7 @@ return function render() {
 exports[`compiler: v-if codegen v-if + v-else-if 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
 
@@ -95,7 +95,7 @@ return function render() {
 exports[`compiler: v-if codegen v-if on <slot/> 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { renderSlot: _renderSlot, openBlock: _openBlock, createCommentVNode: _createCommentVNode } = _Vue
 
@@ -109,7 +109,7 @@ return function render() {
 exports[`compiler: v-if codegen v-if with key 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode } = _Vue
 
index 0ac89d9a5be7159e028132219f800cb77759e90d..dddef6e09608114dc610a1dab4665255004771bc 100644 (file)
@@ -3,8 +3,7 @@
 exports[`compiler: transform v-model compound expression (with prefixIdentifiers) 1`] = `
 "import { createVNode as _createVNode, createBlock as _createBlock, openBlock as _openBlock } from \\"vue\\"
 
-export function render() {
-  const _ctx = this
+export function render(_ctx, _cache) {
   return (_openBlock(), _createBlock(\\"input\\", {
     modelValue: _ctx.model[_ctx.index],
     \\"onUpdate:modelValue\\": $event => (_ctx.model[_ctx.index] = $event)
@@ -15,7 +14,7 @@ export function render() {
 exports[`compiler: transform v-model compound expression 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -30,8 +29,7 @@ return function render() {
 exports[`compiler: transform v-model simple exprssion (with prefixIdentifiers) 1`] = `
 "import { createVNode as _createVNode, createBlock as _createBlock, openBlock as _openBlock } from \\"vue\\"
 
-export function render() {
-  const _ctx = this
+export function render(_ctx, _cache) {
   return (_openBlock(), _createBlock(\\"input\\", {
     modelValue: _ctx.model,
     \\"onUpdate:modelValue\\": $event => (_ctx.model = $event)
@@ -42,7 +40,7 @@ export function render() {
 exports[`compiler: transform v-model simple exprssion 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -57,7 +55,7 @@ return function render() {
 exports[`compiler: transform v-model with argument 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -72,8 +70,7 @@ return function render() {
 exports[`compiler: transform v-model with dynamic argument (with prefixIdentifiers) 1`] = `
 "import { createVNode as _createVNode, createBlock as _createBlock, openBlock as _openBlock } from \\"vue\\"
 
-export function render() {
-  const _ctx = this
+export function render(_ctx, _cache) {
   return (_openBlock(), _createBlock(\\"input\\", {
     [_ctx.value]: _ctx.model,
     [\\"onUpdate:\\" + _ctx.value]: $event => (_ctx.model = $event)
@@ -84,7 +81,7 @@ export function render() {
 exports[`compiler: transform v-model with dynamic argument 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
index ca0372a8d3619b4dd08f0467dad0f0782cebe2ff..26761012ed039e18cf59a65318fd7738953a8839 100644 (file)
@@ -3,10 +3,9 @@
 exports[`compiler: v-once transform as root node 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { setBlockTracking: _setBlockTracking, createVNode: _createVNode } = _Vue
-    const _cache = $cache
 
     return _cache[1] || (
       _setBlockTracking(-1),
@@ -21,10 +20,9 @@ return function render() {
 exports[`compiler: v-once transform on component 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { setBlockTracking: _setBlockTracking, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
-    const _cache = $cache
 
     const _component_Comp = _resolveComponent(\\"Comp\\")
 
@@ -43,10 +41,9 @@ return function render() {
 exports[`compiler: v-once transform on nested plain element 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { setBlockTracking: _setBlockTracking, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
-    const _cache = $cache
 
     return (_openBlock(), _createBlock(\\"div\\", null, [
       _cache[1] || (
@@ -63,10 +60,9 @@ return function render() {
 exports[`compiler: v-once transform on slot outlet 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { setBlockTracking: _setBlockTracking, renderSlot: _renderSlot, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
-    const _cache = $cache
 
     return (_openBlock(), _createBlock(\\"div\\", null, [
       _cache[1] || (
@@ -83,10 +79,9 @@ return function render() {
 exports[`compiler: v-once transform with hoistStatic: true 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { setBlockTracking: _setBlockTracking, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
-    const _cache = $cache
 
     return (_openBlock(), _createBlock(\\"div\\", null, [
       _cache[1] || (
index f1230bd997c917b3cd52de7b48d574cb7a3883f8..7e7aab1357c2db0c60e9dd49b9bcdf93f8bb0385 100644 (file)
@@ -3,8 +3,7 @@
 exports[`compiler: transform component slots dynamically named slots 1`] = `
 "const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = Vue
 
-return function render() {
-  const _ctx = this
+return function render(_ctx, _cache) {
   const _component_Comp = _resolveComponent(\\"Comp\\")
 
   return (_openBlock(), _createBlock(_component_Comp, null, {
@@ -18,8 +17,7 @@ return function render() {
 exports[`compiler: transform component slots implicit default slot 1`] = `
 "const { createVNode: _createVNode, resolveComponent: _resolveComponent, createBlock: _createBlock, openBlock: _openBlock } = Vue
 
-return function render() {
-  const _ctx = this
+return function render(_ctx, _cache) {
   const _component_Comp = _resolveComponent(\\"Comp\\")
 
   return (_openBlock(), _createBlock(_component_Comp, null, {
@@ -34,8 +32,7 @@ return function render() {
 exports[`compiler: transform component slots named slot with v-for w/ prefixIdentifiers: true 1`] = `
 "const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, renderList: _renderList, createSlots: _createSlots, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = Vue
 
-return function render() {
-  const _ctx = this
+return function render(_ctx, _cache) {
   const _component_Comp = _resolveComponent(\\"Comp\\")
 
   return (_openBlock(), _createBlock(_component_Comp, null, _createSlots({ _compiled: true }, [
@@ -52,8 +49,7 @@ return function render() {
 exports[`compiler: transform component slots named slot with v-if + prefixIdentifiers: true 1`] = `
 "const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, createSlots: _createSlots, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = Vue
 
-return function render() {
-  const _ctx = this
+return function render(_ctx, _cache) {
   const _component_Comp = _resolveComponent(\\"Comp\\")
 
   return (_openBlock(), _createBlock(_component_Comp, null, _createSlots({ _compiled: true }, [
@@ -70,7 +66,7 @@ return function render() {
 exports[`compiler: transform component slots named slot with v-if + v-else-if + v-else 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { resolveComponent: _resolveComponent, createSlots: _createSlots, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -99,7 +95,7 @@ return function render() {
 exports[`compiler: transform component slots named slot with v-if 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { resolveComponent: _resolveComponent, createSlots: _createSlots, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -120,8 +116,7 @@ return function render() {
 exports[`compiler: transform component slots named slots 1`] = `
 "const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = Vue
 
-return function render() {
-  const _ctx = this
+return function render(_ctx, _cache) {
   const _component_Comp = _resolveComponent(\\"Comp\\")
 
   return (_openBlock(), _createBlock(_component_Comp, null, {
@@ -135,7 +130,7 @@ return function render() {
 exports[`compiler: transform component slots named slots w/ implicit default slot 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, resolveComponent: _resolveComponent, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -156,8 +151,7 @@ return function render() {
 exports[`compiler: transform component slots nested slots scoping 1`] = `
 "const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = Vue
 
-return function render() {
-  const _ctx = this
+return function render(_ctx, _cache) {
   const _component_Inner = _resolveComponent(\\"Inner\\")
   const _component_Comp = _resolveComponent(\\"Comp\\")
 
@@ -180,8 +174,7 @@ return function render() {
 exports[`compiler: transform component slots on-component default slot 1`] = `
 "const { toDisplayString: _toDisplayString, resolveComponent: _resolveComponent, createVNode: _createVNode, createBlock: _createBlock, openBlock: _openBlock } = Vue
 
-return function render() {
-  const _ctx = this
+return function render(_ctx, _cache) {
   const _component_Comp = _resolveComponent(\\"Comp\\")
 
   return (_openBlock(), _createBlock(_component_Comp, null, {
index 8b6517ce96d206ae90163c26af0f8c5952f6ba4f..1a88da5e221549a561d6be139e36713abf3d1fc8 100644 (file)
@@ -199,7 +199,7 @@ export function generate(
     push(`const render = _withId(`)
   }
   if (!ssr) {
-    push(`function render() {`)
+    push(`function render(_ctx, _cache) {`)
   } else {
     push(`function ssrRender(_ctx, _push, _parent) {`)
   }
@@ -216,20 +216,9 @@ export function generate(
           .map(s => `${helperNameMap[s]}: _${helperNameMap[s]}`)
           .join(', ')} } = _Vue`
       )
-      if (ast.cached > 0) {
-        newline()
-        push(`const _cache = $cache`)
-      }
       push(`\n`)
       newline()
     }
-  } else if (!__BROWSER__ && !ssr) {
-    push(`const _ctx = this`)
-    if (ast.cached > 0) {
-      newline()
-      push(`const _cache = _ctx.$cache`)
-    }
-    newline()
   }
 
   // generate asset resolution statements
index 07a34f610f0d46e912c4619863ec111eb048a8e6..af1a5e7372647ac69469cd942343f262741a59cb 100644 (file)
@@ -6,7 +6,7 @@ const { createVNode: _createVNode } = _Vue
 
 const _hoisted_1 = {}
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { createVNode: _createVNode, createBlock: _createBlock, Fragment: _Fragment, openBlock: _openBlock } = _Vue
 
index 3efb9699ee78c5cb202e8b491ea950cfdaca4a0c..7989e041ebd373f49c6ab141d1f280e4218ff38c 100644 (file)
@@ -3,7 +3,7 @@
 exports[`compiler: transform v-model input w/ dynamic v-bind 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { vModelDynamic: _vModelDynamic, mergeProps: _mergeProps, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -20,7 +20,7 @@ return function render() {
 exports[`compiler: transform v-model input w/ dynamic v-bind 2`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { vModelDynamic: _vModelDynamic, createVNode: _createVNode, withDirectives: _withDirectives, resolveDirective: _resolveDirective, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -40,7 +40,7 @@ return function render() {
 exports[`compiler: transform v-model modifiers .lazy 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -62,7 +62,7 @@ return function render() {
 exports[`compiler: transform v-model modifiers .number 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -84,7 +84,7 @@ return function render() {
 exports[`compiler: transform v-model modifiers .trim 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -106,7 +106,7 @@ return function render() {
 exports[`compiler: transform v-model simple expression 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -123,7 +123,7 @@ return function render() {
 exports[`compiler: transform v-model simple expression for input (checkbox) 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { vModelCheckbox: _vModelCheckbox, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -141,7 +141,7 @@ return function render() {
 exports[`compiler: transform v-model simple expression for input (dynamic type) 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { vModelDynamic: _vModelDynamic, createVNode: _createVNode, withDirectives: _withDirectives, resolveDirective: _resolveDirective, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -161,7 +161,7 @@ return function render() {
 exports[`compiler: transform v-model simple expression for input (radio) 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { vModelRadio: _vModelRadio, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -179,7 +179,7 @@ return function render() {
 exports[`compiler: transform v-model simple expression for input (text) 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -197,7 +197,7 @@ return function render() {
 exports[`compiler: transform v-model simple expression for select 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { vModelSelect: _vModelSelect, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
@@ -214,7 +214,7 @@ return function render() {
 exports[`compiler: transform v-model simple expression for textarea 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { vModelText: _vModelText, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
index a53e1b4edd035bacc59ef270c0475840b5678e7f..507f93c9a5b4117def342560cde7247eb7a39b68 100644 (file)
@@ -3,7 +3,7 @@
 exports[`compiler: v-show transform simple expression 1`] = `
 "const _Vue = Vue
 
-return function render() {
+return function render(_ctx, _cache) {
   with (this) {
     const { vShow: _vShow, createVNode: _createVNode, withDirectives: _withDirectives, createBlock: _createBlock, openBlock: _openBlock } = _Vue
 
index 553fb1f2f625589d701c7cd5073409a8244a6af8..ba737d983d8f5139a4df3f28165338eedc408476 100644 (file)
@@ -2,7 +2,7 @@
 
 exports[`source map 1`] = `
 Object {
-  "mappings": ";;;;UAAA,cACE,aAA8B;IAAzB,aAAmB,4BAAbA,WAAM",
+  "mappings": ";;;UAAA,cACE,aAA8B;IAAzB,aAAmB,4BAAbA,WAAM",
   "names": Array [
     "render",
   ],
index 57d21a2c097069cbe81f08e3b7a27e7a998a21c6..ce9bcef77138af41458531127233a5d7f5465fce 100644 (file)
@@ -7,8 +7,7 @@ import _imports_0 from '@svg/file.svg'
 
 const _hoisted_1 = _imports_0 + '#fragment'
 
-export function render() {
-  const _ctx = this
+export function render(_ctx, _cache) {
   return (_openBlock(), _createBlock(\\"use\\", { href: _hoisted_1 }))
 }"
 `;
@@ -16,8 +15,7 @@ export function render() {
 exports[`compiler sfc: transform asset url support uri is empty 1`] = `
 "import { createVNode as _createVNode, createBlock as _createBlock, openBlock as _openBlock } from \\"vue\\"
 
-export function render() {
-  const _ctx = this
+export function render(_ctx, _cache) {
   return (_openBlock(), _createBlock(\\"use\\", { href: '' }))
 }"
 `;
@@ -28,8 +26,7 @@ import _imports_0 from './logo.png'
 import _imports_1 from 'fixtures/logo.png'
 
 
-export function render() {
-  const _ctx = this
+export function render(_ctx, _cache) {
   return (_openBlock(), _createBlock(_Fragment, null, [
     _createVNode(\\"img\\", { src: _imports_0 }),
     _createVNode(\\"img\\", { src: _imports_1 }),
index 5ccf23e4e7b79e3917b5d93eb6a161719c2b5005..ca4220aba142e048c766de137dce79efd31b21ad 100644 (file)
@@ -14,8 +14,7 @@ const _hoisted_6 = _imports_0 + '2x, ' + _imports_0 + '3x'
 const _hoisted_7 = _imports_0 + ', ' + _imports_0 + '2x, ' + _imports_0 + '3x'
 const _hoisted_8 = \\"/logo.png\\" + ', ' + _imports_0 + '2x'
 
-export function render() {
-  const _ctx = this
+export function render(_ctx, _cache) {
   return (_openBlock(), _createBlock(_Fragment, null, [
     _createVNode(\\"img\\", {
       src: \\"./logo.png\\",
index 2217f069c0b9b0261bbbea079a5281a51b8b41ab..e6188f3f6da8b62c12222551ebfdb4346ad7a7fb 100644 (file)
@@ -9,7 +9,7 @@ test('should work', () => {
   expect(result.errors.length).toBe(0)
   expect(result.source).toBe(source)
   // should expose render fn
-  expect(result.code).toMatch(`export function render()`)
+  expect(result.code).toMatch(`export function render(`)
 })
 
 test('preprocess pug', () => {
index 33a3f57cd221ca8e0de783dd5cef46a050acafc3..5e60ad397528e79315d2ec5ea5edfae2f08daf26 100644 (file)
@@ -47,7 +47,8 @@ export function renderComponentRoot(
     slots,
     attrs,
     vnodeHooks,
-    emit
+    emit,
+    renderCache
   } = instance
 
   let result
@@ -57,7 +58,9 @@ export function renderComponentRoot(
   }
   try {
     if (vnode.shapeFlag & ShapeFlags.STATEFUL_COMPONENT) {
-      result = normalizeVNode(instance.render!.call(withProxy || proxy))
+      result = normalizeVNode(
+        instance.render!.call(withProxy || proxy, proxy, renderCache)
+      )
     } else {
       // functional
       const render = Component as FunctionalComponent