Finding unused classes or dead code in a Haxe project

Does anyone know how to automatically get a list of unused classes in a Haxe project? I do not find documentation about this, but the information should be available somewhere. Like the difference after eliminating dead code.

+4
source share
2 answers

Finally, I use two solutions to get the full answer.

  • The first of these is the difference between Haxe files in the source path and collapsible classes in compilation in the form of a detailed description.
  • Seconds are the difference with dce-debugand files in the source path. thanks @jonasmalacofilho

You can find my script on gist: https://gist.github.com/aliokan/0a9abded7c079ad0260f651245964db2

+2

DCE, -D dce-debug. ( )

, a class Hello { static function main() trace("Hello!"); } haxe --interp -main Hello -D dce-debug - :

...
[DCE] Removed field Type.getClass
[DCE] Removed field Type.getEnum
[DCE] Removed field Type.getSuperClass
[DCE] Removed field Type.getClassName
[DCE] Removed field Type.getEnumName
[DCE] Removed field Type.resolveClass
[DCE] Removed field Type.resolveEnum
[DCE] Removed field Type.createInstance
[DCE] Removed field Type.createEmptyInstance
[DCE] Removed field Type.createEnum
[DCE] Removed field Type.createEnumIndex
[DCE] Removed field Type.getInstanceFields
[DCE] Removed field Type.getClassFields
[DCE] Removed field Type.getEnumConstructs
[DCE] Removed field Type.typeof
[DCE] Removed field Type.enumEq
[DCE] Removed field Type.enumConstructor
[DCE] Removed field Type.enumParameters
[DCE] Removed field Type.enumIndex
[DCE] Removed field Type.allEnums
[DCE] Removed class Type
[DCE] Removed enum ValueType
...
+3

Source: https://habr.com/ru/post/1658786/


All Articles