While attempting to reproduce #693 I found some oddities:
import { class } from './es2015-macros';
class Droid {
constructor(name, color) {
this.name = name;
this.color = color;
}
rollWithIt(it) {
return this.name + " is rolling with " + it;
}
}
results in:
import {class} from "./es2015-macros";
class Droid {
constructor(name_0, color_1) {
this.name = name_0;
this.color = color_1;
}
rollWithIt(it_2) {
return this.name + " is rolling with " + it_2;
}
}
Note that the class macro doesn't expand.
Another thing I noticed is that:
'lang sweet.js';
import { unwrap, isIdentifier } from './helpers.js' for syntax;
export syntax class = function (ctx) {
let name = ctx.next().value;
let bodyCtx = ctx.contextify(ctx.next().value);
// default constructor if none specified
let construct = #`function ${name} () {}`;
let result = #``;
for (let item of bodyCtx) {
if (isIdentifier(item) && unwrap(item).value === 'constructor') {
construct = #`
function ${name} ${bodyCtx.next().value}
${bodyCtx.next().value}
`;
} else {
result = result.concat(#`
${name}.prototype.${item} = function
${bodyCtx.next().value}
${bodyCtx.next().value};
`);
}
}
return construct.concat(result);
};
results in:
import {unwrap, isIdentifier} from "./helpers.js";
"lang sweet.js";
;
;
export {class_6 as class}
Three things here:
The import statement isn't erased.
The 'lang sweet.js' directive moves below the import statement.
The empty statements don't appear to be removed.
I suspect that the moving directive is part of the problem here, but that's just conjecture.
While attempting to reproduce #693 I found some oddities:
results in:
Note that the
class
macro doesn't expand.Another thing I noticed is that:
results in:
Three things here:
'lang sweet.js'
directive moves below the import statement.I suspect that the moving directive is part of the problem here, but that's just conjecture.