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);
 }
Exemple #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);
 }
Exemple #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);
    }
Exemple #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");
 }
Exemple #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);
    }
    @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;
    }
 public SmallHashLiteralNode(
     RubyContext context, SourceSection sourceSection, RubyNode[] keyValues) {
   super(context, sourceSection, keyValues);
   hashNode = new HashNode(context, sourceSection);
   equalNode = DispatchHeadNodeFactory.createMethodCall(context);
 }
Exemple #8
0
 public ToSNode(RubyContext context, SourceSection sourceSection) {
   super(context, sourceSection);
   toS = DispatchHeadNodeFactory.createMethodCall(context);
 }
Exemple #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);
 }
Exemple #10
0
 public NewNode(RubyContext context, SourceSection sourceSection) {
   super(context, sourceSection);
   allocateNode = DispatchHeadNodeFactory.createMethodCallOnSelf(context);
   initialize = DispatchHeadNodeFactory.createMethodCallOnSelf(context);
 }