chore(vapor): remove no longer needed CREATE_TEXT_NODE IR type

This commit is contained in:
Evan You 2025-03-11 15:33:21 +08:00
parent f6d7b90195
commit 9ff6177697
No known key found for this signature in database
GPG Key ID: 00E9AB7A6704CE0A
3 changed files with 2 additions and 34 deletions

View File

@ -13,7 +13,7 @@ import { genSetHtml } from './html'
import { genIf } from './if' import { genIf } from './if'
import { genDynamicProps, genSetProp } from './prop' import { genDynamicProps, genSetProp } from './prop'
import { genDeclareOldRef, genSetTemplateRef } from './templateRef' import { genDeclareOldRef, genSetTemplateRef } from './templateRef'
import { genCreateTextNode, genGetTextChild, genSetText } from './text' import { genGetTextChild, genSetText } from './text'
import { import {
type CodeFragment, type CodeFragment,
INDENT_END, INDENT_END,
@ -69,8 +69,6 @@ export function genOperation(
return genSetHtml(oper, context) return genSetHtml(oper, context)
case IRNodeTypes.SET_TEMPLATE_REF: case IRNodeTypes.SET_TEMPLATE_REF:
return genSetTemplateRef(oper, context) return genSetTemplateRef(oper, context)
case IRNodeTypes.CREATE_TEXT_NODE:
return genCreateTextNode(oper, context)
case IRNodeTypes.INSERT_NODE: case IRNodeTypes.INSERT_NODE:
return genInsertNode(oper, context) return genInsertNode(oper, context)
case IRNodeTypes.PREPEND_NODE: case IRNodeTypes.PREPEND_NODE:

View File

@ -1,10 +1,6 @@
import type { SimpleExpressionNode } from '@vue/compiler-dom' import type { SimpleExpressionNode } from '@vue/compiler-dom'
import type { CodegenContext } from '../generate' import type { CodegenContext } from '../generate'
import type { import type { GetTextChildIRNode, SetTextIRNode } from '../ir'
CreateTextNodeIRNode,
GetTextChildIRNode,
SetTextIRNode,
} from '../ir'
import { getLiteralExpressionValue } from '../utils' import { getLiteralExpressionValue } from '../utils'
import { genExpression } from './expression' import { genExpression } from './expression'
import { type CodeFragment, NEWLINE, genCall } from './utils' import { type CodeFragment, NEWLINE, genCall } from './utils'
@ -22,22 +18,6 @@ export function genSetText(
] ]
} }
export function genCreateTextNode(
oper: CreateTextNodeIRNode,
context: CodegenContext,
): CodeFragment[] {
const { helper } = context
const { id, values, jsx } = oper
return [
NEWLINE,
`const n${id} = `,
...genCall(
helper('createTextNode'),
values && combineValues(values, context, jsx),
),
]
}
function combineValues( function combineValues(
values: SimpleExpressionNode[], values: SimpleExpressionNode[],
context: CodegenContext, context: CodegenContext,

View File

@ -25,7 +25,6 @@ export enum IRNodeTypes {
INSERT_NODE, INSERT_NODE,
PREPEND_NODE, PREPEND_NODE,
CREATE_TEXT_NODE,
CREATE_COMPONENT_NODE, CREATE_COMPONENT_NODE,
SLOT_OUTLET_NODE, SLOT_OUTLET_NODE,
@ -162,14 +161,6 @@ export interface SetTemplateRefIRNode extends BaseIRNode {
effect: boolean effect: boolean
} }
// TODO remove, no longer needed
export interface CreateTextNodeIRNode extends BaseIRNode {
type: IRNodeTypes.CREATE_TEXT_NODE
id: number
values?: SimpleExpressionNode[]
jsx?: boolean
}
export interface InsertNodeIRNode extends BaseIRNode { export interface InsertNodeIRNode extends BaseIRNode {
type: IRNodeTypes.INSERT_NODE type: IRNodeTypes.INSERT_NODE
elements: number[] elements: number[]
@ -236,7 +227,6 @@ export type OperationNode =
| SetDynamicEventsIRNode | SetDynamicEventsIRNode
| SetHtmlIRNode | SetHtmlIRNode
| SetTemplateRefIRNode | SetTemplateRefIRNode
| CreateTextNodeIRNode
| InsertNodeIRNode | InsertNodeIRNode
| PrependNodeIRNode | PrependNodeIRNode
| DirectiveIRNode | DirectiveIRNode