X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/b026d13670db68f6121f78ed09bccfc78c661df9..972562bf68a236b4580b6074415cbf4e07b0a0c6:/Replace.cpp diff --git a/Replace.cpp b/Replace.cpp index e95f5e1..2cb4474 100644 --- a/Replace.cpp +++ b/Replace.cpp @@ -924,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() @@ -1259,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; }