Module converter

Source
Expand description

IR Converter module takes AST and produces intermediate representation. All core template syntax conversion happens here. IR is later used for optimizing transformation and code generation. As we decouple codegen node from AST, Vue’s transformation passes are broken down to two parts. Convert module roughly corresponds to following transform in vue-next.

§IR Convert

  • transformElement
  • transformSlotOutlet
  • transformTextCall
  • vFor
  • vIf
  • vSlot
  • vOnce (noop)
  • vMemo (noop)

§Transform directive

  • noopDirectiveTransform
  • vModel
  • vBind
  • vOn (noop)

Re-exports§

pub use crate::error::CompilationError;
pub use crate::error::ErrorHandler;
pub use crate::parser::AstNode;
pub use crate::parser::AstRoot;
pub use crate::parser::Directive;
pub use crate::parser::Element;

Structs§

BaseConvertInfo
BaseConverter
BindingMetadata
stores binding variables exposed by data/prop/setup script. also stores if the binding is from setup script.
ConvertOption
ForNodeIR
ForParseResult
IRRoot
IfBranch
IfNodeIR
RenderSlotIR
RuntimeDir
SFCInfo
SFC info of the current template
Slot
TextIR
TopScope
VNodeIR
VSlotIR

Enums§

BindingTypes
DirectiveConvertResult
Directive’s prop argument passed to VNodeCall after conversion. Use Dropped if the directive is dropped implicitly without codegen. NB: this is not 100% translation from TS. value accepts both Props and Object.
IRNode
JsExpr

Traits§

ConvertInfo
Converter
Converts template ast node to intermediate representation. It defines the most generic Converter interface. The IR format can be platform specific. e.g Platfroms other than DOM/SSR can have different IR
CoreConverter
Default implementation sketch can be used in DOM/SSR. Other platform might invent and use their own IR.

Functions§

no_op_directive_convert

Type Aliases§

BaseIR
BaseRoot
CoreDirConvRet
DirConvertFn
Returns the conversion of a directive. Value could be props or object.
DirectiveConverter
Prop