예제 #1
0
 /**
  * Refine the type information associated with this variable declaration. This is useful when the
  * type of the variable has not been explicitly declared (which is common); the variable then
  * takes a static type based on the type of the expression to which it is bound. The effect of
  * this call is to update the static expression type for all references to this variable.
  *
  * @param type the inferred item type of the expression to which the variable is bound
  * @param cardinality the inferred cardinality of the expression to which the variable is bound
  * @param constantValue the constant value to which the variable is bound (null if there is no
  *     constant value)
  * @param properties other static properties of the expression to which the variable is bound
  * @param visitor an expression visitor to provide context information
  * @param currentExpression the expression that binds the variable
  */
 public void refineTypeInformation(
     ItemType type,
     int cardinality,
     Value constantValue,
     int properties,
     ExpressionVisitor visitor,
     Assignation currentExpression) {
   List references = new ArrayList();
   ExpressionTool.gatherVariableReferences(currentExpression.getAction(), this, references);
   for (Iterator iter = references.iterator(); iter.hasNext(); ) {
     BindingReference ref = (BindingReference) iter.next();
     if (ref instanceof VariableReference) {
       ((VariableReference) ref)
           .refineVariableType(type, cardinality, constantValue, properties, visitor);
       visitor.resetStaticProperties();
     }
   }
 }