google / traceur-compiler

Traceur is a JavaScript.next-to-JavaScript-of-today compiler
Apache License 2.0
8.18k stars 580 forks source link

Uncaught TypeError: $traceurRuntime.setProperty is not a function #1954

Open YonatanKra opened 9 years ago

YonatanKra commented 9 years ago

Hi, I've created a simple "tag" function for a string tempalte:

var myAge = 6;
var myFormerAge = 4;

function tag(strings, ...values){
    if (values[0] < 5){
        values[1] = 'small';
    }else{
        values[1] = 'big';
    }

    return `${strings[0]}${values[0]}${strings[1]}${values[1]}`;
}

var message = tag`I am ${myAge} years old, so now I am ${""}`;
console.log(message);

But it gives me an error in console: Uncaught TypeError: $traceurRuntime.setProperty is not a function

I'm using: npm 2.5.1 node 0.12 traceur 0.0.90C

The code above was built to:

var myAge = 6;
var myFormerAge = 4;
function tag(strings) {
  for (var values = [],
      $__1 = 1; $__1 < arguments.length; $__1++)
    $traceurRuntime.setProperty(values, $__1 - 1, arguments[$traceurRuntime.toProperty($__1)]);
  console.log(strings);
  console.log(values);
}
var message = tag($__0, myAge, "");
console.log(message);

Which gave an error on the line with $traceurRuntime.setProperty.

arv commented 9 years ago

setProperty was removed a while ago. What does your command look like? Maybe you are using an older version that was installed globally?