CYScope scope(!localize, context);
+ $I("arguments")->Replace(context, CYIdentifierMagic);
+
parameters_->Replace(context, code_);
context.ReplaceAll(code_);
}
CYProperty *CYProperty::ReplaceAll(CYContext &context, CYBuilder &builder, CYExpression *self, bool update) {
- update |= name_->Computed();
+ update |= Update();
if (update)
Replace(context, builder, self, false);
if (next_ != NULL)
Replace(context, builder, self, name, protect);
}
+bool CYProperty::Update() const {
+ return name_->Computed();
+}
+
void CYPropertyGetter::Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect) {
CYIdentifier *unique(context.Unique());
builder.declarations_
CYDefineProperty(self, name, true, !protect, $ CYPropertyValue($S("value"), $V(unique), $ CYPropertyValue($S("writable"), $ CYTrue()))));
}
+bool CYPropertyMethod::Update() const {
+ return true;
+}
+
void CYPropertySetter::Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name, bool protect) {
CYIdentifier *unique(context.Unique());
builder.declarations_
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()
CYStatement *CYWith::Replace(CYContext &context) {
context.Replace(scope_);
+ CYScope scope(true, context);
+ scope.Damage();
context.ReplaceAll(code_);
+ scope.Close(context);
return this;
}