com.sun.org.apache.xalan.internal.xsltc.compiler.util.ReferenceType Java Examples

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.compiler.util.ReferenceType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApplyTemplates.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_select != null) {
        _type = _select.typeCheck(stable);
        if (_type instanceof NodeType || _type instanceof ReferenceType) {
            _select = new CastExpr(_select, Type.NodeSet);
            _type = Type.NodeSet;
        }
        if (_type instanceof NodeSetType||_type instanceof ResultTreeType) {
            typeCheckContents(stable); // with-params
            return Type.Void;
        }
        throw new TypeCheckError(this);
    }
    else {
        typeCheckContents(stable);          // with-params
        return Type.Void;
    }
}
 
Example #2
Source File: Param.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #3
Source File: Param.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #4
Source File: ApplyTemplates.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_select != null) {
        _type = _select.typeCheck(stable);
        if (_type instanceof NodeType || _type instanceof ReferenceType) {
            _select = new CastExpr(_select, Type.NodeSet);
            _type = Type.NodeSet;
        }
        if (_type instanceof NodeSetType||_type instanceof ResultTreeType) {
            typeCheckContents(stable); // with-params
            return Type.Void;
        }
        throw new TypeCheckError(this);
    }
    else {
        typeCheckContents(stable);          // with-params
        return Type.Void;
    }
}
 
Example #5
Source File: FilterExpr.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #6
Source File: Param.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #7
Source File: FilterExpr.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #8
Source File: ApplyTemplates.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_select != null) {
        _type = _select.typeCheck(stable);
        if (_type instanceof NodeType || _type instanceof ReferenceType) {
            _select = new CastExpr(_select, Type.NodeSet);
            _type = Type.NodeSet;
        }
        if (_type instanceof NodeSetType||_type instanceof ResultTreeType) {
            typeCheckContents(stable); // with-params
            return Type.Void;
        }
        throw new TypeCheckError(this);
    }
    else {
        typeCheckContents(stable);          // with-params
        return Type.Void;
    }
}
 
Example #9
Source File: Param.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #10
Source File: FilterExpr.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #11
Source File: ApplyTemplates.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_select != null) {
        _type = _select.typeCheck(stable);
        if (_type instanceof NodeType || _type instanceof ReferenceType) {
            _select = new CastExpr(_select, Type.NodeSet);
            _type = Type.NodeSet;
        }
        if (_type instanceof NodeSetType||_type instanceof ResultTreeType) {
            typeCheckContents(stable); // with-params
            return Type.Void;
        }
        throw new TypeCheckError(this);
    }
    else {
        typeCheckContents(stable);          // with-params
        return Type.Void;
    }
}
 
Example #12
Source File: ApplyTemplates.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_select != null) {
        _type = _select.typeCheck(stable);
        if (_type instanceof NodeType || _type instanceof ReferenceType) {
            _select = new CastExpr(_select, Type.NodeSet);
            _type = Type.NodeSet;
        }
        if (_type instanceof NodeSetType||_type instanceof ResultTreeType) {
            typeCheckContents(stable); // with-params
            return Type.Void;
        }
        throw new TypeCheckError(this);
    }
    else {
        typeCheckContents(stable);          // with-params
        return Type.Void;
    }
}
 
Example #13
Source File: FilterExpr.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example #14
Source File: FilterExpr.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * 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.get(i);

        if (!canOptimize) {
            pred.dontOptimize();
        }
        pred.typeCheck(stable);
    }
    return _type = Type.NodeSet;
}
 
Example #15
Source File: Param.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #16
Source File: ApplyTemplates.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_select != null) {
        _type = _select.typeCheck(stable);
        if (_type instanceof NodeType || _type instanceof ReferenceType) {
            _select = new CastExpr(_select, Type.NodeSet);
            _type = Type.NodeSet;
        }
        if (_type instanceof NodeSetType||_type instanceof ResultTreeType) {
            typeCheckContents(stable); // with-params
            return Type.Void;
        }
        throw new TypeCheckError(this);
    }
    else {
        typeCheckContents(stable);          // with-params
        return Type.Void;
    }
}
 
Example #17
Source File: Param.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #18
Source File: ApplyTemplates.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_select != null) {
        _type = _select.typeCheck(stable);
        if (_type instanceof NodeType || _type instanceof ReferenceType) {
            _select = new CastExpr(_select, Type.NodeSet);
            _type = Type.NodeSet;
        }
        if (_type instanceof NodeSetType||_type instanceof ResultTreeType) {
            typeCheckContents(stable); // with-params
            return Type.Void;
        }
        throw new TypeCheckError(this);
    }
    else {
        typeCheckContents(stable);          // with-params
        return Type.Void;
    }
}
 
Example #19
Source File: FilterExpr.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #20
Source File: Param.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example #21
Source File: Param.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #22
Source File: ForEach.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    _type = _select.typeCheck(stable);

    if (_type instanceof ReferenceType || _type instanceof NodeType) {
        _select = new CastExpr(_select, Type.NodeSet);
        typeCheckContents(stable);
        return Type.Void;
    }
    if (_type instanceof NodeSetType||_type instanceof ResultTreeType) {
        typeCheckContents(stable);
        return Type.Void;
    }
    throw new TypeCheckError(this);
}
 
Example #23
Source File: CopyOf.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    final Type tselect = _select.typeCheck(stable);
    if (tselect instanceof NodeType ||
        tselect instanceof NodeSetType ||
        tselect instanceof ReferenceType ||
        tselect instanceof ResultTreeType) {
        // falls through
    }
    else {
        _select = new CastExpr(_select, Type.String);
    }
    return Type.Void;
}
 
Example #24
Source File: FilterParentPath.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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/LINE where $x is a parameter reference.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    final Type ftype = _filterExpr.typeCheck(stable);
    if (ftype instanceof NodeSetType == false) {
        if (ftype instanceof ReferenceType)  {
            _filterExpr = new CastExpr(_filterExpr, Type.NodeSet);
        }
        /*
        else if (ftype instanceof ResultTreeType)  {
            _filterExpr = new CastExpr(_filterExpr, Type.NodeSet);
        }
        */
        else if (ftype instanceof NodeType)  {
            _filterExpr = new CastExpr(_filterExpr, Type.NodeSet);
        }
        else {
            throw new TypeCheckError(this);
        }
    }

    // Wrap single node path in a node set
    final Type ptype = _path.typeCheck(stable);
    if (!(ptype instanceof NodeSetType)) {
        _path = new CastExpr(_path, Type.NodeSet);
    }

    return _type = Type.NodeSet;
}
 
Example #25
Source File: ForEach.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    _type = _select.typeCheck(stable);

    if (_type instanceof ReferenceType || _type instanceof NodeType) {
        _select = new CastExpr(_select, Type.NodeSet);
        typeCheckContents(stable);
        return Type.Void;
    }
    if (_type instanceof NodeSetType||_type instanceof ResultTreeType) {
        typeCheckContents(stable);
        return Type.Void;
    }
    throw new TypeCheckError(this);
}
 
Example #26
Source File: WithParam.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Type-check either the select attribute or the element body, depending
 * on which is in use.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_select != null) {
        final Type tselect = _select.typeCheck(stable);
        if (tselect instanceof ReferenceType == false) {
            _select = new CastExpr(_select, Type.Reference);
        }
    } else {
        typeCheckContents(stable);
    }
    return Type.Void;
}
 
Example #27
Source File: WithParam.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Type-check either the select attribute or the element body, depending
 * on which is in use.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_select != null) {
        final Type tselect = _select.typeCheck(stable);
        if (tselect instanceof ReferenceType == false) {
            _select = new CastExpr(_select, Type.Reference);
        }
    } else {
        typeCheckContents(stable);
    }
    return Type.Void;
}
 
Example #28
Source File: ForEach.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    _type = _select.typeCheck(stable);

    if (_type instanceof ReferenceType || _type instanceof NodeType) {
        _select = new CastExpr(_select, Type.NodeSet);
        typeCheckContents(stable);
        return Type.Void;
    }
    if (_type instanceof NodeSetType||_type instanceof ResultTreeType) {
        typeCheckContents(stable);
        return Type.Void;
    }
    throw new TypeCheckError(this);
}
 
Example #29
Source File: WithParam.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Type-check either the select attribute or the element body, depending
 * on which is in use.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_select != null) {
        final Type tselect = _select.typeCheck(stable);
        if (tselect instanceof ReferenceType == false) {
            _select = new CastExpr(_select, Type.Reference);
        }
    }
    else {
        typeCheckContents(stable);
    }
    return Type.Void;
}
 
Example #30
Source File: WithParam.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Type-check either the select attribute or the element body, depending
 * on which is in use.
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
    if (_select != null) {
        final Type tselect = _select.typeCheck(stable);
        if (tselect instanceof ReferenceType == false) {
            _select = new CastExpr(_select, Type.Reference);
        }
    } else {
        typeCheckContents(stable);
    }
    return Type.Void;
}