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


Java Type类代码示例

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


Type类属于com.sun.org.apache.xalan.internal.xsltc.compiler.util包,在下文中一共展示了Type类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compileInit

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入依赖的package包/类
/**
 * Create a constructor for the new class. Updates the reference to the
 * collator in the super calls only when the stylesheet specifies a new
 * language in xsl:sort.
 */
private static MethodGenerator compileInit(Vector sortObjects,
                                       NodeSortRecordGenerator sortRecord,
                                       ConstantPoolGen cpg,
                                       String className)
{
    final InstructionList il = new InstructionList();
    final MethodGenerator init =
        new MethodGenerator(ACC_PUBLIC,
                            com.sun.org.apache.bcel.internal.generic.Type.VOID,
                            null, null, "<init>", className,
                            il, cpg);

    // Call the constructor in the NodeSortRecord superclass
    il.append(ALOAD_0);
    il.append(new INVOKESPECIAL(cpg.addMethodref(NODE_SORT_RECORD,
                                                 "<init>", "()V")));



    il.append(RETURN);

    return init;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:Sort.java

示例2: typeCheck

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入依赖的package包/类
/**
 * Runs a type check on either the variable element body or the
 * expression in the 'select' attribute
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {

    // Type check the 'select' expression if present
    if (_select != null) {
        _type = _select.typeCheck(stable);
    }
    // Type check the element contents otherwise
    else if (hasContents()) {
        typeCheckContents(stable);
        _type = Type.ResultTree;
    }
    else {
        _type = Type.Reference;
    }
    // The return type is void as the variable element does not leave
    // anything on the JVM's stack. The '_type' global will be returned
    // by the references to this variable, and not by the variable itself.
    return Type.Void;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:Variable.java

示例3: typeCheck

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入依赖的package包/类
/**
 * Check that we either have no parameters or one parameter that is
 * either a node or a node-set.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {

    // Check the argument type (if any)
    switch(argumentCount()) {
    case 0:
        _paramType = Type.Node;
        break;
    case 1:
        _paramType = _param.typeCheck(stable);
        break;
    default:
        throw new TypeCheckError(this);
    }

    // The argument has to be a node, a node-set or a node reference
    if ((_paramType != Type.NodeSet) &&
        (_paramType != Type.Node) &&
        (_paramType != Type.Reference)) {
        throw new TypeCheckError(this);
    }

    return (_type = Type.String);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:NameBase.java

示例4: typeCheck

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入依赖的package包/类
/**
 * Type check the two parameters for this function
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {

    // Check that the function was passed exactly two arguments
    if (argumentCount() != 2) {
        throw new TypeCheckError(ErrorMsg.ILLEGAL_ARG_ERR, getName(), this);
    }

    // The first argument must be a String, or cast to a String
    _base = argument(0);
    Type baseType = _base.typeCheck(stable);
    if (baseType != Type.String)
        _base = new CastExpr(_base, Type.String);

    // The second argument must also be a String, or cast to a String
    _token = argument(1);
    Type tokenType = _token.typeCheck(stable);
    if (tokenType != Type.String)
        _token = new CastExpr(_token, Type.String);

    return _type = Type.Boolean;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:ContainsCall.java

示例5: typeCheck

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入依赖的package包/类
/**
 * Type check a FilterParentPath. If the filter is not a node-set add a
 * cast to node-set only if it is of reference type. This type coercion
 * is needed for expressions like $x where $x is a parameter reference.
 * All optimizations are turned off before type checking underlying
 * predicates.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    Type ptype = _primary.typeCheck(stable);
    boolean canOptimize = _primary instanceof KeyCall;

    if (ptype instanceof NodeSetType == false) {
        if (ptype instanceof ReferenceType)  {
            _primary = new CastExpr(_primary, Type.NodeSet);
        }
        else {
            throw new TypeCheckError(this);
        }
    }

    // Type check predicates and turn all optimizations off if appropriate
    int n = _predicates.size();
    for (int i = 0; i < n; i++) {
        Predicate pred = (Predicate) _predicates.elementAt(i);

        if (!canOptimize) {
            pred.dontOptimize();
        }
        pred.typeCheck(stable);
    }
    return _type = Type.NodeSet;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:FilterExpr.java

示例6: typeCheck

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入依赖的package包/类
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    final Type tleft = _left.typeCheck(stable);
    final MethodType ptype = lookupPrimop(stable, "u-",
                                          new MethodType(Type.Void,
                                                         tleft));

    if (ptype != null) {
        final Type arg1 = (Type) ptype.argsType().elementAt(0);
        if (!arg1.identicalTo(tleft)) {
            _left = new CastExpr(_left, arg1);
        }
        return _type = ptype.resultType();
    }

    throw new TypeCheckError(this);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:UnaryOpExpr.java

示例7: translateDesynthesized

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入依赖的package包/类
/**
 * Compile the function call and treat as an expression
 * Update true/false-lists.
 */
@Override
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen)
{
    Type type = Type.Boolean;
    if (_chosenMethodType != null)
        type = _chosenMethodType.resultType();

    final InstructionList il = methodGen.getInstructionList();
    translate(classGen, methodGen);

    if ((type instanceof BooleanType) || (type instanceof IntType)) {
        _falseList.add(il.append(new IFEQ(null)));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:FunctionCall.java

示例8: typeCheck

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入依赖的package包/类
/**
 * Type-checks the parameter. The parameter type is determined by the
 * 'select' expression (if present) or is a result tree if the parameter
 * element has a body and no 'select' expression.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_select != null) {
        _type = _select.typeCheck(stable);
        if (_type instanceof ReferenceType == false && !(_type instanceof ObjectType)) {
            _select = new CastExpr(_select, Type.Reference);
        }
    }
    else if (hasContents()) {
        typeCheckContents(stable);
    }
    _type = Type.Reference;

    // This element has no type (the parameter does, but the parameter
    // element itself does not).
    return Type.Void;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:Param.java

示例9: CastExpr

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入依赖的package包/类
/**
 * Construct a cast expression and check that the conversion is
 * valid by calling typeCheck().
 */
public CastExpr(Expression left, Type type) throws TypeCheckError {
    _left = left;
    _type = type;           // use inherited field

    if ((_left instanceof Step) && (_type == Type.Boolean)) {
        Step step = (Step)_left;
        if ((step.getAxis() == Axis.SELF) && (step.getNodeType() != -1))
            _typeTest = true;
    }

    // check if conversion is valid
    setParser(left.getParser());
    setParent(left.getParent());
    left.setParent(this);
    typeCheck(left.getParser().getSymbolTable());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:CastExpr.java

示例10: typeCheck

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入依赖的package包/类
/**
 * Type checking a cast expression amounts to verifying that the
 * type conversion is legal. Cast expressions are created during
 * type checking, but typeCheck() is usually not called on them.
 * As a result, this method is called from the constructor.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    Type tleft = _left.getType();
    if (tleft == null) {
        tleft = _left.typeCheck(stable);
    }
    if (tleft instanceof NodeType) {
        tleft = Type.Node;  // multiple instances
    }
    else if (tleft instanceof ResultTreeType) {
        tleft = Type.ResultTree; // multiple instances
    }
    if (InternalTypeMap.maps(tleft, _type) != null) {
        return _type;
    }
    // throw new TypeCheckError(this);
    throw new TypeCheckError(new ErrorMsg(
        ErrorMsg.DATA_CONVERSION_ERR, tleft.toString(), _type.toString()));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:CastExpr.java

示例11: typeCheck

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入依赖的package包/类
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    final Type tleft = _left.typeCheck(stable);
    final Type tright = _right.typeCheck(stable);
    final MethodType ptype = lookupPrimop(stable, Ops[_op],
                                          new MethodType(Type.Void,
                                                         tleft, tright));
    if (ptype != null) {
        final Type arg1 = (Type) ptype.argsType().elementAt(0);
        if (!arg1.identicalTo(tleft)) {
            _left = new CastExpr(_left, arg1);
        }
        final Type arg2 = (Type) ptype.argsType().elementAt(1);
        if (!arg2.identicalTo(tright)) {
            _right = new CastExpr(_right, arg1);
        }
        return _type = ptype.resultType();
    }
    throw new TypeCheckError(this);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:BinOpExpr.java

示例12: typeCheck

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入依赖的package包/类
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    // Type check match pattern
    _match.typeCheck(stable);

    // Cast node values to string values (except for nodesets)
    _useType = _use.typeCheck(stable);
    if (_useType instanceof StringType == false &&
        _useType instanceof NodeSetType == false)
    {
        _use = new CastExpr(_use, Type.String);
    }

    return Type.Void;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:Key.java

示例13: translate

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入依赖的package包/类
/**
 * Translate the code required for getting the node for which the
 * QName, local-name or namespace URI should be extracted.
 */
public void translate(ClassGenerator classGen,
                      MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    il.append(methodGen.loadDOM());

    // Function was called with no parameters
    if (argumentCount() == 0) {
        il.append(methodGen.loadContextNode());
    }
    // Function was called with node parameter
    else if (_paramType == Type.Node) {
        _param.translate(classGen, methodGen);
    }
    else if (_paramType == Type.Reference) {
        _param.translate(classGen, methodGen);
        il.append(new INVOKESTATIC(cpg.addMethodref
                                   (BASIS_LIBRARY_CLASS,
                                    "referenceToNodeSet",
                                    "("
                                    + OBJECT_SIG
                                    + ")"
                                    + NODE_ITERATOR_SIG)));
        il.append(methodGen.nextNode());
    }
    // Function was called with node-set parameter
    else {
        _param.translate(classGen, methodGen);
        _param.startIterator(classGen, methodGen);
        il.append(methodGen.nextNode());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:NameBase.java

示例14: translateDesynthesized

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入依赖的package包/类
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    FlowList fl;
    final Type ltype = _left.getType();

    // This is a special case for the self:: axis. Instead of letting
    // the Step object create and iterator that we cast back to a single
    // node, we simply ask the DOM for the node type.
    if (_typeTest) {
        final ConstantPoolGen cpg = classGen.getConstantPool();
        final InstructionList il = methodGen.getInstructionList();

        final int idx = cpg.addInterfaceMethodref(DOM_INTF,
                                                  "getExpandedTypeID",
                                                  "(I)I");
        il.append(new SIPUSH((short)((Step)_left).getNodeType()));
        il.append(methodGen.loadDOM());
        il.append(methodGen.loadContextNode());
        il.append(new INVOKEINTERFACE(idx, 2));
        _falseList.add(il.append(new IF_ICMPNE(null)));
    }
    else {

        _left.translate(classGen, methodGen);
        if (_type != ltype) {
            _left.startIterator(classGen, methodGen);
            if (_type instanceof BooleanType) {
                fl = ltype.translateToDesynthesized(classGen, methodGen,
                                                    _type);
                if (fl != null) {
                    _falseList.append(fl);
                }
            }
            else {
                ltype.translateTo(classGen, methodGen, _type);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:CastExpr.java

示例15: typeCheck

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入依赖的package包/类
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    final Type entity = _entity.typeCheck(stable);
    if (entity instanceof StringType == false) {
        _entity = new CastExpr(_entity, Type.String);
    }
    return _type = Type.String;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:UnparsedEntityUriCall.java


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