Thanks to visit codestin.com
Credit goes to github.com

Skip to content

compile time errors with ammo.js (bullet built with emscripten) #3

@CapsAdmin

Description

@CapsAdmin

using: latest luajit 2.1 from git
translating: https://github.com/kripken/ammo.js/blob/master/builds/ammo.js

I realize running bullet like this this is silly and all but I was curious to see how it would perform. I also thought maybe you would be interested in fixing these errors (there's probably gonna be more) since you already have a gigantic test suite for js to make sure there are no errors there.

I'll try to fix the errors manually and report whats wrong:

I had to change LJ_MAX_LOCVAR from 200 to 2000 and LJ_MAX_SLOTS from 250 to 2000.

After doing this I got this error:

ammo.lua:4528: <goto __Continue200> jumps into the scope of local 'convertCode'

after manually fixing this error by moving the local convert code (which is just 5 lines below) above the function i get this syntax error:

ammo.lua:4840: '<name>' expected near '{'

this section of the code is supposed to be commented but fails to do so because the generated comment "-- [[" needs to be be "--[[" (without the space in-between) To fix this I replaced "-- [[" with "--[[" everywhere in the code.

I now get another syntax error that looks like this foo(a, b, c, --[[hello world]], d, e) so when I remove the comment it becomes (a, b, c,, d, e) where the error is the 2 commas

To fix this I replaced ",--[[ EmitCall" with "--[[ EmitCall"

Now there is this another syntax error on line 10317

currArg =--[[WTF Call { type: 'CallExpression', callee: { type: 'ConditionalExpression', test: { type: 'Identifier', name: 'signed' }, consequent: { type: 'Identifier', name: 'reSign' }, alternate: { type: 'Identifier', name: 'unSign' } }, arguments: [ { type: 'BinaryExpression', operator: '&', left: [Object], right: [Object] }, { type: 'BinaryExpression', operator: '*', left: [Object], right: [Object] } ] } --]]bit32.band (currArg ,limit ) ,(argSize *8 ) )

which when simplified becomes currArg = foo(), (bar) ) where the syntax error is an extra ")"

Now I get "undefined label '__Continue539' " because the code is structured like this

`if foo then
goto __Continue539
end

::__Switch541_2:: do
::__Continue539::
end`

there's a lot of these and I don't really know how to fix them. I just commented the goto line out.

After this there's a bunch of "break" statements so you get the error "no loop to break". I also commented these out

Finally there's this

while __ToBoolean(__CmpGreater (Module ["preInit" ] .length ,0 ) ) do --[[WTF Call { type: 'CallExpression', callee: { type: 'CallExpression', callee: { type: 'MemberExpression', computed: false, object: [Object], property: [Object] }, arguments: [] }, arguments: [] } --]]) end

Where the syntax error is the extra ")" at the end of the comment. This seems to be all the compile time errors.

Now I get your custom "unhandled exception" error. I commented out os.exit() because of issues it would cause in the environment.

`> open ammo
Unhandled Exception:table::"150"
"stack traceback:
lua/ammo.lua:57: in function <lua/ammo.lua:52>
[C]: in function 'error'
lua/ammo.lua:388: in function '__RefCheck'
lua/ammo.lua:3439: in function '__CallMember'
lua/ammo.lua:3196: in function <lua/ammo.lua:3195>
[C]: in function 'xpcall'
lua/ammo.lua:3195: in main chunk
[C]: in function 'xpcall'
.../goluwa/.base/lua/libraries/filesystem/lua_utilities.lua:165: in function 'include'
...gle Drive/goluwa/.base/lua/autorun//console_commands.lua:363: in function <...gle Drive/goluwa/.base/lua/autorun//console_commands.lua:353>
[C]: in function 'xpcall'
...
lua/libraries/event.lua:417: in function 'UpdateTimers'
lua/main_loop.lua:30: in function <lua/main_loop.lua:29>
[C]: in function 'pcall'
lua/main_loop.lua:54: in function 'update'
lua/main_loop.lua:94: in function 'main'
lua/main_loop.lua:101: in main chunk
[C]: in function 'xpcall'
.../goluwa/.base/lua/libraries/filesystem/lua_utilities.lua:165: in function 'include'
../../lua/init.lua:313: in main chunk
[C]: at 0x7ff6a2c51ed0"

stack traceback:
lua/ammo.lua:69: in function '__LastXpCall'
lua/ammo.lua:181202: in function '__TryHandler148'
lua/ammo.lua:181208: in main chunk
[C]: in function 'xpcall'
.../goluwa/.base/lua/libraries/filesystem/lua_utilities.lua:165: in function 'include'
...gle Drive/goluwa/.base/lua/autorun//console_commands.lua:363: in function <...gle Drive/goluwa/.base/lua/autorun//console_commands.lua:353>
[C]: in function 'xpcall'
lua/libraries/console.lua:111: in function 'call'
lua/libraries/console.lua:126: in function 'RunString'
lua/libraries/extensions/console_curses.lua:675: in function 'HandleKey'
lua/libraries/extensions/console_curses.lua:136: in function <lua/libraries/extensions/console_curses.lua:101>
[C]: in function 'Call'
lua/libraries/event.lua:417: in function 'UpdateTimers'
lua/main_loop.lua:30: in function <lua/main_loop.lua:29>
[C]: in function 'pcall'
lua/main_loop.lua:54: in function 'update'
lua/main_loop.lua:94: in function 'main'
lua/main_loop.lua:101: in main chunk
[C]: in function 'xpcall'
.../goluwa/.base/lua/libraries/filesystem/lua_utilities.lua:165: in function 'include'
../../lua/init.lua:313: in main chunk
[C]: at 0x7ff6a2c51ed0
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions