• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

vJass generated Code in JassHelper

Status
Not open for further replies.
Level 23
Joined
Apr 16, 2012
Messages
4,041
So, if you are interested in how some code is generated from vJass to Jass, or from Zinc to vJass to Jass maybe, you may find this interesting.

This is also very useful to see the inlined output as well and I discovered this just today

Code:

JASS:
library ShowJHOutput
    
    //! textmacro SHOW_JH_CODE
    
        private function a takes code c returns nothing
            call Filter(c)
        endfunction
        
        private function b takes nothing returns nothing
            
        endfunction
        
        private function c takes nothing returns nothing
            call a(function b)
        endfunction
    
    //! endtextmacro
    
endlibrary

Basically, if you want to see the exact Jass code inside war3map.j without opening it with some mpq editor, you will place //! runtextmacro SHOW_JH_CODE(), and compile.

How this works: Basically, when you pass code to function, and try to pass that local(function's argument) into function, that expect return type of boolean it will not pop error even if the function returns nothing(exploited by http://www.hiveworkshop.com/forums/jass-resources-412/snippet-registerplayerunitevent-203338/) but when JassHelper's optimizer kicks in, it first optimizes and then checks for the function's return type.

Basically, the code up there will compile with Debug Mode on, but if you disable Debug Mode, it will pop error with the fully made code with inlined stuff and all the goodies and that is because a(function f) is inlined into Filter(function f), but clearly function f doesnt return boolean, but nothing
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Or just open the text file output...j text file generated by jasshelper in the subfolder "log" if you use the JNGP.

Btw i think i remember if you make a syntax error, such as write a line only with "a" it still shows the jass generated code ?
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
maybe one would like to see if their function gets inlined :D

I dont know, there is also the way that Troll-Brain said(checking the output.j), and this is just a thing I found out and though sharing wouldnt be bad(the same with call BJDebugMsg("thistype"))
 
Status
Not open for further replies.
Top