mirror of https://github.com/vuejs/core.git
refactor(compiler): export isLiteralWhitelisted
This commit is contained in:
parent
35b78920c4
commit
0cdc9f20c6
|
@ -54,6 +54,7 @@ export {
|
||||||
transformExpression,
|
transformExpression,
|
||||||
processExpression,
|
processExpression,
|
||||||
stringifyExpression,
|
stringifyExpression,
|
||||||
|
isLiteralWhitelisted,
|
||||||
} from './transforms/transformExpression'
|
} from './transforms/transformExpression'
|
||||||
export {
|
export {
|
||||||
buildSlots,
|
buildSlots,
|
||||||
|
|
|
@ -44,7 +44,9 @@ import { parse } from '@babel/parser'
|
||||||
import { IS_REF, UNREF } from '../runtimeHelpers'
|
import { IS_REF, UNREF } from '../runtimeHelpers'
|
||||||
import { BindingTypes } from '../options'
|
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
|
// a heuristic safeguard to bail constant expressions on presence of
|
||||||
// likely function invocation and member access
|
// likely function invocation and member access
|
||||||
|
|
|
@ -5,10 +5,11 @@ import {
|
||||||
type SourceLocation,
|
type SourceLocation,
|
||||||
advancePositionWithClone,
|
advancePositionWithClone,
|
||||||
isInDestructureAssignment,
|
isInDestructureAssignment,
|
||||||
|
isLiteralWhitelisted,
|
||||||
isStaticProperty,
|
isStaticProperty,
|
||||||
walkIdentifiers,
|
walkIdentifiers,
|
||||||
} from '@vue/compiler-dom'
|
} from '@vue/compiler-dom'
|
||||||
import { isGloballyAllowed, makeMap } from '@vue/shared'
|
import { isGloballyAllowed } from '@vue/shared'
|
||||||
import type { Identifier } from '@babel/types'
|
import type { Identifier } from '@babel/types'
|
||||||
import {
|
import {
|
||||||
type CodeFragment,
|
type CodeFragment,
|
||||||
|
@ -98,8 +99,6 @@ export function genExpression(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const isLiteralWhitelisted = /*#__PURE__*/ makeMap('true,false,null,this')
|
|
||||||
|
|
||||||
function genIdentifier(
|
function genIdentifier(
|
||||||
raw: string,
|
raw: string,
|
||||||
{ options, vaporHelper, identifiers }: CodegenContext,
|
{ options, vaporHelper, identifiers }: CodegenContext,
|
||||||
|
|
Loading…
Reference in New Issue