X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/7b87d2051f4c0c29515b30b1202a23a52e2d5f9e..972562bf68a236b4580b6074415cbf4e07b0a0c6:/Replace.cpp?ds=inline diff --git a/Replace.cpp b/Replace.cpp index c78f380..2cb4474 100644 --- a/Replace.cpp +++ b/Replace.cpp @@ -533,6 +533,8 @@ void CYFunction::Replace(CYContext &context) { CYScope scope(!localize, context); + $I("arguments")->Replace(context, CYIdentifierMagic); + parameters_->Replace(context, code_); context.ReplaceAll(code_); @@ -922,19 +924,9 @@ CYIdentifierFlags *CYScope::Declare(CYContext &context, CYIdentifier *identifier if (existing == NULL) return internal_; - switch (kind) { - case CYIdentifierArgument: - case CYIdentifierCatch: - case CYIdentifierMagic: - _assert(false); - default: - break; - } - - if (existing->kind_ == CYIdentifierGlobal) + if (kind == CYIdentifierGlobal); + else if (existing->kind_ == CYIdentifierGlobal || existing->kind_ == CYIdentifierMagic) existing->kind_ = kind; - else if (kind == CYIdentifierGlobal) - ; else if (existing->kind_ == CYIdentifierLexical || kind == CYIdentifierLexical) _assert(false); // XXX: throw new SyntaxError() @@ -1257,7 +1249,10 @@ CYStatement *CYWhile::Replace(CYContext &context) { CYStatement *CYWith::Replace(CYContext &context) { context.Replace(scope_); + CYScope scope(true, context); + scope.Damage(); context.ReplaceAll(code_); + scope.Close(context); return this; }