Skip to content

Version 3.0.0

Latest
Compare
Choose a tag to compare
@SomeRanDev SomeRanDev released this 26 Sep 11:17
· 131 commits to main since this release

September 26th, 2023

Release Notes

After 9 months of on and off development, seems like it's finally a good time to bump up the big version number.

There have been too many changes for me reasonably list here, so I will instead focus on the major additions between the release of version 2.0 and now.

Project Management Scripts

There is now a haxelib run script providing the ability to create, build, and test Reflaxe projects:

new

Generates a new Reflaxe project.

haxelib run reflaxe new <Language Name> <Language Abbreviation>

build

Combines all the source folders together into a haxelib-ready library directory.
It has an optional argument to configure the directory the built project will be placed.

haxelib run reflaxe build <Output Directory=[./_Build]>

test

Tests the Reflaxe project on a Haxe .hxml project.
The argument can be a custom .hxml file, but otherwise test/Test.hxml will be used.

haxelib run reflaxe test <HXML File=[test/Test.hxml]>

 

Plugin System

Reflaxe projects may choose to inherit their "Compiler" class from PluginCompiler instead of BaseCompiler. This will allow users of their Reflaxe library to hook into certain points of the compilation process (like "on expression" or "on class") and return their own custom content.

 

Dynamic DCE

Added a "Dynamic Dead Code Elimination" option, allowing Reflaxe projects fine control over which classes are generated. First the main function is transpiled; the transpilation process may add classes to the Dynamic DCE queue. The queued classes are then transpiled and may add more classes to the queue. This procedure repeats until the queue is empty at the end of generation.

 

Compile Class New Argument Types

BaseCompiler.compileClassImpl now passes two new classes as arguments: reflaxe.data.ClassVarData and reflaxe.data.ClassFuncData.

These classes not only contain all the previous variable and function data (and more!), but they also now provide helpful functions like ClassVarData.findDefaultExpr and ClassFuncData.findAllArgumentVariations.

 

Compile Enum New Argument Types

BaseCompiler.compileEnumImpl now passes an array of reflaxe.data.EnumOptionData for options. Same as above, this class contains all the same data as before AND helper functions to make transpiling that much easier.

 

Compile Expression topLevel Argument

BaseCompiler.compileExpressionImpl had a new argument added named topLevel: Bool.

If this argument is true, that means the expression being compiled is part of a TBlock list and is NOT being used as a value. This can be used to optimize or modify an expression's output content based on whether it needs to generate a value or not.

 

Class Hierarchy Tracker

If the trackClassHierarchy option is enabled, the child classes of a class can be found using the reflaxe.input.ClassHierarchyTracker class.

 

Get Main Expression

BaseCompiler.getMainExpr(): Null<TypedExpr> returns a typed expression that is a call to the main function of the Haxe program. If used in Haxe 4.2.0 or below, the main class must be defined using the -D mainClass define.

 

Prefix Expression Injection

Added a function to BaseCompiler named injectExpressionPrefixContent(content: String).

If called while compiling a topLevel expression in compileExpressionImpl, this will place content directly before the compiled expression.

 

Add Compile-End Callback

BaseCompiler.addCompileEndCallback(callback: () -> Void) executes code once compilation is complete. Can be used to delay compiling things until the final state of the compiler is known.

 

@:nativeTypeCode

Add support for @:nativeTypeCode by compiling types using BaseCompiler.compileNativeTypeCodeMeta.

 

@:nativeVariableCode

Add support for @:nativeVariableCode by compiling variable expressions using BaseCompiler.compileNativeVariableCodeMeta.

 

Mark Unused Variables

Local variables that are unused are marked with the @-reflaxe.unused metadata.

 

Added tabCount to SyntaxHelper.tab

A optional tab count argument can be provided to the SyntaxHelper.tab function:

using SyntaxHelper;

function getCode() {
    return someCode.tab(2); // appends two tabs to every new line in "someCode" string
}

 

Numerous Helper Functions

Tons and tons and tons of new functions were added to the classes in the reflaxe.helpers package.

 

Bug Fixes

Tons of bugs were fixed. However, the top three major ones were:

  • Fixed target code injection to use {number} instead of {}.
  • Fixed repeat variable bugs
  • Fixed EIESantizier bugs