ext/libsass/src/ast_def_macros.hpp in sassc-1.11.4 vs ext/libsass/src/ast_def_macros.hpp in sassc-1.12.0
- old
+ new
@@ -17,17 +17,26 @@
{
this->var = &var;
this->orig = var;
*(this->var) = orig;
}
+ void reset()
+ {
+ *(this->var) = this->orig;
+ }
~LocalOption() {
*(this->var) = this->orig;
}
};
#define LOCAL_FLAG(name,opt) LocalOption<bool> flag_##name(name, opt)
+#define LOCAL_COUNT(name,opt) LocalOption<size_t> cnt_##name(name, opt)
+#define NESTING_GUARD(name) \
+ LocalOption<size_t> cnt_##name(name, name + 1); \
+ if (name > MAX_NESTING) throw Exception::NestingLimitError(pstate, traces); \
+
#define ATTACH_OPERATIONS()\
virtual void perform(Operation<void>* op) { (*op)(this); }\
virtual AST_Node_Ptr perform(Operation<AST_Node_Ptr>* op) { return (*op)(this); }\
virtual Statement_Ptr perform(Operation<Statement_Ptr>* op) { return (*op)(this); }\
virtual Expression_Ptr perform(Operation<Expression_Ptr>* op) { return (*op)(this); }\
@@ -42,14 +51,30 @@
public:\
type name() const { return name##_; }\
type name(type name##__) { return name##_ = name##__; }\
private:
-#define ADD_HASHED(type, name)\
+#define HASH_PROPERTY(type, name)\
protected:\
type name##_;\
public:\
type name() const { return name##_; }\
type name(type name##__) { hash_ = 0; return name##_ = name##__; }\
+private:
+
+#define ADD_CONSTREF(type, name) \
+protected: \
+ type name##_; \
+public: \
+ const type& name() const { return name##_; } \
+ void name(type name##__) { name##_ = name##__; } \
+private:
+
+#define HASH_CONSTREF(type, name) \
+protected: \
+ type name##_; \
+public: \
+ const type& name() const { return name##_; } \
+ void name(type name##__) { hash_ = 0; name##_ = name##__; } \
private:
#endif