Ejemplo n.º 1
0
 protected HashLiteralNode(
     RubyContext context, SourceSection sourceSection, RubyNode[] keyValues) {
   super(context, sourceSection);
   assert keyValues.length % 2 == 0;
   this.keyValues = keyValues;
   dupNode = DispatchHeadNodeFactory.createMethodCall(context);
   freezeNode = DispatchHeadNodeFactory.createMethodCall(context);
 }
Ejemplo n.º 2
0
 public SetNode(RubyContext context, SourceSection sourceSection) {
   super(context, sourceSection);
   hashNode = new HashNode(context, sourceSection);
   eqlNode = DispatchHeadNodeFactory.createMethodCall(context);
   equalNode =
       BasicObjectNodesFactory.ReferenceEqualNodeFactory.create(
           context, sourceSection, null, null);
 }
Ejemplo n.º 3
0
    void triggerInheritedHook(
        VirtualFrame frame, DynamicObject subClass, DynamicObject superClass) {
      assert RubyGuards.isRubyClass(subClass);
      assert RubyGuards.isRubyClass(superClass);

      if (inheritedNode == null) {
        CompilerDirectives.transferToInterpreter();
        inheritedNode = insert(DispatchHeadNodeFactory.createMethodCallOnSelf(getContext()));
      }
      inheritedNode.call(frame, superClass, "inherited", null, subClass);
    }
Ejemplo n.º 4
0
 public ReadTimeZoneNode(RubyContext context, SourceSection sourceSection) {
   super(context, sourceSection);
   hashNode = DispatchHeadNodeFactory.createMethodCall(context);
   envNode =
       new ReadConstantNode(
           context,
           sourceSection,
           "ENV",
           new LiteralNode(context, sourceSection, getContext().getCoreLibrary().getObjectClass()),
           LexicalScope.NONE);
   TZ = createString("TZ");
 }
Ejemplo n.º 5
0
    @Specialization(guards = "!isRubyBignum(b)")
    public boolean equal(VirtualFrame frame, DynamicObject a, DynamicObject b) {
      if (booleanCastNode == null) {
        CompilerDirectives.transferToInterpreter();
        booleanCastNode = insert(BooleanCastNodeGen.create(getContext(), getSourceSection(), null));
      }

      if (reverseCallNode == null) {
        CompilerDirectives.transferToInterpreter();
        reverseCallNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
      }

      final Object reversedResult = reverseCallNode.call(frame, b, "==", null, a);

      return booleanCastNode.executeBoolean(frame, reversedResult);
    }
Ejemplo n.º 6
0
    @Specialization
    public Object full(VirtualFrame frame, DynamicObject matchData) {
      if (getFullTuple(matchData) != null) {
        return getFullTuple(matchData);
      }

      if (newTupleNode == null) {
        CompilerDirectives.transferToInterpreter();
        newTupleNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
      }

      final Object fullTuple =
          newTupleNode.call(
              frame,
              getContext().getCoreLibrary().getTupleClass(),
              "create",
              null,
              getFullBegin(matchData),
              getFullEnd(matchData));

      setFullTuple(matchData, fullTuple);

      return fullTuple;
    }
Ejemplo n.º 7
0
 public SmallHashLiteralNode(
     RubyContext context, SourceSection sourceSection, RubyNode[] keyValues) {
   super(context, sourceSection, keyValues);
   hashNode = new HashNode(context, sourceSection);
   equalNode = DispatchHeadNodeFactory.createMethodCall(context);
 }
Ejemplo n.º 8
0
 public ToSNode(RubyContext context, SourceSection sourceSection) {
   super(context, sourceSection);
   toS = DispatchHeadNodeFactory.createMethodCall(context);
 }
Ejemplo n.º 9
0
 public IncludeNode(RubyContext context, SourceSection sourceSection) {
   super(context, sourceSection);
   callLess = DispatchHeadNodeFactory.createMethodCall(context, false, false, null);
   callGreater = DispatchHeadNodeFactory.createMethodCall(context, false, false, null);
   callGreaterEqual = DispatchHeadNodeFactory.createMethodCall(context, false, false, null);
 }
Ejemplo n.º 10
0
 public NewNode(RubyContext context, SourceSection sourceSection) {
   super(context, sourceSection);
   allocateNode = DispatchHeadNodeFactory.createMethodCallOnSelf(context);
   initialize = DispatchHeadNodeFactory.createMethodCallOnSelf(context);
 }