indutny / candor

Experimental VM for a `Candor` language
http://candor-lang.org/
177 stars 16 forks source link

Leaking argc value #4

Closed creationix closed 12 years ago

creationix commented 12 years ago

When you nest function calls for native functions, the outer argc value leaks into the inner one.

scope print, typeof, sizeof

value = "Hello World!"
type = typeof(value)
size = sizeof(value)

// This works
print(type, size, value)

// This doesn't.  It fails with:
// canio: src/main.cc:78: candor::Value* Typeof(uint32_t, candor::Arguments&): Assertion `argc == 1' failed.
// Because `argc` is 3 within `typeof` when it should be 1
print(typeof(value), sizeof(value), value)

https://github.com/creationix/candor.io/blob/master/examples/broken/nestedCalls.can

indutny commented 12 years ago

Thanks, fixed