refactor(compiler): export isLiteralWhitelisted

This commit is contained in:
三咲智子 Kevin Deng 2024-02-08 20:35:11 +08:00
parent 35b78920c4
commit 0cdc9f20c6
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
3 changed files with 6 additions and 4 deletions

View File

@ -54,6 +54,7 @@ export {
transformExpression,
processExpression,
stringifyExpression,
isLiteralWhitelisted,
} from './transforms/transformExpression'
export {
buildSlots,

View File

@ -44,7 +44,9 @@ import { parse } from '@babel/parser'
import { IS_REF, UNREF } from '../runtimeHelpers'
import { BindingTypes } from '../options'
const isLiteralWhitelisted = /*#__PURE__*/ makeMap('true,false,null,this')
export const isLiteralWhitelisted = /*#__PURE__*/ makeMap(
'true,false,null,this',
)
// a heuristic safeguard to bail constant expressions on presence of
// likely function invocation and member access

View File

@ -5,10 +5,11 @@ import {
type SourceLocation,
advancePositionWithClone,
isInDestructureAssignment,
isLiteralWhitelisted,
isStaticProperty,
walkIdentifiers,
} from '@vue/compiler-dom'
import { isGloballyAllowed, makeMap } from '@vue/shared'
import { isGloballyAllowed } from '@vue/shared'
import type { Identifier } from '@babel/types'
import {
type CodeFragment,
@ -98,8 +99,6 @@ export function genExpression(
}
}
const isLiteralWhitelisted = /*#__PURE__*/ makeMap('true,false,null,this')
function genIdentifier(
raw: string,
{ options, vaporHelper, identifiers }: CodegenContext,