X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/20052ff75c224699725da0f8e096053009c62741..1abe53bff9f3ea0bebf749a4b49271c4eff7ec12:/Syntax.hpp diff --git a/Syntax.hpp b/Syntax.hpp index 3d248d6..82b1392 100644 --- a/Syntax.hpp +++ b/Syntax.hpp @@ -614,8 +614,6 @@ struct CYComprehension : return this; } - virtual const char *Name() const = 0; - virtual CYFunctionParameter *Parameter(CYContext &context) const = 0; CYFunctionParameter *Parameters(CYContext &context) const; virtual CYStatement *Replace(CYContext &context, CYStatement *statement) const; @@ -625,20 +623,16 @@ struct CYComprehension : struct CYForInComprehension : CYComprehension { - CYIdentifier *name_; + CYDeclaration *declaration_; CYExpression *set_; - CYForInComprehension(CYIdentifier *name, CYExpression *set, CYComprehension *next = NULL) : + CYForInComprehension(CYDeclaration *declaration, CYExpression *set, CYComprehension *next = NULL) : CYComprehension(next), - name_(name), + declaration_(declaration), set_(set) { } - virtual const char *Name() const { - return name_->Word(); - } - virtual CYFunctionParameter *Parameter(CYContext &context) const; virtual CYStatement *Replace(CYContext &context, CYStatement *statement) const; virtual void Output(CYOutput &out) const; @@ -647,20 +641,16 @@ struct CYForInComprehension : struct CYForOfComprehension : CYComprehension { - CYIdentifier *name_; + CYDeclaration *declaration_; CYExpression *set_; - CYForOfComprehension(CYIdentifier *name, CYExpression *set, CYComprehension *next = NULL) : + CYForOfComprehension(CYDeclaration *declaration, CYExpression *set, CYComprehension *next = NULL) : CYComprehension(next), - name_(name), + declaration_(declaration), set_(set) { } - virtual const char *Name() const { - return name_->Word(); - } - virtual CYFunctionParameter *Parameter(CYContext &context) const; virtual CYStatement *Replace(CYContext &context, CYStatement *statement) const; virtual void Output(CYOutput &out) const; @@ -677,10 +667,6 @@ struct CYIfComprehension : { } - virtual const char *Name() const { - return NULL; - } - virtual CYFunctionParameter *Parameter(CYContext &context) const; virtual CYStatement *Replace(CYContext &context, CYStatement *statement) const; virtual void Output(CYOutput &out) const; @@ -1434,6 +1420,8 @@ struct CYRubyBlock : virtual CYExpression *Replace(CYContext &context); virtual void Output(CYOutput &out, CYFlags flags) const; + + virtual CYExpression *AddArgument(CYContext &context, CYExpression *value); }; struct CYIf : @@ -1494,7 +1482,6 @@ struct CYWhile : virtual void Output(CYOutput &out, CYFlags flags) const; }; -// XXX: this should be split up into CYAnonymousFunction and CYNamedFunction (subclass) struct CYFunction { CYIdentifier *name_; CYFunctionParameter *parameters_; @@ -1518,7 +1505,6 @@ struct CYFunction { virtual void Output(CYOutput &out, CYFlags flags) const; }; -// XXX: this should be split up into CYAnonymousFunctionExpression and CYNamedFunctionExpression struct CYFunctionExpression : CYFunction, CYExpression @@ -1535,7 +1521,6 @@ struct CYFunctionExpression : virtual void Output(CYOutput &out, CYFlags flags) const; }; -// XXX: this should derive from CYAnonymousFunction struct CYFatArrow : CYFunction, CYExpression @@ -1552,12 +1537,12 @@ struct CYFatArrow : virtual void Output(CYOutput &out, CYFlags flags) const; }; -// XXX: this should derive from CYAnonymousFunctionExpression struct CYRubyProc : - CYFunctionExpression + CYFunction, + CYExpression { CYRubyProc(CYFunctionParameter *parameters, CYStatement *code) : - CYFunctionExpression(NULL, parameters, code) + CYFunction(NULL, parameters, code) { } @@ -1565,7 +1550,6 @@ struct CYRubyProc : virtual void Output(CYOutput &out, CYFlags flags) const; }; -// XXX: this should derive from CYNamedFunction struct CYFunctionStatement : CYFunction, CYStatement