storeObjectRef.ts 573 B

1234567891011121314151617181920212223242526272829303132
  1. import { StoreObject } from './storeObject';
  2. import { Location } from '../../memory/location';
  3. export class StoreObjectRef extends StoreObject {
  4. private refObj: StoreObject;
  5. /**
  6. *
  7. * @param {StoreObject} stoObj
  8. */
  9. constructor (stoObj: StoreObject) {
  10. super(stoObj.type, stoObj.locAddress, false);
  11. this.refObj = stoObj;
  12. }
  13. get isRef () {
  14. return true;
  15. }
  16. getRefObj () {
  17. return this.refObj;
  18. }
  19. updateRef (stoObj: StoreObject) {
  20. Location.updateAddress(this.locAddress, stoObj.value);
  21. }
  22. destroy () {
  23. return false;
  24. }
  25. }