• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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