/** * Ask whether the global variable is declared with assignable="yes" * * @return true if assignabl="yes" was specified */ public boolean isAssignable() { return sourceBinding.hasProperty(SourceBinding.ASSIGNABLE); }
/** * Ask whether the global variable is declared with assignable="yes" * * @return true if assignabl="yes" was specified */ public boolean isAssignable() { return sourceBinding.hasProperty(SourceBinding.ASSIGNABLE); }
public boolean isTunnelParam() { return sourceBinding.hasProperty(SourceBinding.TUNNEL); }
public boolean isTunnelParam() { return sourceBinding.hasProperty(SourceBinding.TUNNEL); }
public boolean isStatic() { return hasProperty(STATIC); }
public boolean isStatic() { return hasProperty(STATIC); }
public boolean isTunnelParam() { return sourceBinding.hasProperty(SourceBinding.TUNNEL); }
public boolean isRequiredParam() { return sourceBinding.hasProperty(SourceBinding.REQUIRED); }
public boolean isTunnelParam() { return sourceBinding.hasProperty(SourceBinding.TUNNEL); }
public boolean isRequiredParam() { return sourceBinding.hasProperty(SourceBinding.REQUIRED); }
public GroundedValue<?> getConstantValue() { if (constantValue == null) { final SequenceType type = getInferredType(true); final TypeHierarchy th = sourceElement.getConfiguration().getTypeHierarchy(); if (!hasProperty(ASSIGNABLE) && !hasProperty(PARAM) && !(visibility == Visibility.PUBLIC || visibility == Visibility.ABSTRACT)) { if (select instanceof Literal) { // we can't rely on the constant value because it hasn't yet been type-checked, // which could change it (eg by numeric promotion). Rather than attempt all the type-checking // now, we do a quick check. See test bug64 int relation = th.relationship(select.getItemType(), type.getPrimaryType()); if (relation == TypeHierarchy.SAME_TYPE || relation == TypeHierarchy.SUBSUMED_BY) { constantValue = ((Literal) select).getValue(); } } } } return constantValue; }
public GroundedValue<?> getConstantValue() { if (constantValue == null) { final SequenceType type = getInferredType(true); final TypeHierarchy th = sourceElement.getConfiguration().getTypeHierarchy(); if (!hasProperty(ASSIGNABLE) && !hasProperty(PARAM) && !(visibility == Visibility.PUBLIC || visibility == Visibility.ABSTRACT)) { if (select instanceof Literal) { // we can't rely on the constant value because it hasn't yet been type-checked, // which could change it (eg by numeric promotion). Rather than attempt all the type-checking // now, we do a quick check. See test bug64 int relation = th.relationship(select.getItemType(), type.getPrimaryType()); if (relation == TypeHierarchy.SAME_TYPE || relation == TypeHierarchy.SUBSUMED_BY) { constantValue = ((Literal) select).getValue(); } } } } return constantValue; }
GroundedValue constantValue = null; int properties = 0; if (!hasProperty(ASSIGNABLE) && !hasProperty(PARAM) && !(visibility == Visibility.PUBLIC || visibility == Visibility.ABSTRACT)) {
@Override public void prepareAttributes() throws XPathException { if (!prepared) { prepared = true; sourceBinding.setProperty(SourceBinding.PARAM, true); if (getParent() instanceof XSLFunction) { permittedAttributes &= ~SourceBinding.SELECT; sourceBinding.setProperty(SourceBinding.DISALLOWS_CONTENT, true); } sourceBinding.prepareAttributes(permittedAttributes); if (sourceBinding.hasProperty(SourceBinding.TUNNEL) && !(getParent() instanceof XSLTemplate)) { compileError("For attribute 'tunnel' within an " + getParent().getDisplayName() + " parameter, the only permitted value is 'no'", "XTSE0020"); } if (getParent() instanceof XSLFunction && getAttributeValue("", "required") != null) { if (!sourceBinding.hasProperty(SourceBinding.REQUIRED)) { compileError("For attribute 'required' within an " + getParent().getDisplayName() + " parameter, the only permitted value is 'yes'", "XTSE0020"); } } } }
@Override public void prepareAttributes() throws XPathException { if (!prepared) { prepared = true; sourceBinding.setProperty(SourceBinding.PARAM, true); if (getParent() instanceof XSLFunction) { permittedAttributes &= ~SourceBinding.SELECT; sourceBinding.setProperty(SourceBinding.DISALLOWS_CONTENT, true); } sourceBinding.prepareAttributes(permittedAttributes); if (sourceBinding.hasProperty(SourceBinding.TUNNEL) && !(getParent() instanceof XSLTemplate)) { compileError("For attribute 'tunnel' within an " + getParent().getDisplayName() + " parameter, the only permitted value is 'no'", "XTSE0020"); } if (getParent() instanceof XSLFunction && getAttributeValue("", "required") != null) { if (!sourceBinding.hasProperty(SourceBinding.REQUIRED)) { compileError("For attribute 'required' within an " + getParent().getDisplayName() + " parameter, the only permitted value is 'yes'", "XTSE0020"); } } } }
public void validate(ComponentDeclaration decl) throws XPathException { if (sourceBinding.hasProperty(SourceBinding.REQUIRED)) { if (sourceBinding.getSelectExpression() != null) { // NB, we do this test before setting the default select attribute compileError("The select attribute must be absent when required='yes'", "XTSE0010"); } if (hasChildNodes()) { compileError("A parameter specifying required='yes' must have empty content", "XTSE0010"); } Visibility vis = getVisibility(); if (!sourceBinding.isStatic() && !(vis == Visibility.PUBLIC || vis == Visibility.FINAL || vis == Visibility.ABSTRACT)) { compileError("The visibility of a required non-static parameter must be public, final, or abstract", "XTSE3370"); } } super.validate(decl); }
public void validate(ComponentDeclaration decl) throws XPathException { if (sourceBinding.hasProperty(SourceBinding.REQUIRED)) { if (sourceBinding.getSelectExpression() != null) { // NB, we do this test before setting the default select attribute compileError("The select attribute must be absent when required='yes'", "XTSE0010"); } if (hasChildNodes()) { compileError("A parameter specifying required='yes' must have empty content", "XTSE0010"); } Visibility vis = getVisibility(); if (!sourceBinding.isStatic() && !(vis == Visibility.PUBLIC || vis == Visibility.FINAL || vis == Visibility.ABSTRACT)) { compileError("The visibility of a required non-static parameter must be public, final, or abstract", "XTSE3370"); } } super.validate(decl); }
/** * Validate the declaration * * @throws XPathException if the declaration is invalid */ public void validate() throws XPathException { if (select != null && sourceElement.hasChildNodes()) { sourceElement.compileError("An " + sourceElement.getDisplayName() + " element with a select attribute must be empty", "XTSE0620"); } if (hasProperty(DISALLOWS_CONTENT) && sourceElement.hasChildNodes()) { if (isStatic()) { sourceElement.compileError("A static variable or parameter must have no content", "XTSE0010"); } else { sourceElement.compileError("Within xsl:function, an xsl:param element must have no content", "XTSE0620"); } } if (visibility == Visibility.ABSTRACT && (select != null || sourceElement.hasChildNodes())) { sourceElement.compileError("An abstract variable must have no select attribute and no content", "XTSE0620"); } }
/** * Validate the declaration * * @throws XPathException if the declaration is invalid */ public void validate() throws XPathException { if (select != null && sourceElement.hasChildNodes()) { sourceElement.compileError("An " + sourceElement.getDisplayName() + " element with a select attribute must be empty", "XTSE0620"); } if (hasProperty(DISALLOWS_CONTENT) && sourceElement.hasChildNodes()) { if (isStatic()) { sourceElement.compileError("A static variable or parameter must have no content", "XTSE0010"); } else { sourceElement.compileError("Within xsl:function, an xsl:param element must have no content", "XTSE0620"); } } if (visibility == Visibility.ABSTRACT && (select != null || sourceElement.hasChildNodes())) { sourceElement.compileError("An abstract variable must have no select attribute and no content", "XTSE0620"); } }
/** * Compile a global xsl:param element: this ensures space is available for local variables declared within * this global variable */ public void compileDeclaration(Compilation compilation, ComponentDeclaration decl) throws XPathException { if (sourceBinding.isStatic()) { super.compileDeclaration(compilation, decl); } else if (!redundant) { sourceBinding.handleSequenceConstructor(compilation, decl); GlobalParam binding = (GlobalParam)compiledVariable; binding.setPackageData(getCompilation().getPackageData()); binding.makeDeclaringComponent(Visibility.PUBLIC, getContainingPackage()); Expression select = sourceBinding.getSelectExpression(); binding.setSelectExpression(select); binding.setVariableQName(sourceBinding.getVariableQName()); initializeBinding(binding); binding.setRequiredType(getRequiredType()); binding.setRequiredParam(sourceBinding.hasProperty(SourceBinding.REQUIRED)); binding.setImplicitlyRequiredParam(sourceBinding.hasProperty(SourceBinding.IMPLICITLY_REQUIRED)); sourceBinding.fixupBinding(binding); //compiledVariable = binding; Component overridden = getOverriddenComponent(); if (overridden != null) { checkCompatibility(overridden); } } }