return initialiser_ == NULL ? NULL : $ CYAssign(variable, initialiser_);
}
-CYExpression *CYDeclaration::ForEachIn(CYContext &context) {
- return $V(identifier_);
+CYStatement *CYDeclaration::ForEachIn(CYContext &context, CYExpression *value) {
+ return $ CYVar($L1($L(identifier_, value)));
}
CYExpression *CYDeclaration::Replace(CYContext &context) {
}
CYStatement *CYEmpty::Replace(CYContext &context) {
- return this;
+ return NULL;
}
CYStatement *CYExpress::Collapse(CYContext &context) {
return this;
}
-CYExpression *CYExpression::ForEachIn(CYContext &context) {
- return this;
+CYStatement *CYExpression::ForEachIn(CYContext &context, CYExpression *value) {
+ return $E($ CYAssign(this, value));
}
CYNumber *CYFalse::Number(CYContext &context) {
return $ CYLet($L2($L(cys, set_), $L(cyt)), $$->*
$ CYForIn($V(cyt), $V(cys), $ CYBlock($$->*
- $E($ CYAssign(initialiser_->ForEachIn(context), $M($V(cys), $V(cyt))))->*
+ initialiser_->ForEachIn(context, $M($V(cys), $V(cyt)))->*
code_
))
);
namespace Syntax {
CYExpression *New::AddArgument(CYContext &context, CYExpression *value) {
- CYArgument **argument(&arguments_);
- while (*argument != NULL)
- argument = &(*argument)->next_;
- *argument = $ CYArgument(value);
+ CYSetLast(arguments_, $ CYArgument(value));
return this;
}
context_.scope_ = this;
}
+CYScope::~CYScope() {
+}
+
void CYScope::Close() {
context_.scope_ = parent_;
Scope(context_, statements_);