-/* 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 {{{ */
return false;
}
+ virtual bool IsNew() const {
+ return false;
+ }
+
virtual CYStatement *Initialize(CYContext &context, CYExpression *value);
virtual CYTarget *Replace(CYContext &context) = 0;
{
}
+ CYTarget *Replace(CYContext &context, CYTarget *seed);
+
virtual CYTarget *Replace(CYContext &context);
void Output(CYOutput &out, CYFlags flags) const;
};
virtual void Output(CYOutput &out, CYFlags flags) const;
};
+struct CYSubscriptMember :
+ CYMember
+{
+ CYSubscriptMember(CYExpression *object, CYExpression *property) :
+ CYMember(object, property)
+ {
+ }
+
+ CYPrecedence(1)
+
+ virtual CYTarget *Replace(CYContext &context);
+ virtual void Output(CYOutput &out, CYFlags flags) const;
+};
+
namespace cy {
namespace Syntax {
return arguments_ == NULL ? 2 : 1;
}
+ virtual bool IsNew() const {
+ return true;
+ }
virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
struct CYRubyProc;
-struct CYRubyBlock :
+struct CYBraced :
CYTarget
{
- CYExpression *call_;
- CYRubyProc *proc_;
+ CYTarget *lhs_;
- CYRubyBlock(CYExpression *call, CYRubyProc *proc) :
- call_(call),
- proc_(proc)
+ CYBraced(CYTarget *lhs = NULL) :
+ lhs_(lhs)
{
}
CYPrecedence(1)
+ void SetLeft(CYTarget *lhs) {
+ lhs_ = lhs;
+ }
+};
+
+struct CYRubyBlock :
+ CYBraced
+{
+ CYRubyProc *proc_;
+
+ CYRubyBlock(CYTarget *lhs, CYRubyProc *proc) :
+ CYBraced(lhs),
+ proc_(proc)
+ {
+ }
+
virtual CYTarget *Replace(CYContext &context);
virtual void Output(CYOutput &out, CYFlags flags) const;
virtual CYTarget *AddArgument(CYContext &context, CYExpression *value);
};
+struct CYExtend :
+ CYBraced
+{
+ CYObject object_;
+
+ CYExtend(CYTarget *lhs, CYProperty *properties = NULL) :
+ CYBraced(lhs),
+ object_(properties)
+ {
+ }
+
+ virtual CYTarget *Replace(CYContext &context);
+ virtual void Output(CYOutput &out, CYFlags flags) const;
+};
+
struct CYIf :
CYStatement
{
CYTarget *Replace(CYContext &context, CYTarget *type);
virtual void Output(CYOutput &out, CYIdentifier *identifier) const = 0;
- void Output(CYOutput &out, int precedence, CYIdentifier *identifier) const;
+ void Output(CYOutput &out, int precedence, CYIdentifier *identifier, bool space) const;
virtual CYTypeFunctionWith *Function() { return NULL; }
};