From: Evan You Date: Wed, 11 Nov 2020 15:36:59 +0000 (-0500) Subject: wip: remove unnecessary inlinePropsIdentifier option X-Git-Tag: v3.0.3~50^2~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F2532%2Fhead;p=thirdparty%2Fvuejs%2Fcore.git wip: remove unnecessary inlinePropsIdentifier option --- diff --git a/packages/compiler-core/src/codegen.ts b/packages/compiler-core/src/codegen.ts index 299106fde3..9e58d751da 100644 --- a/packages/compiler-core/src/codegen.ts +++ b/packages/compiler-core/src/codegen.ts @@ -66,10 +66,7 @@ export interface CodegenResult { } export interface CodegenContext - extends Omit< - Required, - 'bindingMetadata' | 'inline' | 'inlinePropsIdentifier' - > { + extends Omit, 'bindingMetadata' | 'inline'> { source: string code: string line: number diff --git a/packages/compiler-core/src/options.ts b/packages/compiler-core/src/options.ts index 5f0f06dbea..37641a458b 100644 --- a/packages/compiler-core/src/options.ts +++ b/packages/compiler-core/src/options.ts @@ -91,10 +91,6 @@ interface SharedTransformCodegenOptions { * This allows the function to directly access setup() local bindings. */ inline?: boolean - /** - * Identifier for props in setup() inline mode. - */ - inlinePropsIdentifier?: string } export interface TransformOptions extends SharedTransformCodegenOptions { diff --git a/packages/compiler-core/src/transform.ts b/packages/compiler-core/src/transform.ts index aab29d000a..c3a37c9f71 100644 --- a/packages/compiler-core/src/transform.ts +++ b/packages/compiler-core/src/transform.ts @@ -125,7 +125,6 @@ export function createTransformContext( ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, - inlinePropsIdentifier = `$props`, onError = defaultOnError }: TransformOptions ): TransformContext { @@ -145,7 +144,6 @@ export function createTransformContext( ssrCssVars, bindingMetadata, inline, - inlinePropsIdentifier, onError, // state diff --git a/packages/compiler-core/src/transforms/transformExpression.ts b/packages/compiler-core/src/transforms/transformExpression.ts index 52a35538e9..924d217a89 100644 --- a/packages/compiler-core/src/transforms/transformExpression.ts +++ b/packages/compiler-core/src/transforms/transformExpression.ts @@ -98,14 +98,12 @@ export function processExpression( return node } - const { inline, inlinePropsIdentifier, bindingMetadata } = context + const { inline, bindingMetadata } = context const prefix = (raw: string) => { const type = hasOwn(bindingMetadata, raw) && bindingMetadata[raw] if (inline) { // setup inline mode - if (type === 'props') { - return `${inlinePropsIdentifier}.${raw}` - } else if (type === 'setup') { + if (type === 'setup') { return `${context.helperString(UNREF)}(${raw})` } else if (type === 'component-import') { return raw diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts index 085839415f..8978196119 100644 --- a/packages/compiler-sfc/src/compileScript.ts +++ b/packages/compiler-sfc/src/compileScript.ts @@ -405,20 +405,16 @@ export function compileScript( ) } - // parse the signature to extract the identifiers users are assigning to - // the arguments. props identifier is always needed for inline mode - // template compilation - const params = ((signatureAST as ExpressionStatement) - .expression as ArrowFunctionExpression).params - if (params[0] && params[0].type === 'Identifier') { - propsASTNode = params[0] - propsIdentifier = propsASTNode.name - } - if (isTS) { //