Skip to content

VariableSlot.getLocation() is nullable #383

@zcai1

Description

@zcai1

Currently, some variable slots don't have any location information (i.e., getLocation() returns null). For example, CombVariableSlot are instanciated with location equals to null in:

@Override
public CombVariableSlot createCombVariableSlot(Slot receiver, Slot declared) {
    CombVariableSlot combVariableSlot;
    Pair<Slot, Slot> pair = new Pair<>(receiver, declared);
    if (combSlotPairCache.containsKey(pair)) {
        int id = combSlotPairCache.get(pair);
        combVariableSlot = (CombVariableSlot) getSlot(id);
    } else {
        combVariableSlot = new CombVariableSlot(nextId(), null, receiver, declared);
        addToSlots(combVariableSlot);
        combSlotPairCache.put(pair, combVariableSlot.getId());
    }
    return combVariableSlot;
}

Another example is LubVariableSlot, which has a similar instanciation strategy in createMergeVariableSlot. Also, we may need special handling for the join of two branches (e.g., point to the if statement).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions