Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble passing "true", "false" and "null" #585

Open
fabiosantoscode opened this issue Jul 9, 2017 · 3 comments
Open

Trouble passing "true", "false" and "null" #585

fabiosantoscode opened this issue Jul 9, 2017 · 3 comments

Comments

@fabiosantoscode
Copy link

fabiosantoscode commented Jul 9, 2017

Some values can't be passed directly to a function.

I was trying to pass true as the first argument to a function, but it got turned into undefined. From what I've seen this happens with false and null as well.

Check the below example and its output (from running ./v7 file.js), written in the comments:

'use strict'

function fn(a, b) { print("a: " + a + ", b: " + b) }

fn(3, 2) // a: 3, b: 2 
fn(true) // a: undefined, b: undefined 
fn(true, true) // a: true, b: undefined 
fn(true, "foo") // a: true, b: foo 

If instead you put the true value in a variable and pass it through that variable, everything works well.

print('-- from a variable')
var trueVar = true

fn(trueVar) // a: true, b: undefined 
fn(trueVar, trueVar) // a: true, b: true 
fn(trueVar, "foo") // a: true, b: foo 

Everything works if true is generated from any expression as well.

I compiled the latest master (as of today) of v7 with the following command:

gcc -O0 -DV7_EXE -DV7_ENABLE_STACK_TRACKING -DV7_ENABLE_FILE v7.c -lm

But even when keeping only -DV7_EXE I can still reproduce this issue.

@cpq
Copy link
Member

cpq commented Jul 10, 2017

we are not actively working on v7, please use https://github.com/cesanta/mjs

@ozlb
Copy link

ozlb commented Aug 21, 2017

is there any migration guide from v7 to mjs?

@cpq
Copy link
Member

cpq commented Aug 22, 2017

No.
The API is quite similar though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants