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§
- Base
Convert Info - Base
Converter - Binding
Metadata - stores binding variables exposed by data/prop/setup script. also stores if the binding is from setup script.
- Convert
Option - ForNodeIR
- ForParse
Result - IRRoot
- IfBranch
- IfNodeIR
- Render
SlotIR - Runtime
Dir - SFCInfo
- SFC info of the current template
- Slot
- TextIR
- TopScope
- VNodeIR
- VSlotIR
Enums§
- Binding
Types - Directive
Convert Result - 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§
- Convert
Info - 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
- Core
Converter - Default implementation sketch can be used in DOM/SSR. Other platform might invent and use their own IR.
Functions§
Type Aliases§
- BaseIR
- Base
Root - Core
DirConv Ret - DirConvert
Fn - Returns the conversion of a directive. Value could be props or object.
- Directive
Converter - Prop