-/* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2015 Jay Freeman (saurik)
+/* Cycript - The Truly Universal Scripting Language
+ * Copyright (C) 2009-2016 Jay Freeman (saurik)
*/
/* GNU Affero General Public License, Version 3 {{{ */
if (tail_->constructor_ == NULL)
tail_->constructor_ = $ CYFunctionExpression(NULL, NULL, NULL);
+ tail_->constructor_->name_ = name_;
tail_->constructor_ = CYSuperize(context, tail_->constructor_);
context.super_ = old;
return object_.Replace(context, lhs_);
}
-CYStatement *CYExternal::Replace(CYContext &context) {
- return $E($ CYAssign($V(typed_->identifier_), $C1(typed_->Replace(context), $C2($V("dlsym"), $V("RTLD_DEFAULT"), $S(typed_->identifier_->Word())))));
+CYStatement *CYExternalDefinition::Replace(CYContext &context) {
+ return $E($ CYAssign($V(typed_->identifier_), $ CYExternalExpression(abi_, typed_)));
+}
+
+CYTarget *CYExternalExpression::Replace(CYContext &context) {
+ return $C1(typed_->Replace(context), $C2($V("dlsym"), $V("RTLD_DEFAULT"), $S(typed_->identifier_->Word())));
}
CYNumber *CYFalse::Number(CYContext &context) {
return $ CYLexical(false, $B1($B(identifier, $ CYTypeExpression(typed_))));
}
+CYTarget *CYTypeEnum::Replace(CYContext &context) {
+ CYList<CYProperty> properties;
+ CYForEach (constant, constants_)
+ properties->*$ CYPropertyValue($S(constant->name_->Word()), constant->value_);
+ CYObject *constants($ CYObject(properties));
+
+ if (specifier_ == NULL)
+ return $N1($V("Type"), constants);
+ else
+ return $C1($M(specifier_->Replace(context), $S("enumFor")), constants);
+}
+
CYTarget *CYTypeError::Replace(CYContext &context) {
_assert(false);
return NULL;
return typed_->Replace(context);
}
+CYTarget *CYTypeInt128::Replace(CYContext &context) {
+ return $V(signing_ == CYTypeUnsigned ? "uint128" : "int128");
+}
+
CYTarget *CYTypeIntegral::Replace(CYContext &context) {
bool u(signing_ == CYTypeUnsigned);
switch (length_) {
}
CYTarget *CYTypeReference::Replace(CYContext &context) {
- return $V($pool.strcat(name_->Word(), "$cy", NULL));
+ const char *prefix;
+ switch (kind_) {
+ case CYTypeReferenceStruct: prefix = "$cys"; break;
+ case CYTypeReferenceEnum: prefix = "$cye"; break;
+ default: _assert(false);
+ }
+
+ return $V($pool.strcat(prefix, name_->Word(), NULL));
}
CYTarget *CYTypeStruct::Replace(CYContext &context) {