fix(compiler-ssr): fix input w/ v-bind="obj" codegen

This commit is contained in:
Evan You
2020-03-16 18:14:49 -04:00
parent 9eef37fa32
commit 3b40fc56db
4 changed files with 48 additions and 14 deletions

View File

@@ -23,7 +23,8 @@ import {
IfStatement,
AssignmentExpression,
ReturnStatement,
VNodeCall
VNodeCall,
SequenceExpression
} from './ast'
import { SourceMapGenerator, RawSourceMap } from 'source-map'
import {
@@ -593,6 +594,9 @@ function genNode(node: CodegenNode | symbol | string, context: CodegenContext) {
case NodeTypes.JS_ASSIGNMENT_EXPRESSION:
!__BROWSER__ && genAssignmentExpression(node, context)
break
case NodeTypes.JS_SEQUENCE_EXPRESSION:
!__BROWSER__ && genSequenceExpression(node, context)
break
case NodeTypes.JS_RETURN_STATEMENT:
!__BROWSER__ && genReturnStatement(node, context)
break
@@ -914,6 +918,15 @@ function genAssignmentExpression(
genNode(node.right, context)
}
function genSequenceExpression(
node: SequenceExpression,
context: CodegenContext
) {
context.push(`(`)
genNodeList(node.expressions, context)
context.push(`)`)
}
function genReturnStatement(
{ returns }: ReturnStatement,
context: CodegenContext