return $ CYBlock(statements);
}
-static CYTypedIdentifier *CYDecodeType(CXType type);
-static void CYParseType(CXType type, CYTypedIdentifier *typed);
+static CYType *CYDecodeType(CXType type);
+static void CYParseType(CXType type, CYType *typed);
-static CYTypedIdentifier *CYDecodeType(CXType type, const CYCXString &identifier) {
- CYTypedIdentifier *typed(CYDecodeType(type));
- typed->identifier_ = $ CYIdentifier(identifier.Pool($pool));
- return typed;
-}
-
-static void CYParseEnumeration(CXCursor cursor, CYTypedIdentifier *typed) {
+static void CYParseEnumeration(CXCursor cursor, CYType *typed) {
CYList<CYEnumConstant> constants;
CYForChild(cursor, fun([&](CXCursor child) {
constants->*$ CYEnumConstant($I($pool.strdup(CYCXString(child))), $D(clang_getEnumConstantDeclValue(child)));
}));
- CYTypedIdentifier *integer(CYDecodeType(clang_getEnumDeclIntegerType(cursor)));
+ CYType *integer(CYDecodeType(clang_getEnumDeclIntegerType(cursor)));
typed->specifier_ = $ CYTypeEnum(NULL, integer->specifier_, constants);
}
-static void CYParseStructure(CXCursor cursor, CYTypedIdentifier *typed) {
+static void CYParseStructure(CXCursor cursor, CYType *typed) {
CYList<CYTypeStructField> fields;
CYForChild(cursor, fun([&](CXCursor child) {
- if (clang_getCursorKind(child) == CXCursor_FieldDecl) {
- CYTypedIdentifier *field(CYDecodeType(clang_getCursorType(child), child));
- fields->*$ CYTypeStructField(field);
- }
+ if (clang_getCursorKind(child) == CXCursor_FieldDecl)
+ fields->*$ CYTypeStructField(CYDecodeType(clang_getCursorType(child)), $I(CYCXString(child).Pool($pool)));
}));
typed->specifier_ = $ CYTypeStruct(NULL, $ CYStructTail(fields));
}
-static void CYParseCursor(CXType type, CXCursor cursor, CYTypedIdentifier *typed) {
+static void CYParseCursor(CXType type, CXCursor cursor, CYType *typed) {
CYCXString spelling(cursor);
switch (CXCursorKind kind = clang_getCursorKind(cursor)) {
}
}
-static CYTypedParameter *CYParseSignature(CXType type, CYTypedIdentifier *typed) {
+static CYTypedParameter *CYParseSignature(CXType type, CYType *typed) {
CYParseType(clang_getResultType(type), typed);
CYList<CYTypedParameter> parameters;
for (int i(0), e(clang_getNumArgTypes(type)); i != e; ++i)
- parameters->*$ CYTypedParameter(CYDecodeType(clang_getArgType(type, i)));
+ parameters->*$ CYTypedParameter(CYDecodeType(clang_getArgType(type, i)), NULL);
return parameters;
}
-static void CYParseFunction(CXType type, CYTypedIdentifier *typed) {
+static void CYParseFunction(CXType type, CYType *typed) {
typed = typed->Modify($ CYTypeFunctionWith(clang_isFunctionTypeVariadic(type), CYParseSignature(type, typed)));
}
-static void CYParseType(CXType type, CYTypedIdentifier *typed) {
+static void CYParseType(CXType type, CYType *typed) {
switch (CXTypeKind kind = type.kind) {
case CXType_Unexposed: {
CXType result(clang_getResultType(type));
typed = typed->Modify($ CYTypeConstant());
}
-static CYTypedIdentifier *CYDecodeType(CXType type) {
- CYTypedIdentifier *typed($ CYTypedIdentifier(NULL));
+static CYType *CYDecodeType(CXType type) {
+ CYType *typed($ CYType(NULL));
CYParseType(type, typed);
return typed;
}
CYLocalPool pool;
- CYTypedIdentifier typed(NULL);
+ CYType typed;
CYParseEnumeration(cursor, &typed);
CYOptions options;
CYLocalPool pool;
- CYTypedIdentifier typed(NULL);
+ CYType typed;
CYParseStructure(cursor, &typed);
CYOptions options;
case CXCursor_TypedefDecl: {
CYLocalPool local;
- CYTypedIdentifier *typed(CYDecodeType(clang_getTypedefDeclUnderlyingType(cursor)));
+ CYType *typed(CYDecodeType(clang_getTypedefDeclUnderlyingType(cursor)));
if (typed->specifier_ == NULL)
value << "(typedef " << CYCXString(clang_getTypeSpelling(clang_getTypedefDeclUnderlyingType(cursor))) << ")";
else {
namespace sig {
template <>
-CYTypedIdentifier *Primitive<bool>::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeVariable("bool"));
+CYType *Primitive<bool>::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeVariable("bool"));
}
template <>
-CYTypedIdentifier *Primitive<char>::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeCharacter(CYTypeNeutral));
+CYType *Primitive<char>::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeCharacter(CYTypeNeutral));
}
template <>
-CYTypedIdentifier *Primitive<double>::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeVariable("double"));
+CYType *Primitive<double>::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeVariable("double"));
}
template <>
-CYTypedIdentifier *Primitive<float>::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeVariable("float"));
+CYType *Primitive<float>::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeVariable("float"));
}
template <>
-CYTypedIdentifier *Primitive<signed char>::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeCharacter(CYTypeSigned));
+CYType *Primitive<signed char>::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeCharacter(CYTypeSigned));
}
template <>
-CYTypedIdentifier *Primitive<signed int>::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeIntegral(CYTypeSigned, 1));
+CYType *Primitive<signed int>::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeIntegral(CYTypeSigned, 1));
}
#ifdef __SIZEOF_INT128__
template <>
-CYTypedIdentifier *Primitive<signed __int128>::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeInt128(CYTypeSigned));
+CYType *Primitive<signed __int128>::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeInt128(CYTypeSigned));
}
#endif
template <>
-CYTypedIdentifier *Primitive<signed long int>::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeIntegral(CYTypeSigned, 2));
+CYType *Primitive<signed long int>::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeIntegral(CYTypeSigned, 2));
}
template <>
-CYTypedIdentifier *Primitive<signed long long int>::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeIntegral(CYTypeSigned, 3));
+CYType *Primitive<signed long long int>::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeIntegral(CYTypeSigned, 3));
}
template <>
-CYTypedIdentifier *Primitive<signed short int>::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeIntegral(CYTypeSigned, 0));
+CYType *Primitive<signed short int>::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeIntegral(CYTypeSigned, 0));
}
template <>
-CYTypedIdentifier *Primitive<unsigned char>::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeCharacter(CYTypeUnsigned));
+CYType *Primitive<unsigned char>::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeCharacter(CYTypeUnsigned));
}
template <>
-CYTypedIdentifier *Primitive<unsigned int>::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeIntegral(CYTypeUnsigned, 1));
+CYType *Primitive<unsigned int>::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeIntegral(CYTypeUnsigned, 1));
}
#ifdef __SIZEOF_INT128__
template <>
-CYTypedIdentifier *Primitive<unsigned __int128>::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeInt128(CYTypeUnsigned));
+CYType *Primitive<unsigned __int128>::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeInt128(CYTypeUnsigned));
}
#endif
template <>
-CYTypedIdentifier *Primitive<unsigned long int>::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeIntegral(CYTypeUnsigned, 2));
+CYType *Primitive<unsigned long int>::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeIntegral(CYTypeUnsigned, 2));
}
template <>
-CYTypedIdentifier *Primitive<unsigned long long int>::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeIntegral(CYTypeUnsigned, 3));
+CYType *Primitive<unsigned long long int>::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeIntegral(CYTypeUnsigned, 3));
}
template <>
-CYTypedIdentifier *Primitive<unsigned short int>::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeIntegral(CYTypeUnsigned, 0));
+CYType *Primitive<unsigned short int>::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeIntegral(CYTypeUnsigned, 0));
}
-CYTypedIdentifier *Void::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeVoid());
+CYType *Void::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeVoid());
}
-CYTypedIdentifier *Unknown::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeError());
+CYType *Unknown::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeError());
}
-CYTypedIdentifier *String::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeCharacter(CYTypeNeutral), $ CYTypePointerTo());
+CYType *String::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeCharacter(CYTypeNeutral), $ CYTypePointerTo());
}
#ifdef CY_OBJECTIVEC
-CYTypedIdentifier *Meta::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeVariable("Class"));
+CYType *Meta::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeVariable("Class"));
}
-CYTypedIdentifier *Selector::Decode(CYPool &pool) const {
- return $ CYTypedIdentifier($ CYTypeVariable("SEL"));
+CYType *Selector::Decode(CYPool &pool) const {
+ return $ CYType($ CYTypeVariable("SEL"));
}
#endif
-CYTypedIdentifier *Bits::Decode(CYPool &pool) const {
+CYType *Bits::Decode(CYPool &pool) const {
_assert(false);
}
-CYTypedIdentifier *Pointer::Decode(CYPool &pool) const {
+CYType *Pointer::Decode(CYPool &pool) const {
return CYDecodeType(pool, &type)->Modify($ CYTypePointerTo());
}
-CYTypedIdentifier *Array::Decode(CYPool &pool) const {
+CYType *Array::Decode(CYPool &pool) const {
return CYDecodeType(pool, &type)->Modify($ CYTypeArrayOf($D(size)));
}
#ifdef CY_OBJECTIVEC
-CYTypedIdentifier *Object::Decode(CYPool &pool) const {
+CYType *Object::Decode(CYPool &pool) const {
if (name == NULL)
- return $ CYTypedIdentifier($ CYTypeVariable("id"));
+ return $ CYType($ CYTypeVariable("id"));
else
- return $ CYTypedIdentifier($ CYTypeVariable(name), $ CYTypePointerTo());
+ return $ CYType($ CYTypeVariable(name), $ CYTypePointerTo());
}
#endif
-CYTypedIdentifier *Enum::Decode(CYPool &pool) const {
+CYType *Enum::Decode(CYPool &pool) const {
CYEnumConstant *values(NULL);
for (size_t i(count); i != 0; --i)
values = $ CYEnumConstant($I(pool.strdup(constants[i - 1].name)), $D(constants[i - 1].value), values);
CYIdentifier *identifier(name == NULL ? NULL : $I(name));
- CYTypedIdentifier *typed(type.Decode(pool));
+ CYType *typed(type.Decode(pool));
_assert(typed->modifier_ == NULL);
- return $ CYTypedIdentifier($ CYTypeEnum(identifier, typed->specifier_, values));
+ return $ CYType($ CYTypeEnum(identifier, typed->specifier_, values));
}
-CYTypedIdentifier *Aggregate::Decode(CYPool &pool) const {
+CYType *Aggregate::Decode(CYPool &pool) const {
_assert(!overlap);
if (signature.count == _not(size_t)) {
_assert(name != NULL);
- return $ CYTypedIdentifier($ CYTypeReference(CYTypeReferenceStruct, $I($pool.strdup(name))));
+ return $ CYType($ CYTypeReference(CYTypeReferenceStruct, $I($pool.strdup(name))));
}
CYTypeStructField *fields(NULL);
for (size_t i(signature.count); i != 0; --i) {
sig::Element &element(signature.elements[i - 1]);
- CYTypedIdentifier *typed(CYDecodeType(pool, element.type));
- if (element.name != NULL)
- typed->identifier_ = $I(element.name);
- fields = $ CYTypeStructField(typed, fields);
+ fields = $ CYTypeStructField(CYDecodeType(pool, element.type), element.name == NULL ? NULL : $I(element.name), fields);
}
CYIdentifier *identifier(name == NULL ? NULL : $I(name));
- return $ CYTypedIdentifier($ CYTypeStruct(identifier, $ CYStructTail(fields)));
+ return $ CYType($ CYTypeStruct(identifier, $ CYStructTail(fields)));
}
-CYTypedIdentifier *Callable::Decode(CYPool &pool) const {
+CYType *Callable::Decode(CYPool &pool) const {
_assert(signature.count != 0);
CYTypedParameter *parameters(NULL);
for (size_t i(signature.count - 1); i != 0; --i)
- parameters = $ CYTypedParameter(CYDecodeType(pool, signature.elements[i].type), parameters);
+ parameters = $ CYTypedParameter(CYDecodeType(pool, signature.elements[i].type), NULL, parameters);
return Modify(pool, CYDecodeType(pool, signature.elements[0].type), parameters);
}
-CYTypedIdentifier *Function::Modify(CYPool &pool, CYTypedIdentifier *result, CYTypedParameter *parameters) const {
+CYType *Function::Modify(CYPool &pool, CYType *result, CYTypedParameter *parameters) const {
return result->Modify($ CYTypeFunctionWith(variadic, parameters));
}
#ifdef CY_OBJECTIVEC
-CYTypedIdentifier *Block::Modify(CYPool &pool, CYTypedIdentifier *result, CYTypedParameter *parameters) const {
+CYType *Block::Modify(CYPool &pool, CYType *result, CYTypedParameter *parameters) const {
return result->Modify($ CYTypeBlockWith(parameters));
}
-CYTypedIdentifier *Block::Decode(CYPool &pool) const {
+CYType *Block::Decode(CYPool &pool) const {
if (signature.count == 0)
- return $ CYTypedIdentifier($ CYTypeVariable("NSBlock"), $ CYTypePointerTo());
+ return $ CYType($ CYTypeVariable("NSBlock"), $ CYTypePointerTo());
return Callable::Decode(pool);
}
#endif
}
-CYTypedIdentifier *CYDecodeType(CYPool &pool, struct sig::Type *type) {
- CYTypedIdentifier *typed(type->Decode(pool));
+CYType *CYDecodeType(CYPool &pool, struct sig::Type *type) {
+ CYType *typed(type->Decode(pool));
if ((type->flags & JOC_TYPE_CONST) != 0) {
if (dynamic_cast<sig::String *>(type) != NULL)
typed->modifier_ = $ CYTypeConstant(typed->modifier_);
#include "Syntax.hpp"
-CYTypedIdentifier *CYDecodeType(CYPool &pool, struct sig::Type *type);
+CYType *CYDecodeType(CYPool &pool, struct sig::Type *type);
#endif//DECODE_HPP
sig::Function function(internal->variadic_);
sig::Copy(pool, function.signature, internal->signature_);
+ CYString *name;
+
auto typed(CYDecodeType(pool, &function)); {
std::ostringstream str;
Dl_info info;
str << "+0x" << std::hex << offset;
}
- typed->identifier_ = new(pool) CYIdentifier(pool.strdup(str.str().c_str()));
+ name = new(pool) CYString(pool.strdup(str.str().c_str()));
}
std::ostringstream str;
CYOptions options;
CYOutput output(*str.rdbuf(), options);
output.pretty_ = true;
- (new(pool) CYExternalExpression(new(pool) CYString("C"), typed))->Output(output, CYNoFlags);
+ (new(pool) CYExternalExpression(new(pool) CYString("C"), typed, name))->Output(output, CYNoFlags);
return CYCastJSValue(context, CYJSString(str.str()));
} CYCatch(NULL) }
return [super cy$toCYON:objective inSet:objects];
_oassert(objects.insert(self).second);
- CYTypedIdentifier *typed((new(pool) CYTypeExpression(CYDecodeType(pool, &type)))->typed_);
+ CYType *typed((new(pool) CYTypeExpression(CYDecodeType(pool, &type)))->typed_);
CYTypeModifier *&modifier(CYGetLast(typed->modifier_));
CYTypeBlockWith *with(dynamic_cast<CYTypeBlockWith *>(modifier));
_assert(with != NULL);
}
void CYImplementationField::Output(CYOutput &out) const {
- out << *typed_;
+ type_->Output(out, name_);
out.Terminate();
out << '\n';
}
CYForEach (parameter, parameters_)
if (parameter->name_ != NULL) {
out << ' ' << *parameter->name_;
- if (parameter->type_ != NULL)
- out << ':' << *parameter->type_->identifier_;
+ // XXX: this is off somehow
+ if (parameter->identifier_ != NULL) {
+ out << ':';
+ if (parameter->type_ != NULL)
+ out << '(' << *parameter->type_ << ')';
+ out << *parameter->identifier_;
+ }
}
out << code_;
out << ',' << ' ';
else
comma = true;
- out << *parameter->typed_;
+ parameter->type_->Output(out, parameter->name_);
}
out << ')' << ' ' << '{' << '\n';
#include "ObjectiveC/Syntax.hpp"
-static CYExpression *MessageType(CYContext &context, CYTypedIdentifier *type, CYMessageParameter *next, CYExpression *extra = NULL) {
+static CYExpression *MessageType(CYContext &context, CYType *type, CYMessageParameter *next, CYExpression *extra = NULL) {
CYExpression *left($C0($M(type->Replace(context), $S("toString"))));
if (extra != NULL)
left = $ CYAdd(left, extra);
CYVariable *cyn($V("$cyn"));
CYVariable *cyt($V("$cyt"));
- CYExpression *type($C0($M(typed_->Replace(context), $S("toString"))));
+ CYExpression *type($C0($M(type_->Replace(context), $S("toString"))));
return $ CYBlock($$->*
$E($ CYAssign(cyt, type))->*
$E($ CYAssign(cyn, $N1($V("Type"), cyt)))->*
- $E($C5($V("class_addIvar"), $V("$cyc"), $S(typed_->identifier_->Word()), $M(cyn, $S("size")), $M(cyn, $S("alignment")), cyt))->*
+ $E($C5($V("class_addIvar"), $V("$cyc"), name_->PropertyName(context), $M(cyn, $S("size")), $M(cyn, $S("alignment")), cyt))->*
next_->Replace(context)
);
}
CYFunctionParameter *CYMessageParameter::Parameters(CYContext &context) const { $T(NULL)
CYFunctionParameter *next(next_->Parameters(context));
- return type_ == NULL ? next : $ CYFunctionParameter($B(type_->identifier_), next);
+ return type_ == NULL ? next : $ CYFunctionParameter($B(identifier_), next);
}
CYSelector *CYMessageParameter::Selector(CYContext &context) const {
}
CYTarget *CYObjCBlock::Replace(CYContext &context) {
- return $C1($ CYTypeExpression(($ CYTypedIdentifier(*typed_))->Modify($ CYTypeBlockWith(parameters_))), $ CYFunctionExpression(NULL, parameters_->Parameters(context), code_));
+ // XXX: wtf is happening here?
+ return $C1($ CYTypeExpression(($ CYType(*typed_))->Modify($ CYTypeBlockWith(parameters_))), $ CYFunctionExpression(NULL, parameters_->Parameters(context), code_));
}
CYStatement *CYProtocol::Replace(CYContext &context) const { $T(NULL)
struct CYObjCBlock :
CYTarget
{
- CYTypedIdentifier *typed_;
+ CYType *typed_;
CYTypedParameter *parameters_;
CYStatement *code_;
- CYObjCBlock(CYTypedIdentifier *typed, CYTypedParameter *parameters, CYStatement *code) :
+ CYObjCBlock(CYType *typed, CYTypedParameter *parameters, CYStatement *code) :
typed_(typed),
parameters_(parameters),
code_(code)
struct CYImplementationField :
CYNext<CYImplementationField>
{
- CYTypedIdentifier *typed_;
+ CYType *type_;
+ CYPropertyName *name_;
- CYImplementationField(CYTypedIdentifier *typed, CYImplementationField *next = NULL) :
+ CYImplementationField(CYType *type, CYPropertyName *name, CYImplementationField *next = NULL) :
CYNext<CYImplementationField>(next),
- typed_(typed)
+ type_(type),
+ name_(name)
{
}
CYNext<CYMessageParameter>
{
CYWord *name_;
- CYTypedIdentifier *type_;
+ CYType *type_;
+ CYIdentifier *identifier_;
- CYMessageParameter(CYWord *name, CYTypedIdentifier *type, CYMessageParameter *next = NULL) :
+ CYMessageParameter(CYWord *name, CYType *type = NULL, CYIdentifier *identifier = NULL, CYMessageParameter *next = NULL) :
CYNext<CYMessageParameter>(next),
name_(name),
- type_(type)
+ type_(type),
+ identifier_(identifier)
{
}
CYNext<CYMessage>
{
bool instance_;
- CYTypedIdentifier *type_;
+ CYType *type_;
CYMessageParameter *parameters_;
CYBlock code_;
- CYMessage(bool instance, CYTypedIdentifier *type, CYMessageParameter *parameters, CYStatement *code) :
+ CYMessage(bool instance, CYType *type, CYMessageParameter *parameters, CYStatement *code) :
instance_(instance),
type_(type),
parameters_(parameters),
}
void CYExternalDefinition::Output(CYOutput &out, CYFlags flags) const {
- out << "extern" << ' ' << abi_ << ' ' << typed_;
+ out << "extern" << ' ' << abi_ << ' ';
+ type_->Output(out, name_);
out.Terminate();
}
void CYExternalExpression::Output(CYOutput &out, CYFlags flags) const {
- out << '(' << "extern" << ' ' << abi_ << ' ' << typed_ << ')';
+ out << '(' << "extern" << ' ' << abi_ << ' ';
+ type_->Output(out, name_);
+ out << ')';
}
void CYFatArrow::Output(CYOutput &out, CYFlags flags) const {
_assert(false);
}
-void CYTypeArrayOf::Output(CYOutput &out, CYIdentifier *identifier) const {
- next_->Output(out, Precedence(), identifier, false);
+void CYTypeArrayOf::Output(CYOutput &out, CYPropertyName *name) const {
+ next_->Output(out, Precedence(), name, false);
out << '[';
out << size_;
out << ']';
}
-void CYTypeBlockWith::Output(CYOutput &out, CYIdentifier *identifier) const {
+void CYTypeBlockWith::Output(CYOutput &out, CYPropertyName *name) const {
out << '(' << '^';
- next_->Output(out, Precedence(), identifier, false);
+ next_->Output(out, Precedence(), name, false);
out << ')' << '(' << parameters_ << ')';
}
-void CYTypeConstant::Output(CYOutput &out, CYIdentifier *identifier) const {
+void CYTypeConstant::Output(CYOutput &out, CYPropertyName *name) const {
out << "const";
- next_->Output(out, Precedence(), identifier, false);
+ next_->Output(out, Precedence(), name, false);
}
-void CYTypeFunctionWith::Output(CYOutput &out, CYIdentifier *identifier) const {
- next_->Output(out, Precedence(), identifier, false);
+void CYTypeFunctionWith::Output(CYOutput &out, CYPropertyName *name) const {
+ next_->Output(out, Precedence(), name, false);
out << '(' << parameters_;
if (variadic_) {
if (parameters_ != NULL)
out << ')';
}
-void CYTypePointerTo::Output(CYOutput &out, CYIdentifier *identifier) const {
+void CYTypePointerTo::Output(CYOutput &out, CYPropertyName *name) const {
out << '*';
- next_->Output(out, Precedence(), identifier, false);
+ next_->Output(out, Precedence(), name, false);
}
-void CYTypeVolatile::Output(CYOutput &out, CYIdentifier *identifier) const {
+void CYTypeVolatile::Output(CYOutput &out, CYPropertyName *name) const {
out << "volatile";
- next_->Output(out, Precedence(), identifier, true);
+ next_->Output(out, Precedence(), name, true);
}
-void CYTypeModifier::Output(CYOutput &out, int precedence, CYIdentifier *identifier, bool space) const {
- if (this == NULL && identifier == NULL)
+void CYTypeModifier::Output(CYOutput &out, int precedence, CYPropertyName *name, bool space) const {
+ if (this == NULL && name == NULL)
return;
else if (space)
out << ' ';
if (this == NULL) {
- out << identifier;
+ name->PropertyName(out);
return;
}
if (protect)
out << '(';
- Output(out, identifier);
+ Output(out, name);
if (protect)
out << ')';
}
-void CYTypedIdentifier::Output(CYOutput &out) const {
+void CYType::Output(CYOutput &out, CYPropertyName *name) const {
out << *specifier_;
- modifier_->Output(out, 0, identifier_, true);
+ modifier_->Output(out, 0, name, true);
+}
+
+void CYType::Output(CYOutput &out) const {
+ Output(out, NULL);
}
void CYEncodedType::Output(CYOutput &out, CYFlags flags) const {
}
void CYTypedParameter::Output(CYOutput &out) const {
- out << typed_;
+ type_->Output(out, name_);
if (next_ != NULL)
out << ',' << ' ' << next_;
}
}
void CYTypeDefinition::Output(CYOutput &out, CYFlags flags) const {
- out << "typedef" << ' ' << *typed_;
+ out << "typedef" << ' ';
+ type_->Output(out, name_);
out.Terminate();
}
out << ' ' << '{' << '\n';
++out.indent_;
CYForEach (field, fields_) {
- out << '\t' << *field->typed_;
+ out << '\t';
+ field->type_->Output(out, field->name_);
out.Terminate();
out << '\n';
}
%union { CYTypeModifier *modifier_; }
%union { CYTypeSpecifier *specifier_; }
%union { CYTypedFormal *typedFormal_; }
-%union { CYTypedIdentifier *typedIdentifier_; }
+%union { CYTypedLocation *typedLocation_; }
+%union { CYTypedName *typedName_; }
%union { CYTypedParameter *typedParameter_; }
+%union { CYType *typedThing_; }
@end
@begin ObjectiveC
%type <number_> IntegerNumber
%type <integral_> IntegerType
%type <integral_> IntegerTypeOpt
-%type <typedIdentifier_> PrefixedType
+%type <typedName_> PrefixedType
%type <specifier_> PrimitiveReference
%type <specifier_> PrimitiveType
%type <structField_> StructFieldListOpt
-%type <typedIdentifier_> SuffixedType
-%type <typedIdentifier_> SuffixedTypeOpt
-%type <typedIdentifier_> TypeSignifier
-%type <typedIdentifier_> TypeSignifierNone
-%type <typedIdentifier_> TypeSignifierOpt
+%type <typedName_> SuffixedType
+%type <typedName_> SuffixedTypeOpt
+%type <typedName_> TypeSignifier
+%type <typedName_> TypeSignifierNone
+%type <typedName_> TypeSignifierOpt
%type <signing_> TypeSigning
%type <modifier_> ParameterTail
%type <modifier_> TypeQualifierLeft
%type <modifier_> TypeQualifierLeftOpt
-%type <typedIdentifier_> TypeQualifierRight
-%type <typedIdentifier_> TypeQualifierRightOpt
-%type <typedIdentifier_> TypedIdentifierDefinition
-%type <typedIdentifier_> TypedIdentifierEncoding
-%type <typedIdentifier_> TypedIdentifierField
-%type <typedIdentifier_> TypedIdentifierMaybe
-%type <typedIdentifier_> TypedIdentifierNo
-%type <typedIdentifier_> TypedIdentifierTagged
-%type <typedIdentifier_> TypedIdentifierYes
+%type <typedName_> TypeQualifierRight
+%type <typedName_> TypeQualifierRightOpt
+%type <typedName_> TypedIdentifierDefinition
+%type <typedThing_> TypedIdentifierEncoding
+%type <typedName_> TypedIdentifierField
+%type <typedName_> TypedIdentifierMaybe
+%type <typedLocation_> TypedIdentifierNo
+%type <typedName_> TypedIdentifierTagged
+%type <typedName_> TypedIdentifierYes
%type <typedFormal_> TypedParameterList_
%type <typedFormal_> TypedParameterList
%type <typedFormal_> TypedParameterListOpt
%type <selector_> SelectorExpressionOpt
%type <argument_> SelectorList
%type <word_> SelectorWordOpt
-%type <typedIdentifier_> TypeOpt
+%type <typedThing_> TypeOpt
%type <argument_> VariadicCall
@end
@begin C
/* Cycript (C): Type Encoding {{{ */
TypeSignifier
- : IdentifierType[identifier] { $$ = CYNew CYTypedIdentifier(@identifier, $identifier); }
+ : IdentifierType[name] { $$ = CYNew CYTypedName(@name, $name); }
+ | StringLiteral[name] { $$ = CYNew CYTypedName(@name, $name); }
| "(" "*" TypeQualifierRightOpt[typed] ")" { $$ = $typed; $$->modifier_ = CYNew CYTypePointerTo($$->modifier_); }
;
TypeSignifierNone
- : { $$ = CYNew CYTypedIdentifier(@$); }
+ : { $$ = CYNew CYTypedName(@$); }
;
TypeSignifierOpt
: SuffixedTypeOpt[typed] "[" RestrictOpt NumericLiteral[size] "]" { $$ = $typed; $$->modifier_ = CYNew CYTypeArrayOf($size, $$->modifier_); }
| "(" "^" TypeQualifierRightOpt[typed] ")" "(" TypedParameters[parameters] ")" { $$ = $typed; $$->modifier_ = CYNew CYTypeBlockWith($parameters, $$->modifier_); }
| TypeSignifier[typed] "(" ParameterTail[modifier] { $$ = $typed; CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
- | "("[parenthesis] ParameterTail[modifier] { $$ = CYNew CYTypedIdentifier(@parenthesis); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
+ | "("[parenthesis] ParameterTail[modifier] { $$ = CYNew CYTypedName(@parenthesis); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
;
SuffixedTypeOpt
;
StructFieldListOpt
- : TypedIdentifierField[typed] ";" StructFieldListOpt[next] { $$ = CYNew CYTypeStructField($typed, $next); }
+ : TypedIdentifierField[typed] ";" StructFieldListOpt[next] { $$ = CYNew CYTypeStructField($typed, $typed->name_, $next); }
| { $$ = NULL; }
;
;
TypedIdentifierYes
- : TypedIdentifierMaybe[typed] { if ($typed->identifier_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; }
+ : TypedIdentifierMaybe[typed] { if ($typed->name_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; }
;
TypedIdentifierNo
- : TypedIdentifierMaybe[typed] { if ($typed->identifier_ != NULL) CYERR($typed->location_, "unexpected identifier"); $$ = $typed; }
+ : TypedIdentifierMaybe[typed] { if ($typed->name_ != NULL) CYERR($typed->location_, "unexpected identifier"); $$ = $typed; }
;
TypedIdentifierTagged
TypedIdentifierField
: TypedIdentifierYes[pass] { $$ = $pass; }
- | TypedIdentifierTagged[typed] { if ($typed->identifier_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; }
+ | TypedIdentifierTagged[typed] { if ($typed->name_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; }
;
TypedIdentifierEncoding
: TypedIdentifierNo[pass] { $$ = $pass; }
- | TypedIdentifierTagged[typed] { if ($typed->identifier_ != NULL) CYERR($typed->location_, "unexpected identifier"); $$ = $typed; }
+ | TypedIdentifierTagged[typed] { if ($typed->name_ != NULL) CYERR($typed->location_, "unexpected identifier"); $$ = $typed; }
| "void" TypeSignifierNone[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
;
TypedIdentifierDefinition
: TypedIdentifierYes[pass] { $$ = $pass; }
- | TypeQualifierLeftOpt[modifier] "struct" IdentifierTypeOpt[name] "{" StructFieldListOpt[fields] "}" TypeQualifierRightOpt[typed] { if ($typed->identifier_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; $$->specifier_ = CYNew CYTypeStruct($name, CYNew CYStructTail($fields)); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
+ | TypeQualifierLeftOpt[modifier] "struct" IdentifierTypeOpt[name] "{" StructFieldListOpt[fields] "}" TypeQualifierRightOpt[typed] { if ($typed->name_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; $$->specifier_ = CYNew CYTypeStruct($name, CYNew CYStructTail($fields)); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
| "void" TypeSignifier[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
;
;
ImplementationFieldListOpt
- : TypedIdentifierField[typed] ";" ImplementationFieldListOpt[next] { $$ = CYNew CYImplementationField($typed, $next); }
+ : TypedIdentifierField[typed] ";" ImplementationFieldListOpt[next] { $$ = CYNew CYImplementationField($typed, $typed->name_, $next); }
| { $$ = NULL; }
;
TypeOpt
: "(" TypedIdentifierNo[type] ")" { $$ = $type; }
- | { $$ = CYNew CYTypedIdentifier(CYNew CYTypeVariable("id")); }
+ | { $$ = CYNew CYType(CYNew CYTypeVariable("id")); }
;
MessageParameter
- : Word[tag] ":" TypeOpt[type] BindingIdentifier[identifier] { $type->identifier_ = $identifier; $$ = CYNew CYMessageParameter($tag, $type); }
+ : Word[tag] ":" TypeOpt[type] BindingIdentifier[identifier] { $$ = CYNew CYMessageParameter($tag, $type, $identifier); }
;
MessageParameterList
MessageParameters
: MessageParameterList[pass] { $$ = $pass; }
- | Word[tag] { $$ = CYNew CYMessageParameter($tag, NULL); }
+ | Word[tag] { $$ = CYNew CYMessageParameter($tag); }
;
ClassMessageDeclaration
;
TypedParameterList
- : TypedIdentifierMaybe[typed] TypedParameterList_[formal] { $$ = $formal; $$->parameters_ = CYNew CYTypedParameter($typed, $$->parameters_); }
+ : TypedIdentifierMaybe[typed] TypedParameterList_[formal] { CYIdentifier *identifier; if ($typed->name_ == NULL) identifier = NULL; else { identifier = $typed->name_->Identifier(); if (identifier == NULL) CYERR($typed->location_, "invalid identifier"); } $$ = $formal; $$->parameters_ = CYNew CYTypedParameter($typed, identifier, $$->parameters_); }
| "..." { $$ = CYNew CYTypedFormal(true); }
;
;
TypeDefinition
- : "typedef" NewLineNot TypedIdentifierDefinition[typed] TerminatorHard { $$ = CYNew CYTypeDefinition($typed); }
+ : "typedef" NewLineNot TypedIdentifierDefinition[typed] TerminatorHard { CYIdentifier *identifier; if ($typed->name_ == NULL) identifier = NULL; else { identifier = $typed->name_->Identifier(); if (identifier == NULL) CYERR($typed->location_, "invalid identifier"); } $$ = CYNew CYTypeDefinition($typed, identifier); }
;
Statement__
;
ExternCStatement
- : TypedIdentifierField[typed] TerminatorHard { $$ = CYNew CYExternalDefinition(CYNew CYString("C"), $typed); }
+ : TypedIdentifierField[typed] TerminatorHard { CYIdentifier *identifier; if ($typed->name_ == NULL) identifier = NULL; else { identifier = $typed->name_->Identifier(); if (identifier == NULL) CYERR($typed->location_, "invalid identifier"); } $$ = CYNew CYExternalDefinition(CYNew CYString("C"), $typed, identifier); }
| TypeDefinition[pass] { $$ = $pass; }
;
;
PrimaryExpression
- : "(" LexOf "extern" NewLineOpt ABI[abi] TypedIdentifierField[typed] ")" { $$ = CYNew CYExternalExpression(CYNew CYString("C"), $typed); }
+ : "(" LexOf "extern" NewLineOpt ABI[abi] TypedIdentifierField[typed] ")" { $$ = CYNew CYExternalExpression(CYNew CYString("C"), $typed, $typed->name_); }
;
/* }}} */
@end
}
CYStatement *CYExternalDefinition::Replace(CYContext &context) {
- return $E($ CYAssign($V(typed_->identifier_), $ CYExternalExpression(abi_, typed_)));
+ return $E($ CYAssign($V(name_), $ CYExternalExpression(abi_, type_, name_)));
}
CYTarget *CYExternalExpression::Replace(CYContext &context) {
- return $C1(typed_->Replace(context), $C2($V("dlsym"), $V("RTLD_DEFAULT"), $S(typed_->identifier_->Word())));
+ return $C1(type_->Replace(context), $C2($V("dlsym"), $V("RTLD_DEFAULT"), name_->PropertyName(context)));
}
CYNumber *CYFalse::Number(CYContext &context) {
return $S(value, size);
}
+CYIdentifier *CYString::Identifier() const {
+ if (const char *word = Word())
+ return $ CYIdentifier(word);
+ return NULL;
+}
+
CYNumber *CYString::Number(CYContext &context) {
// XXX: there is a precise algorithm for this
return NULL;
CYList<CYElementValue> names;
CYForEach (field, fields_) {
- CYTypedIdentifier *typed(field->typed_);
- types->*$ CYElementValue(typed->Replace(context));
+ types->*$ CYElementValue(field->type_->Replace(context));
CYExpression *name;
- if (typed->identifier_ == NULL)
+ if (field->name_ == NULL)
name = NULL;
else
- name = $S(typed->identifier_->Word());
+ name = field->name_->PropertyName(context);
names->*$ CYElementValue(name);
}
}
CYStatement *CYTypeDefinition::Replace(CYContext &context) {
- CYIdentifier *identifier(typed_->identifier_);
- typed_->identifier_ = NULL;
- return $ CYLexical(false, $B1($B(identifier, $ CYTypeExpression(typed_))));
+ return $ CYLexical(false, $B1($B(name_, $ CYTypeExpression(type_))));
}
CYTarget *CYTypeEnum::Replace(CYContext &context) {
return next_->Replace(context, $ CYCall($ CYDirectMember(type, $ CYString("volatile"))));
}
-CYTarget *CYTypedIdentifier::Replace(CYContext &context) {
+CYTarget *CYType::Replace(CYContext &context) {
return modifier_->Replace(context, specifier_->Replace(context));
}
-CYTypeFunctionWith *CYTypedIdentifier::Function() {
+CYTypeFunctionWith *CYType::Function() {
CYTypeModifier *&modifier(CYGetLast(modifier_));
if (modifier == NULL)
return NULL;
}
CYArgument *CYTypedParameter::Argument(CYContext &context) { $T(NULL)
- return $ CYArgument(typed_->Replace(context), next_->Argument(context));
+ return $ CYArgument(type_->Replace(context), next_->Argument(context));
}
CYFunctionParameter *CYTypedParameter::Parameters(CYContext &context) { $T(NULL)
- return $ CYFunctionParameter($ CYBinding(typed_->identifier_ ?: context.Unique()), next_->Parameters(context));
+ return $ CYFunctionParameter($ CYBinding(name_ ?: context.Unique()), next_->Parameters(context));
}
CYExpression *CYTypedParameter::TypeSignature(CYContext &context, CYExpression *prefix) { $T(prefix)
- return next_->TypeSignature(context, $ CYAdd(prefix, typed_->Replace(context)));
+ return next_->TypeSignature(context, $ CYAdd(prefix, type_->Replace(context)));
}
CYForInitializer *CYVar::Replace(CYContext &context) {
struct CYExpression;
struct CYAssignment;
+struct CYIdentifier;
struct CYPropertyName {
virtual bool Computed() const {
return false;
}
+ virtual CYIdentifier *Identifier() {
+ return NULL;
+ }
+
virtual CYExpression *PropertyName(CYContext &context) = 0;
virtual void PropertyName(CYOutput &out) const = 0;
};
{
}
+ CYIdentifier *Identifier() override {
+ return this;
+ }
+
virtual const char *Word() const;
CYIdentifier *Replace(CYContext &context, CYIdentifierKind);
};
return value_;
}
+ virtual CYIdentifier *Identifier() const;
virtual const char *Word() const;
virtual CYNumber *Number(CYContext &context);
virtual CYTarget *Replace_(CYContext &context, CYTarget *type) = 0;
CYTarget *Replace(CYContext &context, CYTarget *type);
- virtual void Output(CYOutput &out, CYIdentifier *identifier) const = 0;
- void Output(CYOutput &out, int precedence, CYIdentifier *identifier, bool space) const;
+ virtual void Output(CYOutput &out, CYPropertyName *name) const = 0;
+ void Output(CYOutput &out, int precedence, CYPropertyName *name, bool space) const;
virtual CYTypeFunctionWith *Function() { return NULL; }
};
CYPrecedence(1)
virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
- virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
+ void Output(CYOutput &out, CYPropertyName *name) const override;
};
struct CYTypeConstant :
CYPrecedence(0)
virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
- virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
+ void Output(CYOutput &out, CYPropertyName *name) const override;
};
struct CYTypePointerTo :
CYPrecedence(0)
virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
- virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
+ void Output(CYOutput &out, CYPropertyName *name) const override;
};
struct CYTypeVolatile :
CYPrecedence(0)
virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
- virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
+ void Output(CYOutput &out, CYPropertyName *name) const override;
};
-struct CYTypedIdentifier :
- CYNext<CYTypedIdentifier>,
+struct CYType :
CYThing
{
- CYLocation location_;
- CYIdentifier *identifier_;
CYTypeSpecifier *specifier_;
CYTypeModifier *modifier_;
- CYTypedIdentifier(const CYLocation &location, CYIdentifier *identifier = NULL) :
- location_(location),
- identifier_(identifier),
- specifier_(NULL),
- modifier_(NULL)
- {
- }
-
- CYTypedIdentifier(CYTypeSpecifier *specifier, CYTypeModifier *modifier = NULL) :
- identifier_(NULL),
+ CYType(CYTypeSpecifier *specifier = NULL, CYTypeModifier *modifier = NULL) :
specifier_(specifier),
modifier_(modifier)
{
}
- inline CYTypedIdentifier *Modify(CYTypeModifier *modifier) {
+ inline CYType *Modify(CYTypeModifier *modifier) {
CYSetLast(modifier_) = modifier;
return this;
}
+ void Output(CYOutput &out, CYPropertyName *name) const;
+
virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out) const;
CYTypeFunctionWith *Function();
};
+struct CYTypedLocation :
+ CYType
+{
+ CYLocation location_;
+
+ CYTypedLocation(const CYLocation &location) :
+ location_(location)
+ {
+ }
+};
+
+struct CYTypedName :
+ CYTypedLocation
+{
+ CYPropertyName *name_;
+
+ CYTypedName(const CYLocation &location, CYPropertyName *name = NULL) :
+ CYTypedLocation(location),
+ name_(name)
+ {
+ }
+};
+
struct CYEncodedType :
CYTarget
{
- CYTypedIdentifier *typed_;
+ CYType *typed_;
- CYEncodedType(CYTypedIdentifier *typed) :
+ CYEncodedType(CYType *typed) :
typed_(typed)
{
}
CYNext<CYTypedParameter>,
CYThing
{
- CYTypedIdentifier *typed_;
+ CYType *type_;
+ CYIdentifier *name_;
- CYTypedParameter(CYTypedIdentifier *typed, CYTypedParameter *next = NULL) :
+ CYTypedParameter(CYType *type, CYIdentifier *name, CYTypedParameter *next = NULL) :
CYNext<CYTypedParameter>(next),
- typed_(typed)
+ type_(type),
+ name_(name)
{
}
struct CYLambda :
CYTarget
{
- CYTypedIdentifier *typed_;
+ CYType *typed_;
CYTypedParameter *parameters_;
CYStatement *code_;
- CYLambda(CYTypedIdentifier *typed, CYTypedParameter *parameters, CYStatement *code) :
+ CYLambda(CYType *typed, CYTypedParameter *parameters, CYStatement *code) :
typed_(typed),
parameters_(parameters),
code_(code)
CYTarget
{
CYString *abi_;
- CYTypedIdentifier *typed_;
+ CYType *type_;
+ CYPropertyName *name_;
- CYExternalExpression(CYString *abi, CYTypedIdentifier *typed) :
+ CYExternalExpression(CYString *abi, CYType *type, CYPropertyName *name) :
abi_(abi),
- typed_(typed)
+ type_(type),
+ name_(name)
{
}
CYStatement
{
CYString *abi_;
- CYTypedIdentifier *typed_;
+ CYType *type_;
+ CYIdentifier *name_;
- CYExternalDefinition(CYString *abi, CYTypedIdentifier *typed) :
+ CYExternalDefinition(CYString *abi, CYType *type, CYIdentifier *name) :
abi_(abi),
- typed_(typed)
+ type_(type),
+ name_(name)
{
}
struct CYTypeExpression :
CYTarget
{
- CYTypedIdentifier *typed_;
+ CYType *typed_;
- CYTypeExpression(CYTypedIdentifier *typed) :
+ CYTypeExpression(CYType *typed) :
typed_(typed)
{
}
struct CYTypeDefinition :
CYStatement
{
- CYTypedIdentifier *typed_;
+ CYType *type_;
+ CYIdentifier *name_;
- CYTypeDefinition(CYTypedIdentifier *typed) :
- typed_(typed)
+ CYTypeDefinition(CYType *type, CYIdentifier *name) :
+ type_(type),
+ name_(name)
{
}
CYPrecedence(0)
virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
- virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
+ void Output(CYOutput &out, CYPropertyName *name) const override;
};
struct CYTypeFunctionWith :
CYPrecedence(1)
virtual CYTarget *Replace_(CYContext &context, CYTarget *type);
- virtual void Output(CYOutput &out, CYIdentifier *identifier) const;
+ void Output(CYOutput &out, CYPropertyName *name) const override;
virtual CYTypeFunctionWith *Function() { return this; }
};
struct CYTypeStructField :
CYNext<CYTypeStructField>
{
- CYTypedIdentifier *typed_;
+ CYType *type_;
+ CYPropertyName *name_;
- CYTypeStructField(CYTypedIdentifier *typed, CYTypeStructField *next = NULL) :
+ CYTypeStructField(CYType *type, CYPropertyName *name, CYTypeStructField *next = NULL) :
CYNext<CYTypeStructField>(next),
- typed_(typed)
+ type_(type),
+ name_(name)
{
}
};
#include "Standard.hpp"
class CYPool;
-struct CYTypedIdentifier;
+struct CYType;
struct CYTypedParameter;
namespace sig {
virtual const char *GetName() const;
virtual const char *Encode(CYPool &pool) const = 0;
- virtual CYTypedIdentifier *Decode(CYPool &pool) const = 0;
+ virtual CYType *Decode(CYPool &pool) const = 0;
virtual ffi_type *GetFFI(CYPool &pool) const = 0;
virtual void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const = 0;
}
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *Decode(CYPool &pool) const override;
ffi_type *GetFFI(CYPool &pool) const override;
void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
Void *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *Decode(CYPool &pool) const override;
ffi_type *GetFFI(CYPool &pool) const override;
void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
Unknown *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *Decode(CYPool &pool) const override;
ffi_type *GetFFI(CYPool &pool) const override;
void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
String *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *Decode(CYPool &pool) const override;
ffi_type *GetFFI(CYPool &pool) const override;
void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
Meta *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *Decode(CYPool &pool) const override;
ffi_type *GetFFI(CYPool &pool) const override;
void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
Selector *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *Decode(CYPool &pool) const override;
ffi_type *GetFFI(CYPool &pool) const override;
void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
Bits *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *Decode(CYPool &pool) const override;
ffi_type *GetFFI(CYPool &pool) const override;
void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
Pointer *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *Decode(CYPool &pool) const override;
ffi_type *GetFFI(CYPool &pool) const override;
void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
Array *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *Decode(CYPool &pool) const override;
ffi_type *GetFFI(CYPool &pool) const override;
void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
Object *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *Decode(CYPool &pool) const override;
ffi_type *GetFFI(CYPool &pool) const override;
void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
const char *GetName() const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *Decode(CYPool &pool) const override;
ffi_type *GetFFI(CYPool &pool) const override;
void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
const char *GetName() const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
+ CYType *Decode(CYPool &pool) const override;
ffi_type *GetFFI(CYPool &pool) const override;
void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
{
Signature signature;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
- virtual CYTypedIdentifier *Modify(CYPool &pool, CYTypedIdentifier *result, CYTypedParameter *parameters) const = 0;
+ CYType *Decode(CYPool &pool) const override;
+ virtual CYType *Modify(CYPool &pool, CYType *result, CYTypedParameter *parameters) const = 0;
};
struct Function :
Function *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Modify(CYPool &pool, CYTypedIdentifier *result, CYTypedParameter *parameters) const override;
+ CYType *Modify(CYPool &pool, CYType *result, CYTypedParameter *parameters) const override;
ffi_type *GetFFI(CYPool &pool) const override;
void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;
Block *Copy(CYPool &pool, const char *rename = NULL) const override;
const char *Encode(CYPool &pool) const override;
- CYTypedIdentifier *Decode(CYPool &pool) const override;
- CYTypedIdentifier *Modify(CYPool &pool, CYTypedIdentifier *result, CYTypedParameter *parameters) const override;
+ CYType *Decode(CYPool &pool) const override;
+ CYType *Modify(CYPool &pool, CYType *result, CYTypedParameter *parameters) const override;
ffi_type *GetFFI(CYPool &pool) const override;
void PoolFFI(CYPool *pool, JSContextRef context, ffi_type *ffi, void *data, JSValueRef value) const override;