Skip to content

Refactor SMGRegion: use one constructor, add subclasses

Use one constructor, so we do not forget the color.

Instead of multiple public constructors, add static methods:

  1. #materialize(SMGOptionalObject)
  2. #materialize(SMGAbstractList)
  3. #forTesting(size, label, level=1)

For many tests, one constructor remains public: 4. SMGRegion(size, label)

For adding new objects (except the materialization above), add new subclasses and use their public constructors: 5. SMGAllocation(size, label, color) -- a heap allocation 6. SMGVariable(size, name) -- a stack or global variable, or a stack allocation 7. SMGFunctionParameter(size, name) -- a subclass of variable 8. SMGReturnObject(size) -- an auxiliary stack region for a return value 9. SMGFunctionObject(label) -- an auxiliary global region to point by a function pointer 10. SMGStringLiteral(size, label)

This way, we can see what the region represents, and specialize classes later.

Merge request reports

Loading