return this;
}
+CYTarget *CYAttemptMember::Replace(CYContext &context) {
+ CYIdentifier *value(context.Unique());
+
+ return $C1($F(NULL, $P1($B(value)), $$
+ ->* $ CYReturn($ CYCondition($V(value), $M($V(value), property_), $V(value)))
+ ), object_);
+}
+
CYStatement *CYBlock::Return() {
CYImplicitReturn(code_);
return this;
}
CYTarget *CYCall::Replace(CYContext &context) {
+ // XXX: this also is a horrible hack but I'm still a month over schedule :(
+ if (CYAttemptMember *member = dynamic_cast<CYAttemptMember *>(function_)) {
+ CYIdentifier *value(context.Unique());
+
+ return $C1($F(NULL, $P1($B(value)), $$
+ ->* $ CYReturn($ CYCondition($V(value), $C($M($V(value), member->property_), arguments_), $V(value)))
+ ), member->object_);
+ }
+
context.Replace(function_);
arguments_->Replace(context);
return this;
}
CYTarget *CYExternalExpression::Replace(CYContext &context) {
- return $C1(type_->Replace(context), $C2($V("dlsym"), $V("RTLD_DEFAULT"), name_->PropertyName(context)));
+ CYExpression *expression(name_->Number(context));
+ if (expression == NULL)
+ expression = $C2($V("dlsym"), $V("RTLD_DEFAULT"), name_->PropertyName(context));
+ return $C1(type_->Replace(context), expression);
}
CYNumber *CYFalse::Number(CYContext &context) {
return $C2($M($M($M($V("String"), $S("prototype")), $S("concat")), $S("apply")), $S(""), $ CYArray($ CYElementValue(string_, spans_->Replace(context))));
}
+CYString *CYTemplate::String(CYContext &context) {
+ // XXX: implement this over local concat
+ if (spans_ != NULL)
+ return NULL;
+ return string_;
+}
+
CYTarget *CYThis::Replace(CYContext &context) {
if (context.this_ != NULL)
return $V(context.this_->Identifier(context));
return typed_->Replace(context);
}
+CYTarget *CYTypeFloating::Replace(CYContext &context) {
+ switch (length_) {
+ case 0: return $V("float");
+ case 1: return $V("double");
+ case 2: return $V("longdouble");
+ default: _assert(false);
+ }
+}
+
CYTarget *CYTypeInt128::Replace(CYContext &context) {
return $V(signing_ == CYTypeUnsigned ? "uint128" : "int128");
}