Open ghost opened 7 years ago
I think you have a bug in your definition of $$
. It should be
operator $$ prefix 1 = (_, right) => {
return #`...${right}`;
};
operator $ prefix 1 = (_, right) => {
return #`${right}[0][${right}[1]]`;
};
operator $$ prefix 1 = (_, right) => {
return #`...${right}`;
};
operator $p left 19 = (object, accessor) => {
return #`[${object}, ${accessor}]`;
};
let array = [0, 1, 2];
let pointer = array $p 0;
$ pointer = 2;
let v = $ pointer;
function acceptPair(array, index){
}
acceptPair( $$ pointer );
Anyways
Error: replacement values for syntax template must not be null or undefined
@capitalknew Sorry, I haven't had coffee yet. Your definition of $$
was correct. I'll take a look in the editor.
This is not coffee script. This is SweetJS and ES6 (spreads usage) example.
This is not coffee script
I know. I was talking about the drink 😄
I think this issue is related to on https://github.com/sweet-js/sweet-core/pull/650#issuecomment-288863584. It's good to have an issue specifically for it though. Thank you.
operator $ prefix 1 = (right) => {
return #`${right}[0][${right}[1]]`;
};
is broken for a different reason. right
is a MacroContext
object an can't be interpolated the way you're attempting to. Try
operator $ prefix 1 = (right) => {
var ptr = right.next().value;
return #`${ptr}[0][${ptr}[1]]`;
};
Also, try fix "..." operator, it really needs for ES6 today.
Error: expecting a , punctuator
You can try with online editor. I cannot using spreads with Sweet.
This code: