-/* Cycript - Remove Execution Server and Disassembler
+/* Cycript - Inlining/Optimizing JavaScript Compiler
* Copyright (C) 2009 Jay Freeman (saurik)
*/
next_->Replace(context);
}
+CYStatement *CYComment::Replace(CYContext &context) {
+ return NULL;
+}
+
CYExpression *CYCompound::Replace(CYContext &context) {
expressions_ = expressions_->ReplaceAll(context);
return NULL;
context.Replace(initialiser_);
}
+CYProperty *CYDeclarations::Property(CYContext &context) { $T(NULL)
+ return $ CYProperty(declaration_->identifier_, declaration_->initialiser_ ?: $U, next_->Property(context));
+}
+
void CYDeclarations::Replace(CYContext &context) { $T()
declaration_->Replace(context);
next_->Replace(context);
CYStatement *CYForEachIn::Replace(CYContext &context) {
CYVariable *cys($V("$cys")), *cyt($V("$cyt"));
- return $ CYWith($ CYObject($ CYProperty($S("$cys"), $D(0), $ CYProperty($S("$cyt"), $D(0)))), $ CYBlock($$->*
- $E($ CYAssign(cys, set_))->*
+ return $ CYLet($L2($L($I("$cys"), set_), $L($I("$cyt"))), $$->*
$ CYForIn(cyt, cys, $ CYBlock($$->*
$E($ CYAssign(initialiser_->ForEachIn(context), $M(cys, cyt)))->*
code_
))
- ));
+ );
}
CYFunctionParameter *CYForEachInComprehension::Parameter(CYContext &context) const {
return NULL;
}
+CYStatement *CYLet::Replace(CYContext &context) {
+ return $ CYWith($ CYObject(declarations_->Property(context)), &code_);
+}
+
void CYMember::Replace_(CYContext &context) {
context.Replace(object_);
context.Replace(property_);
memcpy(value, value_, size_);
memcpy(value + size_, rhs->value_, rhs->size_);
value[size] = '\0';
- return $S(value);
+ return $S(value, size);
}
CYNumber *CYString::Number(CYContext &context) {