View Single Post
Old 06-25-2015, 08:19 PM   #3636
Nestharus
User
 
Join Date: Jul 2007
Posts: 220

Nestharus has little to show at this moment (6)

Default

Syntax error. Struct declared again.

Collapse JASS:
scope B
    static if true then
        private struct a extends array
        endstruct
    else
        private struct a extends array
        endstruct
    endif
endscope

The following works

Collapse JASS:
scope B
    static if true then
        struct a extends array
        endstruct
    else
        struct a extends array
        endstruct
    endif
endscope

As does the following

Collapse JASS:
scope B
    private keyword a
    
    static if true then
        struct a extends array
        endstruct
    else
        struct a extends array
        endstruct
    endif
endscope



What works with static ifs?

fields
methods
functions

What doesn't work with static ifs?

structs (keyword workaround)
scopes (no workaround)
libraries (no workaround)


Scopes and libraries make sense as they generate globals that static ifs depend on, so they need to be run first. However, structs do not ; ).



Relative paths don't work for //! import. Or rather, they are buggy.


folder
folder\normal
folder\normal\data
folder\debug
folder\debug\data

folder\normal\main.j
folder\normal\data\collection.j

folder\debug\main.j
folder\debug\collection.j

folder\main.j

folder\main.j
Collapse JASS:
static if DEBUG_MODE then
    //! import "folder\debug\main.j"
else
    //! import "folder\normal\main.j"
endif

folder\debug\main.j
Collapse JASS:
    //! import "data\collection.j"

folder\normal\main.j
Collapse JASS:
    //! import "data\collection.j"

result
Collapse JASS:
BEGIN IMPORT OF "folder\debug\main.j"
    BEGIN IMPORT OF "folder\debug\collection.j"
    END IMPORT OF "folder\debug\collection.j"
END IMPORT OF "folder\debug\main.j"

BEGIN IMPORT OF "folder\normal\main.j"
    IGNORE DOUBLE IMPORT "folder\debug\collection.j"
END IMPORT OF "folder\normal\main.j"

This is the specific bugged feature
Quote:
As of jasshelper 0.9.C.0 , relative paths used by import an already-imported file will be able to also support the file's path as possible container. Notice that the files in the same folder as the current file have priority over files on the configured paths or even the map's location.


edit
To try and stop the broken relative paths, I used the ".". Now everything is getting imported several times.

Collapse JASS:
// BEGIN IMPORT OF E:\projects\JASS\jass\Data Structures\List\HtNt\main.j
library ListHtNt  uses  optional ErrorMessage     optional MemoryAnalysis     TableField                 Table                    
// BEGIN IMPORT OF E:\projects\JASS\jass\Data Structures\List\HtNt\.\data\Element.j


private struct Element extends array
endstruct


// END IMPORT OF E:\projects\JASS\jass\Data Structures\List\HtNt\.\data\Element.j
// BEGIN IMPORT OF E:\projects\JASS\jass\Data Structures\List\HtNt\.\data\Collection.j

// BEGIN IMPORT OF E:\projects\JASS\jass\Data Structures\List\HtNt\.\data\.\Element.j


private struct Element extends array
endstruct


// END IMPORT OF E:\projects\JASS\jass\Data Structures\List\HtNt\.\data\.\Element.j
Nestharus is offline   Reply With Quote