public void prepareAttributes() throws XPathException { if (state == 2) { return; } if (state == 1) { compileError("Circular reference to variable", "XTDE0640"); } state = 1; //System.err.println("Prepare attributes of $" + getVariableName()); sourceBinding.prepareAttributes(getPermittedAttributes()); state = 2; }
public void prepareAttributes() throws XPathException { if (state == 2) { return; } if (state == 1) { compileError("Circular reference to variable", "XTDE0640"); } state = 1; //System.err.println("Prepare attributes of $" + getVariableName()); sourceBinding.prepareAttributes(getPermittedAttributes()); state = 2; }
StyleElement v2 = otherVarDecl.getSourceElement(); if (v2 == varDecl) { varDecl.compileError( "Global variable or parameter $" + qName.getDisplayName() + " is declared more than once " + "(caused by including the containing module more than once)", "XTSE0630"); } else { varDecl.compileError("Duplicate global variable/parameter declaration (see line " + v2.getLineNumber() + " of " + v2.getSystemId() + ')', "XTSE0630"); } else { String kind = varDecl instanceof XSLGlobalParam ? "parameter" : "variable"; varDecl.compileError("Global " + kind + " $" + sName.getComponentName().getDisplayName() + " conflicts with a public variable/parameter in package " + other.getDeclaringPackage().getPackageName(), "XTSE3050");
public void checkCompatibility(Component component) { SequenceType st1 = getSourceBinding().getDeclaredType(); if (st1 == null) { st1 = SequenceType.ANY_SEQUENCE; } GlobalVariable other = (GlobalVariable) component.getActor(); TypeHierarchy th = component.getDeclaringPackage().getConfiguration().getTypeHierarchy(); int relation = th.sequenceTypeRelationship(st1, other.getRequiredType()); if (relation != TypeHierarchy.SAME_TYPE) { compileError( "The declared type of the overriding variable $" + getVariableQName().getDisplayName() + " is different from that of the overridden variable", "XTSE3070"); } }
public void checkCompatibility(Component component) { SequenceType st1 = getSourceBinding().getDeclaredType(); if (st1 == null) { st1 = SequenceType.ANY_SEQUENCE; } GlobalVariable other = (GlobalVariable) component.getActor(); TypeHierarchy th = component.getDeclaringPackage().getConfiguration().getTypeHierarchy(); int relation = th.sequenceTypeRelationship(st1, other.getRequiredType()); if (relation != TypeHierarchy.SAME_TYPE) { compileError( "The declared type of the overriding variable $" + getVariableQName().getDisplayName() + " is different from that of the overridden variable", "XTSE3070"); } }
StyleElement v2 = otherVarDecl.getSourceElement(); if (v2 == varDecl) { varDecl.compileError( "Global variable or parameter $" + qName.getDisplayName() + " is declared more than once " + "(caused by including the containing module more than once)", "XTSE0630"); } else { varDecl.compileError("Duplicate global variable/parameter declaration (see line " + v2.getLineNumber() + " of " + v2.getSystemId() + ')', "XTSE0630"); } else { String kind = varDecl instanceof XSLGlobalParam ? "parameter" : "variable"; varDecl.compileError("Global " + kind + " $" + sName.getComponentName().getDisplayName() + " conflicts with a public variable/parameter in package " + other.getDeclaringPackage().getPackageName(), "XTSE3050");
/** * Initialize - common code called from the compile() method of all subclasses * * @param var the representation of the variable declaration in the compiled executable */ protected void initializeBinding(GlobalVariable var) { Expression select = var.getSelectExpression(); Expression exp2 = select; if (exp2 != null) { try { ExpressionVisitor visitor = makeExpressionVisitor(); exp2 = select.simplify().typeCheck(visitor, getConfiguration().makeContextItemStaticInfo(Type.ITEM_TYPE, true)); } catch (XPathException err) { compileError(err); } // Add trace wrapper code if required exp2 = makeTraceInstruction(this, exp2); allocateLocalSlots(exp2); } if (slotManager != null && slotManager.getNumberOfVariables() > 0) { var.setContainsLocals(slotManager); } //StylesheetPackage pack = getCompilation().getStylesheetPackage(); //pack.registerGlobalVariable(gvar); if (exp2 != select) { var.setSelectExpression(exp2); } }
/** * Initialize - common code called from the compile() method of all subclasses * * @param var the representation of the variable declaration in the compiled executable */ protected void initializeBinding(GlobalVariable var) { Expression select = var.getSelectExpression(); Expression exp2 = select; if (exp2 != null) { try { ExpressionVisitor visitor = makeExpressionVisitor(); exp2 = select.simplify().typeCheck(visitor, getConfiguration().makeContextItemStaticInfo(Type.ITEM_TYPE, true)); } catch (XPathException err) { compileError(err); } // Add trace wrapper code if required exp2 = makeTraceInstruction(this, exp2); allocateLocalSlots(exp2); } if (slotManager != null && slotManager.getNumberOfVariables() > 0) { var.setContainsLocals(slotManager); } //StylesheetPackage pack = getCompilation().getStylesheetPackage(); //pack.registerGlobalVariable(gvar); if (exp2 != select) { var.setSelectExpression(exp2); } }