v0.6.0-alpha.2
Pre-release
Pre-release
Changes
- Smaller AST
- The main goal of this release was to reduce the overall size of the spanned AST nodes. To achieve this a few optimizations were made
- All constant size tokens were converted from being represented as a
Slice
to now only being represented as aPosition
marking the start of that token. The end can easily be calculated since the token is a constant size. - The requirement to use
Cow<str>
has been removed and now the AST nodes are generic over anyT
. - The
source
property of aSlice
is now represented by aSourceText
new type wrapper aroundT
, helpers have been provided for this type withT
of&str
,String
andCow<str>
.
- All constant size tokens were converted from being represented as a
- To make these changes slightly easier to manage, all the conversion from spanned to non-spanned nodes was moved to its own module
resast::spanned::convert
- Nodes with duplicated data were re-structured to reduce that duplication
NormalImportSpec
andExportSpecifier
, now has anOption
for the local value which was renamedalias
TemplateElement
is no longer represented as bothcooked
andraw
but instead matches theStringLit
pattern, that is the propertiesopen_quote
,close_quote
,content
RegEx::flags
is now anOption
- Position was updated to hold
u32
values instead ofusize
meaning any 64 bit architectures should see this type reduced to half its previous size. - A new
spanned::Boolean
is provided instead ofspanned::Lit::Boolean
holding aSlice
- A new module was added containing new-type wrappers around Position for all fixed-sized nodes called
spanned::tokens
- These new types implement a new trait
Token
that provides an interface to get the&'static str
for the token along with the start and endPosition
values. Any type that implementsToken
should also implementNode
- These new types implement a new trait
- The main goal of this release was to reduce the overall size of the spanned AST nodes. To achieve this a few optimizations were made