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;
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;
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;
{
}
- 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;
virtual CYExpression *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
+
+ virtual CYExpression *AddArgument(CYContext &context, CYExpression *value);
};
struct CYIf :
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_;
virtual void Output(CYOutput &out, CYFlags flags) const;
};
-// XXX: this should be split up into CYAnonymousFunctionExpression and CYNamedFunctionExpression
struct CYFunctionExpression :
CYFunction,
CYExpression
virtual void Output(CYOutput &out, CYFlags flags) const;
};
-// XXX: this should derive from CYAnonymousFunction
struct CYFatArrow :
CYFunction,
CYExpression
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)
{
}
virtual void Output(CYOutput &out, CYFlags flags) const;
};
-// XXX: this should derive from CYNamedFunction
struct CYFunctionStatement :
CYFunction,
CYStatement