예제 #1
0
 /**
  * Run initialization analysis on this expression. The init parameter provides access to the
  * initialization analysis phase (in particular, to the associated error handler), and the
  * initialized parameter reflects the set of variables that are known to have been initialized
  * before this expression is evaluated. The return result is the set of variables that are known
  * to be initialized after the expression has been evaluated. Because there are no side-effecting
  * operations in the mini language described here, the return result is actually the same as the
  * input value for initialized in all cases. But, of course, this could change in future if new
  * constructs were added to the language ...
  */
 public VarSet analyze(InitAnalysis init, VarSet initialized) {
   if (!VarSet.includes(v, initialized)) {
     init.report(
         new Failure(
             pos, "The variable \"" + this + "\" may be used before it has been initialized"));
   }
   return initialized;
 }
예제 #2
0
 /**
  * Add an entry for the variable (i.e., environment entry) that is associated with this identifier
  * to the given set of variables if it is not already included.
  */
 VarSet addTo(VarSet vars) {
   return VarSet.includes(v, vars) ? vars : new VarSet(v, vars);
 }