Skip to content

LeafAST - Substantial Refactoring of LeafKit processing chain

Pre-release
Pre-release

Choose a tag to compare

@tanner0101 tanner0101 released this 24 Apr 21:01
de65606

API & Performance Changes

  • Replaces Unresolved/ResolvedDocument with LeafAST, a document structure capable of representing both unknown state and resolved state AST with public observers on its state.
  • Adjusts LeafRenderer and LeafCache to use LeafAST
    • Note: LeafCache protocol retains ResolvedDocument as an alias to LeafAST to prevent breaking changes in this release
  • Adds .insert method to LeafCache protocol with a replace parameter to clarify whether inserting an AST is allowed to replace the current cached AST if such a key already exists
  • Adds .remove method to LeafCache protocol to allow removing individual ASTs from the cache
  • Improves routine case rendering speed on flat ASTs
  • Collapses sequential .raw Syntaxes during AST resolution for faster serialization
  • Initial introduction of LeafError type for enhanced error handling
    • Note: - not stable, to be changed from Enum to Struct in next PR for codifying the type and allowing source document referencing
  • Changes DefaultLeafCache behavior to return provided AST or nil if caching is off

Bug Fixes

  • Prevents crash on malformed external Leaf documents that cause cyclical loops (eg, a.leaf extends b.leaf and b.leaf extends a.leaf)
  • Re-introduces index, isFirst, isLast variables inside loop bodies from Leaf 3
    • Note: - collision is possible between variable names if a key in the LeafData provided to a template shares the same name as the variables

Testing Changes

  • Add test cases for measuring speed of linear & randomly accessed templates
  • Add tests cases for cyclical error handling and missing templates
  • Make TestFiles threadsafe
  • Deactivate testTagIndicator for causing data race when actual MultiThreaded Event Loops are running in tests