当前位置: 首页>>代码示例>>Java>>正文


Java Request类代码示例

本文整理汇总了Java中jdk.nashorn.internal.ir.RuntimeNode.Request的典型用法代码示例。如果您正苦于以下问题:Java Request类的具体用法?Java Request怎么用?Java Request使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Request类属于jdk.nashorn.internal.ir.RuntimeNode包,在下文中一共展示了Request类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: leaveTYPEOF

import jdk.nashorn.internal.ir.RuntimeNode.Request; //导入依赖的package包/类
private Node leaveTYPEOF(final UnaryNode unaryNode) {
    final Expression rhs = unaryNode.getExpression();

    final List<Expression> args = new ArrayList<>();
    if (rhs instanceof IdentNode && !isParamOrVar((IdentNode)rhs)) {
        args.add(compilerConstantIdentifier(SCOPE));
        args.add((Expression)LiteralNode.newInstance(rhs, ((IdentNode)rhs).getName()).accept(this)); //null
    } else {
        args.add(rhs);
        args.add((Expression)LiteralNode.newInstance(unaryNode).accept(this)); //null, do not reuse token of identifier rhs, it can be e.g. 'this'
    }

    final Node runtimeNode = new RuntimeNode(unaryNode, Request.TYPEOF, args).accept(this);

    end(unaryNode);

    return runtimeNode;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:AssignSymbols.java

示例2: leaveTYPEOF

import jdk.nashorn.internal.ir.RuntimeNode.Request; //导入依赖的package包/类
private Node leaveTYPEOF(final UnaryNode unaryNode) {
    final Expression rhs = unaryNode.getExpression();

    final List<Expression> args = new ArrayList<>();
    if (rhs instanceof IdentNode && !isParamOrVar((IdentNode)rhs)) {
        args.add(compilerConstantIdentifier(SCOPE));
        args.add(LiteralNode.newInstance(rhs, ((IdentNode)rhs).getName())); //null
    } else {
        args.add(rhs);
        args.add(LiteralNode.newInstance(unaryNode)); //null, do not reuse token of identifier rhs, it can be e.g. 'this'
    }

    final Node runtimeNode = new RuntimeNode(unaryNode, Request.TYPEOF, args);

    end(unaryNode);

    return runtimeNode;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:AssignSymbols.java

示例3: leaveADD

import jdk.nashorn.internal.ir.RuntimeNode.Request; //导入依赖的package包/类
/**
 * Add is a special binary, as it works not only on arithmetic, but for
 * strings etc as well.
 */
@Override
public Expression leaveADD(final BinaryNode binaryNode) {
    final Expression lhs = binaryNode.lhs();
    final Expression rhs = binaryNode.rhs();

    final Type type = binaryNode.getType();

    if (type.isObject()) {
        if (!isAddString(binaryNode)) {
            return new RuntimeNode(binaryNode, Request.ADD);
        }
    }

    return binaryNode.setLHS(convert(lhs, type)).setRHS(convert(rhs, type));
}
 
开发者ID:wro4j,项目名称:nashorn-backport,代码行数:20,代码来源:FinalizeTypes.java

示例4: firstTypeGuessForObject

import jdk.nashorn.internal.ir.RuntimeNode.Request; //导入依赖的package包/类
private static Type firstTypeGuessForObject(final Request request) {
    switch (request) {
    case ADD:
        return INT;
    default:
        return BOOLEAN;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:RuntimeCallSite.java

示例5: leaveRuntimeNode

import jdk.nashorn.internal.ir.RuntimeNode.Request; //导入依赖的package包/类
@Override
public Node leaveRuntimeNode(final RuntimeNode runtimeNode) {
    final Request request = runtimeNode.getRequest();
    final boolean isEqStrict = request == Request.EQ_STRICT;
    if(isEqStrict || request == Request.NE_STRICT) {
        return createIsUndefined(runtimeNode, runtimeNode.getArgs().get(0), runtimeNode.getArgs().get(1),
                isEqStrict ? Request.IS_UNDEFINED : Request.IS_NOT_UNDEFINED);
    }
    return runtimeNode;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:LocalVariableTypesCalculator.java

示例6: loadRuntimeNode

import jdk.nashorn.internal.ir.RuntimeNode.Request; //导入依赖的package包/类
private void loadRuntimeNode(final RuntimeNode runtimeNode) {
    final List<Expression> args = new ArrayList<>(runtimeNode.getArgs());
    if (nullCheck(runtimeNode, args)) {
       return;
    } else if(undefinedCheck(runtimeNode, args)) {
        return;
    }
    // Revert a false undefined check to a strict equality check
    final RuntimeNode newRuntimeNode;
    final Request request = runtimeNode.getRequest();
    if (Request.isUndefinedCheck(request)) {
        newRuntimeNode = runtimeNode.setRequest(request == Request.IS_UNDEFINED ? Request.EQ_STRICT : Request.NE_STRICT);
    } else {
        newRuntimeNode = runtimeNode;
    }

    new OptimisticOperation(newRuntimeNode, TypeBounds.UNBOUNDED) {
        @Override
        void loadStack() {
            for (final Expression arg : args) {
                loadExpression(arg, TypeBounds.OBJECT);
            }
        }
        @Override
        void consumeStack() {
            method.invokestatic(
                    CompilerConstants.className(ScriptRuntime.class),
                    newRuntimeNode.getRequest().toString(),
                    new FunctionSignature(
                        false,
                        false,
                        newRuntimeNode.getType(),
                        args.size()).toString());
        }
    }.emit();

    method.convert(newRuntimeNode.getType());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:CodeGenerator.java

示例7: loadRuntimeNode

import jdk.nashorn.internal.ir.RuntimeNode.Request; //导入依赖的package包/类
private void loadRuntimeNode(final RuntimeNode runtimeNode) {
    final List<Expression> args = new ArrayList<>(runtimeNode.getArgs());
    if (nullCheck(runtimeNode, args)) {
       return;
    } else if(undefinedCheck(runtimeNode, args)) {
        return;
    }
    // Revert a false undefined check to a strict equality check
    final RuntimeNode newRuntimeNode;
    final Request request = runtimeNode.getRequest();
    if (Request.isUndefinedCheck(request)) {
        newRuntimeNode = runtimeNode.setRequest(request == Request.IS_UNDEFINED ? Request.EQ_STRICT : Request.NE_STRICT);
    } else {
        newRuntimeNode = runtimeNode;
    }

    for (final Expression arg : args) {
        loadExpression(arg, TypeBounds.OBJECT);
    }

    method.invokestatic(
            CompilerConstants.className(ScriptRuntime.class),
            newRuntimeNode.getRequest().toString(),
            new FunctionSignature(
                false,
                false,
                newRuntimeNode.getType(),
                args.size()).toString());

    method.convert(newRuntimeNode.getType());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:CodeGenerator.java

示例8: leaveTYPEOF

import jdk.nashorn.internal.ir.RuntimeNode.Request; //导入依赖的package包/类
private Node leaveTYPEOF(final UnaryNode unaryNode) {
    final Expression rhs = unaryNode.getExpression();
    final List<Expression> args = new ArrayList<>();
    if (rhs instanceof IdentNode && !isParamOrVar((IdentNode) rhs)) {
        args.add(compilerConstantIdentifier(SCOPE));
        args.add(LiteralNode.newInstance(rhs, ((IdentNode) rhs).getName())); //null
    } else {
        args.add(rhs);
        args.add(LiteralNode.newInstance(unaryNode)); //null, do not reuse token of identifier rhs, it can be e.g. 'this'
    }
    final Node runtimeNode = new RuntimeNode(unaryNode, Request.TYPEOF, args);
    return runtimeNode;
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:14,代码来源:SymbolsResolver.java

示例9: leaveBinaryRuntimeOperator

import jdk.nashorn.internal.ir.RuntimeNode.Request; //导入依赖的package包/类
private Node leaveBinaryRuntimeOperator(final BinaryNode binaryNode, final Request request) {
    try {
        // Don't do a full RuntimeNode.accept, as we don't want to double-visit the binary node operands
        return leaveRuntimeNode(new RuntimeNode(binaryNode, request));
    } finally {
        end(binaryNode);
    }
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:9,代码来源:Attr.java

示例10: specializationCheck

import jdk.nashorn.internal.ir.RuntimeNode.Request; //导入依赖的package包/类
private boolean specializationCheck(final RuntimeNode.Request request, final Expression node, final List<Expression> args) {
    if (!request.canSpecialize()) {
        return false;
    }

    assert args.size() == 2;
    final Type returnType = node.getType();

    load(args.get(0));
    load(args.get(1));

    Request finalRequest = request;

    //if the request is a comparison, i.e. one that can be reversed
    //it keeps its semantic, but make sure that the object comes in
    //last
    final Request reverse = Request.reverse(request);
    if (method.peekType().isObject() && reverse != null) { //rhs is object
        if (!method.peekType(1).isObject()) { //lhs is not object
            method.swap(); //prefer object as lhs
            finalRequest = reverse;
        }
    }

    method.dynamicRuntimeCall(
            new SpecializedRuntimeNode(
                finalRequest,
                new Type[] {
                    method.peekType(1),
                    method.peekType()
                },
                returnType).getInitialName(),
            returnType,
            finalRequest);

    method.convert(node.getType());
    method.store(node.getSymbol());

    return true;
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:41,代码来源:CodeGenerator.java

示例11: leaveCmp

import jdk.nashorn.internal.ir.RuntimeNode.Request; //导入依赖的package包/类
/**
 * Exit a comparison node and do the appropriate replacements. We need to introduce runtime
 * nodes late for comparisons as types aren't known until the last minute
 *
 * Both compares and adds may turn into runtimes node at this level as when we first bump
 * into the op in Attr, we may type it according to what we know there, which may be wrong later
 *
 * e.g. i (int) < 5 -> normal compare
 *     i = object
 *  then the post pass that would add the conversion to the 5 needs to
 *
 * @param binaryNode binary node to leave
 * @param request    runtime request
 * @return lowered cmp node
 */
@SuppressWarnings("fallthrough")
private Node leaveCmp(final BinaryNode binaryNode, final RuntimeNode.Request request) {
    final Expression lhs    = binaryNode.lhs();
    final Expression rhs    = binaryNode.rhs();

    Type widest = Type.widest(lhs.getType(), rhs.getType());

    boolean newRuntimeNode = false, finalized = false;
    switch (request) {
    case EQ_STRICT:
    case NE_STRICT:
        if (lhs.getType().isBoolean() != rhs.getType().isBoolean()) {
            newRuntimeNode = true;
            widest = Type.OBJECT;
            finalized = true;
        }
        //fallthru
    default:
        if (newRuntimeNode || widest.isObject()) {
            return new RuntimeNode(binaryNode, request).setIsFinal(finalized);
        }
        break;
    }

    return binaryNode.setLHS(convert(lhs, widest)).setRHS(convert(rhs, widest));
}
 
开发者ID:wro4j,项目名称:nashorn-backport,代码行数:42,代码来源:FinalizeTypes.java

示例12: getRequest

import jdk.nashorn.internal.ir.RuntimeNode.Request; //导入依赖的package包/类
Request getRequest() {
    return request;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:RuntimeCallSite.java

示例13: createIsUndefined

import jdk.nashorn.internal.ir.RuntimeNode.Request; //导入依赖的package包/类
private static Expression createIsUndefined(final Expression parent, final Expression lhs, final Expression rhs, final Request request) {
    if (isUndefinedIdent(lhs) || isUndefinedIdent(rhs)) {
        return new RuntimeNode(parent, request, lhs, rhs);
    }
    return parent;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:LocalVariableTypesCalculator.java


注:本文中的jdk.nashorn.internal.ir.RuntimeNode.Request类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。