safely replace all node references when injecting a literal set for set([...])