55 // Creating or looking up a symbol increments the symbol's reference count |
55 // Creating or looking up a symbol increments the symbol's reference count |
56 TempNewSymbol(Symbol *s) : _temp(s) {} |
56 TempNewSymbol(Symbol *s) : _temp(s) {} |
57 |
57 |
58 // Operator= increments reference count. |
58 // Operator= increments reference count. |
59 void operator=(const TempNewSymbol &s) { |
59 void operator=(const TempNewSymbol &s) { |
|
60 //clear(); //FIXME |
60 _temp = s._temp; |
61 _temp = s._temp; |
61 if (_temp !=NULL) _temp->increment_refcount(); |
62 if (_temp !=NULL) _temp->increment_refcount(); |
62 } |
63 } |
63 |
64 |
64 // Decrement reference counter so it can go away if it's unique |
65 // Decrement reference counter so it can go away if it's unique |
65 ~TempNewSymbol() { if (_temp != NULL) _temp->decrement_refcount(); } |
66 void clear() { if (_temp != NULL) _temp->decrement_refcount(); _temp = NULL; } |
|
67 |
|
68 ~TempNewSymbol() { clear(); } |
66 |
69 |
67 // Operators so they can be used like Symbols |
70 // Operators so they can be used like Symbols |
68 Symbol* operator -> () const { return _temp; } |
71 Symbol* operator -> () const { return _temp; } |
69 bool operator == (Symbol* o) const { return _temp == o; } |
72 bool operator == (Symbol* o) const { return _temp == o; } |
70 // Sneaky conversion function |
73 // Sneaky conversion function |