test: tests for codegen

This commit is contained in:
Evan You
2019-09-24 15:49:02 -04:00
parent 76a1196935
commit 7a46e51815
12 changed files with 486 additions and 26 deletions

View File

@@ -117,12 +117,14 @@ export interface ExpressionNode extends Node {
export interface IfNode extends Node {
type: NodeTypes.IF
branches: IfBranchNode[]
isRoot: boolean
}
export interface IfBranchNode extends Node {
type: NodeTypes.IF_BRANCH
condition: ExpressionNode | undefined // else
children: ChildNode[]
isRoot: boolean
}
export interface ForNode extends Node {
@@ -203,14 +205,15 @@ export function createObjectProperty(
export function createExpression(
content: string,
isStatic: boolean,
loc: SourceLocation
loc: SourceLocation,
isInterpolation = false
): ExpressionNode {
return {
type: NodeTypes.EXPRESSION,
loc,
content,
isStatic,
isInterpolation: false
isInterpolation
}
}