// TODO: don't require pop
if (!expr) context.consumeCurrentValue();
}
public void compileSClass(Node node, BodyCompiler context, boolean expr) {
final SClassNode sclassNode = (SClassNode) node;
CompilerCallback receiverCallback = new CompilerCallback() {
public void call(BodyCompiler context) {
compile(sclassNode.getReceiverNode(), context, true);
}
};
CompilerCallback bodyCallback = new CompilerCallback() {
public void call(BodyCompiler context) {
boolean oldIsAtRoot = isAtRoot;
isAtRoot = false;
if (sclassNode.getBodyNode() != null) {
compile(sclassNode.getBodyNode(), context, true);
} else {
context.loadNil();
}
isAtRoot = oldIsAtRoot;
}
};
ASTInspector inspector = new ASTInspector();
inspector.inspect(sclassNode.getBodyNode());
context.defineClass("SCLASS", sclassNode.getScope(), null, null, bodyCallback, receiverCallback, inspector);
// TODO: don't require pop
if (!expr) context.consumeCurrentValue();
}