mirror of https://github.com/vuejs/core.git
refactor(compiler-vapor): remove source in codegen context
This commit is contained in:
parent
46e83e9681
commit
3817bbf134
|
@ -29,7 +29,6 @@ export type CodeFragment =
|
||||||
export class CodegenContext {
|
export class CodegenContext {
|
||||||
options: Required<CodegenOptions>
|
options: Required<CodegenOptions>
|
||||||
|
|
||||||
source: string
|
|
||||||
code: CodeFragment[]
|
code: CodeFragment[]
|
||||||
map?: SourceMapGenerator
|
map?: SourceMapGenerator
|
||||||
|
|
||||||
|
@ -86,7 +85,10 @@ export class CodegenContext {
|
||||||
}
|
}
|
||||||
genEffect?: (effects: IREffect[]) => CodeFragment[]
|
genEffect?: (effects: IREffect[]) => CodeFragment[]
|
||||||
|
|
||||||
constructor(ir: RootIRNode, options: CodegenOptions) {
|
constructor(
|
||||||
|
public ir: RootIRNode,
|
||||||
|
options: CodegenOptions,
|
||||||
|
) {
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
mode: 'function',
|
mode: 'function',
|
||||||
prefixIdentifiers: options.mode === 'module',
|
prefixIdentifiers: options.mode === 'module',
|
||||||
|
@ -105,7 +107,6 @@ export class CodegenContext {
|
||||||
expressionPlugins: [],
|
expressionPlugins: [],
|
||||||
}
|
}
|
||||||
this.options = extend(defaultOptions, options)
|
this.options = extend(defaultOptions, options)
|
||||||
this.source = ir.source
|
|
||||||
|
|
||||||
const [code, push] = buildCodeFragment()
|
const [code, push] = buildCodeFragment()
|
||||||
this.code = code
|
this.code = code
|
||||||
|
@ -117,7 +118,7 @@ export class CodegenContext {
|
||||||
if (!__BROWSER__ && sourceMap) {
|
if (!__BROWSER__ && sourceMap) {
|
||||||
// lazy require source-map implementation, only in non-browser builds
|
// lazy require source-map implementation, only in non-browser builds
|
||||||
this.map = new SourceMapGenerator()
|
this.map = new SourceMapGenerator()
|
||||||
this.map.setSourceContent(filename, this.source)
|
this.map.setSourceContent(filename, ir.source)
|
||||||
this.map._sources.add(filename)
|
this.map._sources.add(filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue