Ejemplo n.º 1
0
 @Override
 public void execute(VirtualFrame frame, Object value, MaterializedFrame enclosingFrame) {
   CompilerDirectives.transferToInterpreterAndInvalidate();
   if (name.isEmpty()) {
     throw RError.error(RError.NO_CALLER, RError.Message.ZERO_LENGTH_VARIABLE);
   }
   final WriteSuperFrameVariableNode writeNode;
   if (REnvironment.isGlobalEnvFrame(enclosingFrame)) {
     /*
      * we've reached the global scope, do unconditional write. if this is the first node
      * in the chain, needs the rhs and enclosingFrame nodes
      */
     AccessEnclosingFrameNode enclosingFrameNode =
         RArguments.getEnclosingFrame(frame) == enclosingFrame
             ? new AccessEnclosingFrameNode()
             : null;
     writeNode =
         ResolvedWriteSuperFrameVariableNodeGen.create(
             mode,
             rhs,
             enclosingFrameNode,
             FrameSlotNode.create(
                 findOrAddFrameSlot(
                     enclosingFrame.getFrameDescriptor(), name, FrameSlotKind.Illegal)),
             name);
   } else {
     ResolvedWriteSuperFrameVariableNode actualWriteNode =
         ResolvedWriteSuperFrameVariableNodeGen.create(
             mode, null, null, FrameSlotNode.create(name), name);
     writeNode =
         new WriteSuperFrameVariableConditionalNode(
             actualWriteNode, new UnresolvedWriteSuperFrameVariableNode(name, null, mode), rhs);
   }
   replace(writeNode).execute(frame, value, enclosingFrame);
 }