Examples of FixnumNode


Examples of org.jruby.ast.FixnumNode

        for (Node node = caseNode.getFirstWhenNode(); node != null && node instanceof WhenNode; node = ((WhenNode)node).getNextCase()) {
            WhenNode whenNode = (WhenNode)node;
            if (whenNode.getExpressionNodes() instanceof ArrayNode) {
                ArrayNode arrayNode = (ArrayNode)whenNode.getExpressionNodes();
                if (arrayNode.size() == 1 && arrayNode.get(0) instanceof FixnumNode) {
                    FixnumNode fixnumNode = (FixnumNode)arrayNode.get(0);
                    long value = fixnumNode.getValue();
                    if (value <= Integer.MAX_VALUE && value >= Integer.MIN_VALUE) {
                        // OK! we can safely use it in a case
                        continue;
                    }
                }
View Full Code Here

Examples of org.jruby.ast.FixnumNode

                throw new NotCompilableException("ERROR: Encountered a method with a non-block, non-blockpass iter node at: " + node);
        }
    }

    public void compileFixnum(Node node, BodyCompiler context) {
        FixnumNode fixnumNode = (FixnumNode) node;

        context.createNewFixnum(fixnumNode.getValue());
    }
View Full Code Here

Examples of org.jruby.ast.FixnumNode

                if(poped) {
                    ADD_INSN(ret, nd_line(node), YARVInstructions.POP);
                }
                break compileLoop;
            case FIXNUMNODE:
                FixnumNode iVisited = (FixnumNode) node;
                if(!poped) {
                    ADD_INSN1(ret, nd_line(node), YARVInstructions.PUTOBJECT, iVisited.getFixnum(runtime));
                }
                break compileLoop;
            case WHILENODE:
            case UNTILNODE:{
                Label next_label = NEW_LABEL(nd_line(node))/* next  */
 
View Full Code Here

Examples of org.jruby.ast.FixnumNode

    private Object newBignumNode(String value, int radix) {
        return new BignumNode(getPosition(), new BigInteger(value, radix));
    }

    private Object newFixnumNode(String value, int radix) throws NumberFormatException {
        return new FixnumNode(getPosition(), Long.parseLong(value, radix));
    }
View Full Code Here

Examples of org.jruby.ast.FixnumNode

            c = readEscape();
        }
       
        c &= 0xff;
        lex_state = LexState.EXPR_END;
        yaccValue = new FixnumNode(getPosition(), c);
        return Tokens.tINTEGER;
    }
View Full Code Here

Examples of org.jruby.ast.FixnumNode

                case 'E' :
                  tokenBuffer.append('0');
                    break;
                default :
                    src.unread(c);
                    yaccValue = new FixnumNode(getPosition(), 0);
                    return Tokens.tINTEGER;
            }
        }

        boolean seen_point = false;
View Full Code Here

Examples of org.jruby.ast.FixnumNode

        case Tokens.kFALSE:
            return new FalseNode(token.getPosition());
        case Tokens.k__FILE__:
            return new FileNode(token.getPosition(), ByteList.create(token.getPosition().getFile()));
        case Tokens.k__LINE__:
            return new FixnumNode(token.getPosition(), token.getPosition().getEndLine()+1);
        case Tokens.tIDENTIFIER:
            return currentScope.declare(token.getPosition(), (String) token.getValue());
        case Tokens.tCONSTANT:
            return new ConstNode(token.getPosition(), (String) token.getValue());
        case Tokens.tIVAR:
View Full Code Here

Examples of org.jruby.ast.FixnumNode

        return new YieldNode(position, node, state);
    }
   
    public Node negateInteger(Node integerNode) {
        if (integerNode instanceof FixnumNode) {
            FixnumNode fixnumNode = (FixnumNode) integerNode;
           
            fixnumNode.setValue(-fixnumNode.getValue());
            return fixnumNode;
        } else if (integerNode instanceof BignumNode) {
            BignumNode bignumNode = (BignumNode) integerNode;
           
            bignumNode.setValue(bignumNode.getValue().negate());
View Full Code Here

Examples of org.jruby.ast.FixnumNode

            if (whenNode.getExpressionNodes() instanceof ArrayNode) {
                ArrayNode arrayNode = (ArrayNode)whenNode.getExpressionNodes();

                for (Node maybeFixnum : arrayNode.childNodes()) {
                    if (maybeFixnum instanceof FixnumNode) {
                        FixnumNode fixnumNode = (FixnumNode)maybeFixnum;
                        long value = fixnumNode.getValue();
                        if (value <= Integer.MAX_VALUE && value >= Integer.MIN_VALUE) {
                            if (foundType != null && foundType != FastSwitchType.FIXNUM) return null;
                            if (foundType == null) foundType = FastSwitchType.FIXNUM;
                            continue;
                        } else {
                            return null;
                        }
                    } else {
                        return null;
                    }
                }
            } else if (whenNode.getExpressionNodes() instanceof FixnumNode) {
                FixnumNode fixnumNode = (FixnumNode)whenNode.getExpressionNodes();
                long value = fixnumNode.getValue();
                if (value <= Integer.MAX_VALUE && value >= Integer.MIN_VALUE) {
                    if (foundType != null && foundType != FastSwitchType.FIXNUM) return null;
                    if (foundType == null) foundType = FastSwitchType.FIXNUM;
                    continue;
                } else {
View Full Code Here

Examples of org.jruby.ast.FixnumNode

                    return null;
                }
            }
            return cases;
        } else if (whenNode.getExpressionNodes() instanceof FixnumNode) {
            FixnumNode fixnumNode = (FixnumNode)whenNode.getExpressionNodes();
            return new int[] {(int)fixnumNode.getValue()};
        } else if (whenNode.getExpressionNodes() instanceof StrNode) {
            StrNode strNode = (StrNode)whenNode.getExpressionNodes();
            if (strNode.getValue().length() == 1) {
                return new int[] {strNode.getValue().get(0)};
            } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.