TODO: Allowing drop and dropArgs to remove stack items above the IDs they are provided is a workaround. drop and dropArgs should find and remove only the stack items matching the provided IDs once all attributes are properly pushed and popped from stack. drop searches the stack for each ID and remov
(ids ...int64)
| 364 | // WARNING: It is possible for multiple expressions with the same ID to exist (due to how macros are implemented) so it's |
| 365 | // possible that a dropped ID will remain on the stack. They should be removed when IDs on the stack are popped. |
| 366 | func (s *refValStack) drop(ids ...int64) { |
| 367 | for _, id := range ids { |
| 368 | for idx := len(*s) - 1; idx >= 0; idx-- { |
| 369 | if (*s)[idx].ID == id { |
| 370 | *s = (*s)[:idx] |
| 371 | break |
| 372 | } |
| 373 | } |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | // dropArgs searches the stack for all the args by their IDs, accumulates their associated ref.Vals and drops any |
| 378 | // stack items above any of the arg IDs. If any of the IDs are not found the stack, false is returned. |