X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/5a6c975adbe2588a10190cba75e9152682bedeae..591b913e87ed5a373f1b006035a5f02fd71c4c36:/Replace.cpp diff --git a/Replace.cpp b/Replace.cpp index ca05d08..ed486f7 100644 --- a/Replace.cpp +++ b/Replace.cpp @@ -878,6 +878,10 @@ void CYScript::Replace(CYContext &context) { } } +CYTarget *CYResolveMember::Replace(CYContext &context) { + return $M($M(object_, $S("$cyr")), property_); +} + CYStatement *CYReturn::Replace(CYContext &context) { if (context.nonlocal_ != NULL) { CYProperty *value(value_ == NULL ? NULL : $ CYPropertyValue($S("$cyv"), value_)); @@ -1122,6 +1126,10 @@ CYTarget *CYSuperCall::Replace(CYContext &context) { return $C($C1($M($V(context.super_), $S("bind")), $ CYThis()), arguments_); } +CYTarget *CYSymbol::Replace(CYContext &context) { + return $C1($M($V("Symbol"), $S("for")), $S(name_)); +} + CYStatement *CYSwitch::Replace(CYContext &context) { context.Replace(value_); clauses_->Replace(context); @@ -1233,7 +1241,10 @@ CYTarget *CYTypeModifier::Replace(CYContext &context, CYTarget *type) { $T(type) } CYTarget *CYTypeFunctionWith::Replace_(CYContext &context, CYTarget *type) { - return next_->Replace(context, $ CYCall($ CYDirectMember(type, $ CYString("functionWith")), parameters_->Argument(context))); + CYList arguments(parameters_->Argument(context)); + if (variadic_) + arguments->*$C_($ CYNull()); + return next_->Replace(context, $ CYCall($ CYDirectMember(type, $ CYString("functionWith")), arguments)); } CYTarget *CYTypePointerTo::Replace_(CYContext &context, CYTarget *type) { @@ -1268,15 +1279,15 @@ CYTarget *CYTypedIdentifier::Replace(CYContext &context) { } CYTypeFunctionWith *CYTypedIdentifier::Function() { - CYTypeModifier **modifier(&modifier_); - if (*modifier == NULL) + CYTypeModifier *&modifier(CYGetLast(modifier_)); + if (modifier == NULL) return NULL; - while ((*modifier)->next_ != NULL) - modifier = &(*modifier)->next_; - CYTypeFunctionWith *function((*modifier)->Function()); + + CYTypeFunctionWith *function(modifier->Function()); if (function == NULL) return NULL; - *modifier = NULL; + + modifier = NULL; return function; }