Ruk33 / vrJASS

A just-for-fun programming language which compiles down to JASS (Warcraft 3). It aims to improve and replace the beloved vJASS.
6 stars 3 forks source link

function sorting #1

Closed Ruk33 closed 9 years ago

Ruk33 commented 9 years ago

this is how vexorian sorts functions:

globals
    //JASSHelper struct globals:
    //constant integer si__lorem=1
    //integer si__lorem_F=0
    //integer si__lorem_I=0
    //integer array si__lorem_V
    trigger st__lorem_bar
    integer f__arg_this
    integer f__result_integer
endglobals

//Generated method caller for lorem.bar
function sc__lorem_bar takes integer this returns integer
    set f__arg_this=this
    call TriggerEvaluate(st__lorem_bar)
    return f__result_integer
endfunction

function s__lorem_foo takes integer this returns integer
    return sc__lorem_bar(this)
endfunction

function s__lorem_bar takes integer this returns integer
    local integer i= s__lorem_foo(this)
    return i
endfunction

//Struct method generated initializers/callers:
function sa__lorem_bar takes nothing returns boolean
    local integer this=f__arg_this
    local integer i= s__lorem_foo(this)
    set f__result_integer= i
    return true
endfunction

// called in main with ExecuteFunc
function jasshelper__initstructs787087 takes nothing returns nothing
    set st__lorem_bar=CreateTrigger()
    call TriggerAddCondition(st__lorem_bar,Condition( function sa__lorem_bar))
endfunction

the sorted code was

struct lorem extends array
    method foo takes nothing returns integer
        return this.bar()
    endmethod

    method bar takes nothing returns integer
        local integer i = this.foo()
        return i
    endmethod
endstruct