code_->Single(out, CYRight(flags), CYCompactShort);
}
+void CYForInitialized::Output(CYOutput &out, CYFlags flags) const {
+ out << "for" << ' ' << '(' << "var" << ' ';
+ declaration_->Output(out, CYNoIn | CYNoRightHand);
+ out << ' ' << "in" << ' ' << *set_ << ')';
+ code_->Single(out, CYRight(flags), CYCompactShort);
+}
+
void CYForInComprehension::Output(CYOutput &out) const {
out << "for" << ' ' << '(';
declaration_->Output(out, CYNoIn | CYNoRightHand);
: "do" Statement "while" "(" Expression ")" TerminatorOpt { $$ = CYNew CYDoWhile($5, $2); }
| "while" "(" Expression ")" Statement { $$ = CYNew CYWhile($3, $5); }
| "for" "(" LexPushInOn ForStatementInitializer LexPopIn ExpressionOpt ";" ExpressionOpt ")" Statement { $$ = CYNew CYFor($4, $6, $8, $10); }
+ | "for" "(" LexPushInOn LexSetRegExp Var_ BindingIdentifier Initializer "!in" LexPopIn Expression ")" Statement { $$ = CYNew CYForInitialized(CYNew CYDeclaration($6, $7), $10, $12); }
| "for" "(" LexPushInOn ForInStatementInitializer "!in" LexPopIn Expression ")" Statement { $$ = CYNew CYForIn($4, $7, $9); }
| "for" "(" LexPushInOn ForInStatementInitializer "of" LexPopIn AssignmentExpression ")" Statement { $$ = CYNew CYForOf($4, $7, $9); }
;
return this;
}
+CYStatement *CYForInitialized::Replace(CYContext &context) {
+ CYAssignment *assignment(declaration_->Replace(context, CYIdentifierVariable));
+ return $ CYBlock($$
+ ->* (assignment == NULL ? NULL : $ CYExpress(assignment))
+ ->* $ CYForIn(declaration_->Target(context), set_, code_));
+}
+
CYFunctionParameter *CYForInComprehension::Parameter(CYContext &context) const {
return $ CYFunctionParameter(declaration_);
}
virtual void Output(CYOutput &out, CYFlags flags) const;
};
+struct CYForInitialized :
+ CYStatement
+{
+ CYDeclaration *declaration_;
+ CYExpression *set_;
+ CYStatement *code_;
+
+ CYForInitialized(CYDeclaration *declaration, CYExpression *set, CYStatement *code) :
+ declaration_(declaration),
+ set_(set),
+ code_(code)
+ {
+ }
+
+ CYCompact(Long)
+
+ virtual CYStatement *Replace(CYContext &context);
+ virtual void Output(CYOutput &out, CYFlags flags) const;
+};
+
struct CYForOf :
CYStatement
{