+CYProperty *CYProperty::ReplaceAll(CYContext &context, CYBuilder &builder, CYExpression *self, bool update) {
+ update |= name_->Computed();
+ if (update)
+ Replace(context, builder, self, true);
+ if (next_ != NULL)
+ next_ = next_->ReplaceAll(context, builder, self, update);
+ return update ? next_ : this;
+}
+
+void CYProperty::Replace(CYContext &context, CYBuilder &builder, CYExpression *self, bool computed) {
+ CYExpression *name(name_->PropertyName(context));
+ if (computed) {
+ CYIdentifier *unique(context.Unique());
+ builder.declarations_->*$L1($L(unique, name));
+ name = $V(unique);
+ }
+
+ Replace(context, builder, self, name);
+}
+
+void CYPropertyGetter::Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name) {
+ CYIdentifier *unique(context.Unique());
+ builder.declarations_
+ ->* $L1($L(unique, CYSuperize(context, $ CYFunctionExpression(NULL, parameters_, code_))));
+ builder.statements_
+ ->* $E($C3($M($V("Object"), $S("defineProperty")), self, name, $ CYObject(CYList<CYProperty>()
+ ->* $ CYPropertyValue($S("configurable"), $ CYTrue())
+ ->* $ CYPropertyValue($S("enumerable"), $ CYTrue())
+ ->* $ CYPropertyValue($S("get"), $V(unique))
+ )));
+}
+
+CYFunctionExpression *CYPropertyMethod::Constructor() {
+ return name_->Constructor() ? $ CYFunctionExpression(NULL, parameters_, code_) : NULL;
+}
+
+void CYPropertyMethod::Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name) {
+ CYIdentifier *unique(context.Unique());
+ builder.declarations_
+ ->* $L1($L(unique, CYSuperize(context, $ CYFunctionExpression(NULL, parameters_, code_))));
+ builder.statements_
+ ->* $E($ CYAssign($M(self, name), $V(unique)));
+}
+
+void CYPropertySetter::Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name) {
+ CYIdentifier *unique(context.Unique());
+ builder.declarations_
+ ->* $L1($L(unique, CYSuperize(context, $ CYFunctionExpression(NULL, parameters_, code_))));
+ builder.statements_
+ ->* $E($C3($M($V("Object"), $S("defineProperty")), self, name, $ CYObject(CYList<CYProperty>()
+ ->* $ CYPropertyValue($S("configurable"), $ CYTrue())
+ ->* $ CYPropertyValue($S("enumerable"), $ CYTrue())
+ ->* $ CYPropertyValue($S("set"), $V(unique))
+ )));
+}
+
+void CYPropertyValue::Replace(CYContext &context, CYBuilder &builder, CYExpression *self, CYExpression *name) {
+ CYIdentifier *unique(context.Unique());
+ builder.declarations_
+ ->* $L1($L(unique, value_));
+ builder.statements_
+ ->* $E($ CYAssign($M(self, name), $V(unique)));
+}
+
+void CYPropertyValue::Replace(CYContext &context) {
+ context.Replace(value_);
+}
+