From 57d557146c1aa8f72348d62ce461080ba5b2b5d2 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 31 Oct 2014 01:42:04 -0700 Subject: [PATCH] CYMessage syntax should not be using CYEncodedType. --- Cycript.yy.in | 11 +++-------- ObjectiveC/Replace.cpp | 4 ++-- ObjectiveC/Syntax.hpp | 8 ++++---- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Cycript.yy.in b/Cycript.yy.in index d9b9a1d..3ad89f8 100644 --- a/Cycript.yy.in +++ b/Cycript.yy.in @@ -486,7 +486,6 @@ int cylex(YYSTYPE *, cy::location *, void *); @begin C %type ArrayedType -%type EncodedType %type FunctionedType %type IntegerType %type IntegerTypeOpt @@ -532,7 +531,7 @@ int cylex(YYSTYPE *, cy::location *, void *); %type SelectorExpressionOpt %type SelectorList %type SelectorWordOpt -%type TypeOpt +%type TypeOpt %type VariadicCall @end @@ -1481,12 +1480,8 @@ TypedIdentifier : TypeQualifierLeft PrimitiveType TypeQualifierRight { $$ = $3; $$->specifier_ = $2; CYSetLast($1) = $$->modifier_; $$->modifier_ = $1; } ; -EncodedType - : TypedIdentifier { $$ = CYNew CYEncodedType($1); } - ; - PrimaryExpression - : "@encode" "(" EncodedType ")" { $$ = $3; } + : "@encode" "(" TypedIdentifier ")" { $$ = CYNew CYEncodedType($3); } ; /* }}} */ @end @@ -1514,7 +1509,7 @@ MessageScope ; TypeOpt - : "(" LexSetRegExp EncodedType ")" { $$ = $3; } + : "(" LexSetRegExp TypedIdentifier ")" { $$ = $3; } | { $$ = NULL; } ; diff --git a/ObjectiveC/Replace.cpp b/ObjectiveC/Replace.cpp index 74a687f..d90eecf 100644 --- a/ObjectiveC/Replace.cpp +++ b/ObjectiveC/Replace.cpp @@ -24,11 +24,11 @@ #include -static CYExpression *MessageType(CYContext &context, CYExpression *type, CYMessageParameter *next, CYExpression *extra = NULL) { +static CYExpression *MessageType(CYContext &context, CYTypedIdentifier *type, CYMessageParameter *next, CYExpression *extra = NULL) { if (type == NULL) return NULL; - CYExpression *left($C0($M(type, $S("toString")))); + CYExpression *left($C0($M(type->Replace(context), $S("toString")))); if (extra != NULL) left = $ CYAdd(left, extra); diff --git a/ObjectiveC/Syntax.hpp b/ObjectiveC/Syntax.hpp index 0777d24..5702171 100644 --- a/ObjectiveC/Syntax.hpp +++ b/ObjectiveC/Syntax.hpp @@ -129,10 +129,10 @@ struct CYMessageParameter : CYNext { CYWord *tag_; - CYExpression *type_; + CYTypedIdentifier *type_; CYIdentifier *name_; - CYMessageParameter(CYWord *tag, CYExpression *type, CYIdentifier *name) : + CYMessageParameter(CYWord *tag, CYTypedIdentifier *type, CYIdentifier *name) : tag_(tag), type_(type), name_(name) @@ -149,11 +149,11 @@ struct CYMessage : CYNext { bool instance_; - CYExpression *type_; + CYTypedIdentifier *type_; CYMessageParameter *parameters_; CYBlock code_; - CYMessage(bool instance, CYExpression *type, CYMessageParameter *parameter, CYStatement *statements) : + CYMessage(bool instance, CYTypedIdentifier *type, CYMessageParameter *parameter, CYStatement *statements) : instance_(instance), type_(type), parameters_(parameter), -- 2.45.2