A HashMap method call causes `Map contains invalid Jass scripts that couldn't be compiled by war3`
GetLocalPlayer opened this issue · comments
Don't know how to describe this better and what to ask, so this is probably gonna be in veins.
This specific line of code
https://github.com/GetLocalPlayer/CH/blob/7f021f6c009921779ef45acffcca52291b1d011b/wurst/Items/ItemAlias.wurst#L104
does not allow to load a map test. WC3 log says:
7/12 21:34:47.410 Map contains invalid Jass scripts that couldn't be compiled by war3, file: war3map.j @ 28930, error: unknown compile error on line 28930
7/12 21:34:47.410 Map contains invalid Jass scripts that couldn't be compiled by war3, file: war3map.j @ 28953, error: unknown compile error on line 28953
7/12 21:34:47.410 Map contains invalid Jass scripts that couldn't be compiled by war3, file: war3map.j @ 28954, error: unknown compile error on line 28954
7/12 21:34:47.410 Map contains invalid Jass scripts that couldn't be compiled by war3, file: war3map.j @ 28957, error: unknown compile error on line 28957
compiled.j
function call_nullTimer_add_ItemAlias_ItemAlias takes integer this_1, string w__wurst_stackPos returns nothing
local player p
local real pos_x_1
local real pos_y_1
local integer charges
local integer data
local integer index
/* ---- 28930 */ local item alias
local item receiver
local item receiver_1
local item receiver_2
local real tuple_temp
local real tuple_temp_1
set wurst_stack[wurst_stack_depth] = w__wurst_stackPos
set wurst_stack_depth = wurst_stack_depth + 1
set p = item_getPlayer(droppedItem[this_1])
set tuple_temp = item_getPos(droppedItem[this_1])
set tuple_temp_1 = item_getPos_return_y
set pos_x_1 = tuple_temp
set pos_y_1 = tuple_temp_1
set charges = item_getCharges(droppedItem[this_1])
set data = item_getUserData(droppedItem[this_1])
call item_setVisible(droppedItem[this_1], false)
set index = dispatch_LinkedList_LinkedList_LinkedList_indexOf(ItemAlias_itemIds, droppedItemId[this_1], "when calling indexOf in ItemAlias, line 99")
set receiver = createItem(dispatch_LinkedList_LinkedList_LinkedList_get(ItemAlias_aliasIds, index, "when calling get in ItemAlias, line 100"), pos_x_1, pos_y_1)
call item_setPlayer(receiver, p, true)
set receiver_1 = receiver
call item_setCharges(receiver_1, charges)
set receiver_2 = receiver_1
call item_setUserData(receiver_2, data)
/* ---- 28953 */ set alias = receiver_2
/* ---- 28954 */ call dispatch_HashMap_HashMap_HashMap_put(itemByAlias_2014[this_1], itemToIndex(alias), itemToIndex(droppedItem[this_1]), "when calling put in ItemAlias, line 104")
set wurst_stack_depth = wurst_stack_depth - 1
set p = null
/* ---- 28957 */ set alias = null
set receiver = null
set receiver_1 = null
set receiver_2 = null
endfunction
the code looks correct, so I suspect that "alias" is a reserved keyword. Please try renaming the variable or enabling the "optimize" option in wurst_run.args
which will rename all variables.
If this is indeed the case, I will add it to the restricted names.
You're right. It works.
👍 I added alias
to the restricted names.