001    /* This file was generated with JastAdd2 (http://jastadd.org) version 2.1.13-12-g880e696 */
002    package org.extendj.ast;
003    
004    import java.util.HashSet;
005    import java.io.File;
006    import java.util.Set;
007    import java.util.Collections;
008    import java.util.Collection;
009    import java.util.ArrayList;
010    import beaver.*;
011    import java.util.*;
012    import java.io.ByteArrayOutputStream;
013    import java.io.PrintStream;
014    import java.lang.reflect.InvocationTargetException;
015    import java.lang.reflect.Method;
016    import org.jastadd.util.*;
017    import java.util.zip.*;
018    import java.io.*;
019    import org.jastadd.util.PrettyPrintable;
020    import org.jastadd.util.PrettyPrinter;
021    import java.io.FileNotFoundException;
022    import java.io.BufferedInputStream;
023    import java.io.DataInputStream;
024    /**
025     * @ast node
026     * @declaredat /home/jesper/git/extendj/java4/grammar/Java.ast:210
027     * @production ReturnStmt : {@link Stmt} ::= <span class="component">[Result:{@link Expr}]</span> <span class="component">[Finally:{@link Block}]</span>;
028    
029     */
030    public class ReturnStmt extends Stmt implements Cloneable {
031      /**
032       * @aspect BranchTarget
033       * @declaredat /home/jesper/git/extendj/java4/frontend/BranchTarget.jrag:104
034       */
035      public void collectBranches(Collection<Stmt> c) {
036        c.add(this);
037      }
038      /**
039       * @aspect NodeConstructors
040       * @declaredat /home/jesper/git/extendj/java4/frontend/NodeConstructors.jrag:73
041       */
042      public ReturnStmt(Expr expr) {
043        this(new Opt(expr));
044      }
045      /**
046       * @aspect Java4PrettyPrint
047       * @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrint.jadd:219
048       */
049      public void prettyPrint(PrettyPrinter out) {
050        out.print("return");
051        if (hasResult()) {
052          out.print(" ");
053          out.print(getResult());
054        }
055        out.print(";");
056      }
057      /**
058       * @aspect CreateBCode
059       * @declaredat /home/jesper/git/extendj/java4/backend/CreateBCode.jrag:1669
060       */
061      public void createBCode(CodeGeneration gen) {
062        super.createBCode(gen);
063        if (hasResult()) {
064          TypeDecl type = null;
065          BodyDecl b = enclosingBodyDecl();
066          if (b instanceof MethodDecl) {
067            type = ((MethodDecl) b).type();
068          } else {
069            throw new Error("Can not create code that returns value within non method");
070          }
071          getResult().createBCode(gen);
072          getResult().type().emitCastTo(gen, type);
073          if (hasFinally()) {
074            int nextRange = gen.constantPool().newLabel();
075            type.emitStoreLocal(gen, resultSaveLocalNum());
076            getFinally().createBCode(gen);
077            type.emitLoadLocal(gen, resultSaveLocalNum());
078            type.emitReturn(gen);
079            gen.addLabel(nextRange);
080            gen.monitorRangesStart(this, nextRange);
081          } else {
082            type.emitReturn(gen);
083          }
084        } else {
085          if (hasFinally()) {
086            int nextRange = gen.constantPool().newLabel();
087            getFinally().createBCode(gen);
088            gen.emitReturn();
089            gen.addLabel(nextRange);
090            gen.monitorRangesStart(this, nextRange);
091          } else {
092            gen.emitReturn();
093          }
094        }
095      }
096      /**
097       * @declaredat ASTNode:1
098       */
099      public ReturnStmt() {
100        super();
101      }
102      /**
103       * Initializes the child array to the correct size.
104       * Initializes List and Opt nta children.
105       * @apilevel internal
106       * @ast method
107       * @declaredat ASTNode:10
108       */
109      public void init$Children() {
110        children = new ASTNode[2];
111        setChild(new Opt(), 0);
112        setChild(new Opt(), 1);
113      }
114      /**
115       * @declaredat ASTNode:15
116       */
117      public ReturnStmt(Opt<Expr> p0) {
118        setChild(p0, 0);
119      }
120      /**
121       * @apilevel low-level
122       * @declaredat ASTNode:21
123       */
124      protected int numChildren() {
125        return 1;
126      }
127      /**
128       * @apilevel internal
129       * @declaredat ASTNode:27
130       */
131      public boolean mayHaveRewrite() {
132        return false;
133      }
134      /**
135       * @apilevel internal
136       * @declaredat ASTNode:33
137       */
138      public void flushAttrCache() {
139        super.flushAttrCache();
140        isDAafter_Variable_reset();
141        isDUafterReachedFinallyBlocks_Variable_reset();
142        isDAafterReachedFinallyBlocks_Variable_reset();
143        isDUafter_Variable_reset();
144        getFinallyOpt_reset();
145        canCompleteNormally_reset();
146        resultSaveLocalNum_reset();
147        enclosingLambda_reset();
148      }
149      /**
150       * @apilevel internal
151       * @declaredat ASTNode:47
152       */
153      public void flushCollectionCache() {
154        super.flushCollectionCache();
155      }
156      /**
157       * @apilevel internal
158       * @declaredat ASTNode:53
159       */
160      public void flushRewriteCache() {
161        super.flushRewriteCache();
162      }
163      /**
164       * @apilevel internal
165       * @declaredat ASTNode:59
166       */
167      public ReturnStmt clone() throws CloneNotSupportedException {
168        ReturnStmt node = (ReturnStmt) super.clone();
169        return node;
170      }
171      /**
172       * @apilevel internal
173       * @declaredat ASTNode:66
174       */
175      public ReturnStmt copy() {
176        try {
177          ReturnStmt node = (ReturnStmt) clone();
178          node.parent = null;
179          if (children != null) {
180            node.children = (ASTNode[]) children.clone();
181          }
182          return node;
183        } catch (CloneNotSupportedException e) {
184          throw new Error("Error: clone not supported for " + getClass().getName());
185        }
186      }
187      /**
188       * Create a deep copy of the AST subtree at this node.
189       * The copy is dangling, i.e. has no parent.
190       * @return dangling copy of the subtree at this node
191       * @apilevel low-level
192       * @deprecated Please use treeCopy or treeCopyNoTransform instead
193       * @declaredat ASTNode:85
194       */
195      @Deprecated
196      public ReturnStmt fullCopy() {
197        return treeCopyNoTransform();
198      }
199      /**
200       * Create a deep copy of the AST subtree at this node.
201       * The copy is dangling, i.e. has no parent.
202       * @return dangling copy of the subtree at this node
203       * @apilevel low-level
204       * @declaredat ASTNode:95
205       */
206      public ReturnStmt treeCopyNoTransform() {
207        ReturnStmt tree = (ReturnStmt) copy();
208        if (children != null) {
209          for (int i = 0; i < children.length; ++i) {
210            switch (i) {
211            case 1:
212              tree.children[i] = new Opt();
213              continue;
214            }
215            ASTNode child = (ASTNode) children[i];
216            if (child != null) {
217              child = child.treeCopyNoTransform();
218              tree.setChild(child, i);
219            }
220          }
221        }
222        return tree;
223      }
224      /**
225       * Create a deep copy of the AST subtree at this node.
226       * The subtree of this node is traversed to trigger rewrites before copy.
227       * The copy is dangling, i.e. has no parent.
228       * @return dangling copy of the subtree at this node
229       * @apilevel low-level
230       * @declaredat ASTNode:120
231       */
232      public ReturnStmt treeCopy() {
233        doFullTraversal();
234        return treeCopyNoTransform();
235      }
236      /**
237       * @apilevel internal
238       * @declaredat ASTNode:127
239       */
240      protected boolean is$Equal(ASTNode node) {
241        return super.is$Equal(node);    
242      }
243      /**
244       * Replaces the optional node for the Result child. This is the <code>Opt</code>
245       * node containing the child Result, not the actual child!
246       * @param opt The new node to be used as the optional node for the Result child.
247       * @apilevel low-level
248       */
249      public void setResultOpt(Opt<Expr> opt) {
250        setChild(opt, 0);
251      }
252      /**
253       * Replaces the (optional) Result child.
254       * @param node The new node to be used as the Result child.
255       * @apilevel high-level
256       */
257      public void setResult(Expr node) {
258        getResultOpt().setChild(node, 0);
259      }
260      /**
261       * Check whether the optional Result child exists.
262       * @return {@code true} if the optional Result child exists, {@code false} if it does not.
263       * @apilevel high-level
264       */
265      public boolean hasResult() {
266        return getResultOpt().getNumChild() != 0;
267      }
268      /**
269       * Retrieves the (optional) Result child.
270       * @return The Result child, if it exists. Returns {@code null} otherwise.
271       * @apilevel low-level
272       */
273      public Expr getResult() {
274        return (Expr) getResultOpt().getChild(0);
275      }
276      /**
277       * Retrieves the optional node for the Result child. This is the <code>Opt</code> node containing the child Result, not the actual child!
278       * @return The optional node for child the Result child.
279       * @apilevel low-level
280       */
281      @ASTNodeAnnotation.OptChild(name="Result")
282      public Opt<Expr> getResultOpt() {
283        return (Opt<Expr>) getChild(0);
284      }
285      /**
286       * Retrieves the optional node for child Result. This is the <code>Opt</code> node containing the child Result, not the actual child!
287       * <p><em>This method does not invoke AST transformations.</em></p>
288       * @return The optional node for child Result.
289       * @apilevel low-level
290       */
291      public Opt<Expr> getResultOptNoTransform() {
292        return (Opt<Expr>) getChildNoTransform(0);
293      }
294      /**
295       * Replaces the (optional) Finally child.
296       * @param node The new node to be used as the Finally child.
297       * @apilevel high-level
298       */
299      public void setFinally(Block node) {
300        getFinallyOpt().setChild(node, 0);
301      }
302      /**
303       * Check whether the optional Finally child exists.
304       * @return {@code true} if the optional Finally child exists, {@code false} if it does not.
305       * @apilevel high-level
306       */
307      public boolean hasFinally() {
308        return getFinallyOpt().getNumChild() != 0;
309      }
310      /**
311       * Retrieves the (optional) Finally child.
312       * @return The Finally child, if it exists. Returns {@code null} otherwise.
313       * @apilevel low-level
314       */
315      public Block getFinally() {
316        return (Block) getFinallyOpt().getChild(0);
317      }
318      /**
319       * Retrieves the optional node for child Finally. This is the <code>Opt</code> node containing the child Finally, not the actual child!
320       * <p><em>This method does not invoke AST transformations.</em></p>
321       * @return The optional node for child Finally.
322       * @apilevel low-level
323       */
324      public Opt<Block> getFinallyOptNoTransform() {
325        return (Opt<Block>) getChildNoTransform(1);
326      }
327      /**
328       * Retrieves the child position of the optional child Finally.
329       * @return The the child position of the optional child Finally.
330       * @apilevel low-level
331       */
332      protected int getFinallyOptChildPosition() {
333        return 1;
334      }
335      /**
336       * @aspect TypeCheck
337       * @declaredat /home/jesper/git/extendj/java8/frontend/TypeCheck.jrag:196
338       */
339       
340      public void typeCheck() {
341        if (enclosingLambda() == null || enclosingLambda().hostType() != hostType()) {
342          if (hasResult() && !returnType().isVoid()) {
343            if (!getResult().type().assignConversionTo(returnType(), getResult())) {
344              errorf("return value must be an instance of %s which %s is not",
345                  returnType().typeName(), getResult().type().typeName());
346            }
347          }
348          // 8.4.5 8.8.5
349          if (returnType().isVoid() && hasResult()) {
350            error("return stmt may not have an expression in void methods");
351          }
352          // 8.4.5
353          if (!returnType().isVoid() && !hasResult()) {
354            error("return stmt must have an expression in non void methods");
355          }
356          if (enclosingBodyDecl() instanceof InstanceInitializer
357              || enclosingBodyDecl() instanceof StaticInitializer) {
358            error("Initializers may not return");
359          }
360        } else {
361          if (hasResult() && !returnType().isVoid() && !(getResult() instanceof LambdaExpr)) {
362            if (!getResult().type().assignConversionTo(returnType(), getResult())) {
363              errorf("return value must be an instance of %s which %s is not",
364                  returnType().typeName(), getResult().type().typeName());
365            }
366          }
367        }
368      }
369      /**
370       * @apilevel internal
371       */
372      protected java.util.Map isDAafter_Variable_values;
373      /**
374       * @apilevel internal
375       */
376      private void isDAafter_Variable_reset() {
377        isDAafter_Variable_values = null;
378      }
379      /**
380       * @attribute syn
381       * @aspect DA
382       * @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:257
383       */
384      @ASTNodeAnnotation.Attribute
385      public boolean isDAafter(Variable v) {
386        Object _parameters = v;
387        if (isDAafter_Variable_values == null) isDAafter_Variable_values = new org.jastadd.util.RobustMap(new java.util.HashMap());
388        ASTNode$State state = state();
389        if (isDAafter_Variable_values.containsKey(_parameters)) {
390          return (Boolean) isDAafter_Variable_values.get(_parameters);
391        }
392        boolean intermediate = state.INTERMEDIATE_VALUE;
393        state.INTERMEDIATE_VALUE = false;
394        int num = state.boundariesCrossed;
395        boolean isFinal = this.is$Final();
396        boolean isDAafter_Variable_value = true;
397        if (isFinal && num == state().boundariesCrossed) {
398          isDAafter_Variable_values.put(_parameters, isDAafter_Variable_value);
399        } else {
400        }
401        state.INTERMEDIATE_VALUE |= intermediate;
402    
403        return isDAafter_Variable_value;
404      }
405      /**
406       * @apilevel internal
407       */
408      protected java.util.Map isDUafterReachedFinallyBlocks_Variable_values;
409      /**
410       * @apilevel internal
411       */
412      private void isDUafterReachedFinallyBlocks_Variable_reset() {
413        isDUafterReachedFinallyBlocks_Variable_values = null;
414      }
415      /**
416       * @attribute syn
417       * @aspect DU
418       * @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:1084
419       */
420      @ASTNodeAnnotation.Attribute
421      public boolean isDUafterReachedFinallyBlocks(Variable v) {
422        Object _parameters = v;
423        if (isDUafterReachedFinallyBlocks_Variable_values == null) isDUafterReachedFinallyBlocks_Variable_values = new org.jastadd.util.RobustMap(new java.util.HashMap());
424        ASTNode$State state = state();
425        if (isDUafterReachedFinallyBlocks_Variable_values.containsKey(_parameters)) {
426          return (Boolean) isDUafterReachedFinallyBlocks_Variable_values.get(_parameters);
427        }
428        boolean intermediate = state.INTERMEDIATE_VALUE;
429        state.INTERMEDIATE_VALUE = false;
430        int num = state.boundariesCrossed;
431        boolean isFinal = this.is$Final();
432        boolean isDUafterReachedFinallyBlocks_Variable_value = isDUafterReachedFinallyBlocks_compute(v);
433        if (isFinal && num == state().boundariesCrossed) {
434          isDUafterReachedFinallyBlocks_Variable_values.put(_parameters, isDUafterReachedFinallyBlocks_Variable_value);
435        } else {
436        }
437        state.INTERMEDIATE_VALUE |= intermediate;
438    
439        return isDUafterReachedFinallyBlocks_Variable_value;
440      }
441      /**
442       * @apilevel internal
443       */
444      private boolean isDUafterReachedFinallyBlocks_compute(Variable v) {
445          Iterator<FinallyHost> iter = finallyIterator();
446          if (!isDUbefore(v) && !iter.hasNext()) {
447            return false;
448          }
449          while (iter.hasNext()) {
450            FinallyHost f = iter.next();
451            if (!f.isDUafterFinally(v)) {
452              return false;
453            }
454          }
455          return true;
456        }
457      /**
458       * @apilevel internal
459       */
460      protected java.util.Map isDAafterReachedFinallyBlocks_Variable_values;
461      /**
462       * @apilevel internal
463       */
464      private void isDAafterReachedFinallyBlocks_Variable_reset() {
465        isDAafterReachedFinallyBlocks_Variable_values = null;
466      }
467      /**
468       * @attribute syn
469       * @aspect DU
470       * @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:1131
471       */
472      @ASTNodeAnnotation.Attribute
473      public boolean isDAafterReachedFinallyBlocks(Variable v) {
474        Object _parameters = v;
475        if (isDAafterReachedFinallyBlocks_Variable_values == null) isDAafterReachedFinallyBlocks_Variable_values = new org.jastadd.util.RobustMap(new java.util.HashMap());
476        ASTNode$State state = state();
477        if (isDAafterReachedFinallyBlocks_Variable_values.containsKey(_parameters)) {
478          return (Boolean) isDAafterReachedFinallyBlocks_Variable_values.get(_parameters);
479        }
480        boolean intermediate = state.INTERMEDIATE_VALUE;
481        state.INTERMEDIATE_VALUE = false;
482        int num = state.boundariesCrossed;
483        boolean isFinal = this.is$Final();
484        boolean isDAafterReachedFinallyBlocks_Variable_value = isDAafterReachedFinallyBlocks_compute(v);
485        if (isFinal && num == state().boundariesCrossed) {
486          isDAafterReachedFinallyBlocks_Variable_values.put(_parameters, isDAafterReachedFinallyBlocks_Variable_value);
487        } else {
488        }
489        state.INTERMEDIATE_VALUE |= intermediate;
490    
491        return isDAafterReachedFinallyBlocks_Variable_value;
492      }
493      /**
494       * @apilevel internal
495       */
496      private boolean isDAafterReachedFinallyBlocks_compute(Variable v) {
497          if (hasResult() ? getResult().isDAafter(v) : isDAbefore(v)) {
498            return true;
499          }
500          Iterator<FinallyHost> iter = finallyIterator();
501          if (!iter.hasNext()) {
502            return false;
503          }
504          while (iter.hasNext()) {
505            FinallyHost f = iter.next();
506            if (!f.isDAafterFinally(v)) {
507              return false;
508            }
509          }
510          return true;
511        }
512      /**
513       * @apilevel internal
514       */
515      protected java.util.Map isDUafter_Variable_values;
516      /**
517       * @apilevel internal
518       */
519      private void isDUafter_Variable_reset() {
520        isDUafter_Variable_values = null;
521      }
522      /**
523       * @attribute syn
524       * @aspect DU
525       * @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:781
526       */
527      @ASTNodeAnnotation.Attribute
528      public boolean isDUafter(Variable v) {
529        Object _parameters = v;
530        if (isDUafter_Variable_values == null) isDUafter_Variable_values = new org.jastadd.util.RobustMap(new java.util.HashMap());
531        ASTNode$State state = state();
532        if (isDUafter_Variable_values.containsKey(_parameters)) {
533          return (Boolean) isDUafter_Variable_values.get(_parameters);
534        }
535        boolean intermediate = state.INTERMEDIATE_VALUE;
536        state.INTERMEDIATE_VALUE = false;
537        int num = state.boundariesCrossed;
538        boolean isFinal = this.is$Final();
539        boolean isDUafter_Variable_value = true;
540        if (isFinal && num == state().boundariesCrossed) {
541          isDUafter_Variable_values.put(_parameters, isDUafter_Variable_value);
542        } else {
543        }
544        state.INTERMEDIATE_VALUE |= intermediate;
545    
546        return isDUafter_Variable_value;
547      }
548      /**
549       * @apilevel internal
550       */
551      protected boolean getFinallyOpt_computed = false;
552      /**
553       * @apilevel internal
554       */
555      protected Opt<Block> getFinallyOpt_value;
556      /**
557       * @apilevel internal
558       */
559      private void getFinallyOpt_reset() {
560        getFinallyOpt_computed = false;
561        getFinallyOpt_value = null;
562      }
563      /**
564       * @attribute syn nta
565       * @aspect NTAFinally
566       * @declaredat /home/jesper/git/extendj/java4/frontend/NTAFinally.jrag:61
567       */
568      @ASTNodeAnnotation.Attribute
569      public Opt<Block> getFinallyOpt() {
570        ASTNode$State state = state();
571        if (getFinallyOpt_computed) {
572          return (Opt<Block>) getChild(getFinallyOptChildPosition());
573        }
574        boolean intermediate = state.INTERMEDIATE_VALUE;
575        state.INTERMEDIATE_VALUE = false;
576        int num = state.boundariesCrossed;
577        boolean isFinal = this.is$Final();
578        getFinallyOpt_value = getFinallyOpt_compute();
579        setChild(getFinallyOpt_value, getFinallyOptChildPosition());
580        if (isFinal && num == state().boundariesCrossed) {
581          getFinallyOpt_computed = true;
582        } else {
583        }
584        state.INTERMEDIATE_VALUE |= intermediate;
585    
586        Opt<Block> node = (Opt<Block>) this.getChild(getFinallyOptChildPosition());
587        return node;
588      }
589      /**
590       * @apilevel internal
591       */
592      private Opt<Block> getFinallyOpt_compute() {
593          return branchFinallyOpt();
594        }
595      /**
596       * @apilevel internal
597       */
598      protected boolean canCompleteNormally_computed = false;
599      /**
600       * @apilevel internal
601       */
602      protected boolean canCompleteNormally_value;
603      /**
604       * @apilevel internal
605       */
606      private void canCompleteNormally_reset() {
607        canCompleteNormally_computed = false;
608      }
609      /**
610       * @attribute syn
611       * @aspect UnreachableStatements
612       * @declaredat /home/jesper/git/extendj/java4/frontend/UnreachableStatements.jrag:53
613       */
614      @ASTNodeAnnotation.Attribute
615      public boolean canCompleteNormally() {
616        ASTNode$State state = state();
617        if (canCompleteNormally_computed) {
618          return canCompleteNormally_value;
619        }
620        boolean intermediate = state.INTERMEDIATE_VALUE;
621        state.INTERMEDIATE_VALUE = false;
622        int num = state.boundariesCrossed;
623        boolean isFinal = this.is$Final();
624        canCompleteNormally_value = false;
625        if (isFinal && num == state().boundariesCrossed) {
626          canCompleteNormally_computed = true;
627        } else {
628        }
629        state.INTERMEDIATE_VALUE |= intermediate;
630    
631        return canCompleteNormally_value;
632      }
633      /**
634       * @attribute syn
635       * @aspect CodeGeneration
636       * @declaredat /home/jesper/git/extendj/java4/backend/CodeGeneration.jrag:37
637       */
638      @ASTNodeAnnotation.Attribute
639      public int sourceLineNumber() {
640        {
641            int num = super.sourceLineNumber();
642            if (num != -1) {
643              return num;
644            }
645            if (hasResult()) {
646              num = getResult().findFirstSourceLineNumber();
647              if (num != -1) {
648                return num;
649              }
650            }
651            return getLine(getParent().getParent().getEnd());
652          }
653      }
654      /**
655       * @attribute syn
656       * @aspect PreciseRethrow
657       * @declaredat /home/jesper/git/extendj/java7/frontend/PreciseRethrow.jrag:84
658       */
659      @ASTNodeAnnotation.Attribute
660      public boolean modifiedInScope(Variable var) {
661        boolean modifiedInScope_Variable_value = false;
662    
663        return modifiedInScope_Variable_value;
664      }
665      /**
666       * @attribute inh
667       * @aspect TypeCheck
668       * @declaredat /home/jesper/git/extendj/java4/frontend/TypeCheck.jrag:472
669       */
670      /**
671       * @attribute inh
672       * @aspect TypeCheck
673       * @declaredat /home/jesper/git/extendj/java4/frontend/TypeCheck.jrag:472
674       */
675      @ASTNodeAnnotation.Attribute
676      public TypeDecl returnType() {
677        TypeDecl returnType_value = getParent().Define_returnType(this, null);
678    
679        return returnType_value;
680      }
681      /**
682       * @attribute inh
683       * @aspect LocalNum
684       * @declaredat /home/jesper/git/extendj/java4/backend/LocalNum.jrag:101
685       */
686      /**
687       * @attribute inh
688       * @aspect LocalNum
689       * @declaredat /home/jesper/git/extendj/java4/backend/LocalNum.jrag:101
690       */
691      @ASTNodeAnnotation.Attribute
692      public int resultSaveLocalNum() {
693        ASTNode$State state = state();
694        if (resultSaveLocalNum_computed) {
695          return resultSaveLocalNum_value;
696        }
697        boolean intermediate = state.INTERMEDIATE_VALUE;
698        state.INTERMEDIATE_VALUE = false;
699        int num = state.boundariesCrossed;
700        boolean isFinal = this.is$Final();
701        resultSaveLocalNum_value = getParent().Define_resultSaveLocalNum(this, null);
702        if (isFinal && num == state().boundariesCrossed) {
703          resultSaveLocalNum_computed = true;
704        } else {
705        }
706        state.INTERMEDIATE_VALUE |= intermediate;
707    
708        return resultSaveLocalNum_value;
709      }
710      /**
711       * @apilevel internal
712       */
713      protected boolean resultSaveLocalNum_computed = false;
714      /**
715       * @apilevel internal
716       */
717      protected int resultSaveLocalNum_value;
718      /**
719       * @apilevel internal
720       */
721      private void resultSaveLocalNum_reset() {
722        resultSaveLocalNum_computed = false;
723      }
724      /**
725       * @attribute inh
726       * @aspect EnclosingLambda
727       * @declaredat /home/jesper/git/extendj/java8/frontend/EnclosingLambda.jrag:33
728       */
729      /**
730       * @attribute inh
731       * @aspect EnclosingLambda
732       * @declaredat /home/jesper/git/extendj/java8/frontend/EnclosingLambda.jrag:33
733       */
734      @ASTNodeAnnotation.Attribute
735      public LambdaExpr enclosingLambda() {
736        ASTNode$State state = state();
737        if (enclosingLambda_computed) {
738          return enclosingLambda_value;
739        }
740        boolean intermediate = state.INTERMEDIATE_VALUE;
741        state.INTERMEDIATE_VALUE = false;
742        int num = state.boundariesCrossed;
743        boolean isFinal = this.is$Final();
744        enclosingLambda_value = getParent().Define_enclosingLambda(this, null);
745        if (isFinal && num == state().boundariesCrossed) {
746          enclosingLambda_computed = true;
747        } else {
748        }
749        state.INTERMEDIATE_VALUE |= intermediate;
750    
751        return enclosingLambda_value;
752      }
753      /**
754       * @apilevel internal
755       */
756      protected boolean enclosingLambda_computed = false;
757      /**
758       * @apilevel internal
759       */
760      protected LambdaExpr enclosingLambda_value;
761      /**
762       * @apilevel internal
763       */
764      private void enclosingLambda_reset() {
765        enclosingLambda_computed = false;
766        enclosingLambda_value = null;
767      }
768      /**
769       * @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:255
770       * @apilevel internal
771       */
772      public boolean Define_isDAbefore(ASTNode caller, ASTNode child, Variable v) {
773        if (caller == getResultOptNoTransform()) {
774          // @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:734
775          return isDAbefore(v);
776        }
777        else {
778          return getParent().Define_isDAbefore(this, caller, v);
779        }
780      }
781      protected boolean canDefine_isDAbefore(ASTNode caller, ASTNode child, Variable v) {
782        return true;
783      }
784      /**
785       * @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:779
786       * @apilevel internal
787       */
788      public boolean Define_isDUbefore(ASTNode caller, ASTNode child, Variable v) {
789        if (caller == getResultOptNoTransform()) {
790          // @declaredat /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag:1353
791          return isDUbefore(v);
792        }
793        else {
794          return getParent().Define_isDUbefore(this, caller, v);
795        }
796      }
797      protected boolean canDefine_isDUbefore(ASTNode caller, ASTNode child, Variable v) {
798        return true;
799      }
800      /**
801       * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethodsInference.jrag:58
802       * @apilevel internal
803       */
804      public TypeDecl Define_assignConvertedType(ASTNode caller, ASTNode child) {
805        if (caller == getResultOptNoTransform()) {
806          // @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethodsInference.jrag:63
807          return returnType();
808        }
809        else {
810          return getParent().Define_assignConvertedType(this, caller);
811        }
812      }
813      protected boolean canDefine_assignConvertedType(ASTNode caller, ASTNode child) {
814        return true;
815      }
816      /**
817       * @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:30
818       * @apilevel internal
819       */
820      public TypeDecl Define_targetType(ASTNode caller, ASTNode child) {
821        if (caller == getResultOptNoTransform()) {
822          // @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:41
823          return returnType();
824        }
825        else {
826          return getParent().Define_targetType(this, caller);
827        }
828      }
829      protected boolean canDefine_targetType(ASTNode caller, ASTNode child) {
830        return true;
831      }
832      /**
833       * @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:196
834       * @apilevel internal
835       */
836      public boolean Define_assignmentContext(ASTNode caller, ASTNode child) {
837        if (caller == getResultOptNoTransform()) {
838          // @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:355
839          return true;
840        }
841        else {
842          return getParent().Define_assignmentContext(this, caller);
843        }
844      }
845      protected boolean canDefine_assignmentContext(ASTNode caller, ASTNode child) {
846        return true;
847      }
848      /**
849       * @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:197
850       * @apilevel internal
851       */
852      public boolean Define_invocationContext(ASTNode caller, ASTNode child) {
853        if (caller == getResultOptNoTransform()) {
854          // @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:356
855          return false;
856        }
857        else {
858          return getParent().Define_invocationContext(this, caller);
859        }
860      }
861      protected boolean canDefine_invocationContext(ASTNode caller, ASTNode child) {
862        return true;
863      }
864      /**
865       * @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:198
866       * @apilevel internal
867       */
868      public boolean Define_castContext(ASTNode caller, ASTNode child) {
869        if (caller == getResultOptNoTransform()) {
870          // @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:357
871          return false;
872        }
873        else {
874          return getParent().Define_castContext(this, caller);
875        }
876      }
877      protected boolean canDefine_castContext(ASTNode caller, ASTNode child) {
878        return true;
879      }
880      /**
881       * @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:199
882       * @apilevel internal
883       */
884      public boolean Define_stringContext(ASTNode caller, ASTNode child) {
885        if (caller == getResultOptNoTransform()) {
886          // @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:358
887          return false;
888        }
889        else {
890          return getParent().Define_stringContext(this, caller);
891        }
892      }
893      protected boolean canDefine_stringContext(ASTNode caller, ASTNode child) {
894        return true;
895      }
896      /**
897       * @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:200
898       * @apilevel internal
899       */
900      public boolean Define_numericContext(ASTNode caller, ASTNode child) {
901        if (caller == getResultOptNoTransform()) {
902          // @declaredat /home/jesper/git/extendj/java8/frontend/TargetType.jrag:359
903          return false;
904        }
905        else {
906          return getParent().Define_numericContext(this, caller);
907        }
908      }
909      protected boolean canDefine_numericContext(ASTNode caller, ASTNode child) {
910        return true;
911      }
912      /**
913       * @apilevel internal
914       */
915      public ASTNode rewriteTo() {
916        return super.rewriteTo();
917      }
918      protected void collect_contributors_BlockLambdaBody_lambdaReturns() {
919        /*
920         * @declaredat /home/jesper/git/extendj/java8/frontend/LambdaBody.jrag:52
921         */
922        if ((enclosingLambda() != null) && (enclosingLambda().hostType() == hostType())) {
923          {
924            BlockLambdaBody ref = (BlockLambdaBody) ((BlockLambdaBody)enclosingLambda().getLambdaBody());
925            if (ref != null) {
926              ref.BlockLambdaBody_lambdaReturns_contributors().add(this);
927            }
928          }
929        }
930        super.collect_contributors_BlockLambdaBody_lambdaReturns();
931      }
932      protected void contributeTo_BlockLambdaBody_BlockLambdaBody_lambdaReturns(ArrayList<ReturnStmt> collection) {
933        super.contributeTo_BlockLambdaBody_BlockLambdaBody_lambdaReturns(collection);
934        if ((enclosingLambda() != null) && (enclosingLambda().hostType() == hostType()))
935          collection.add(this);
936      }
937    
938    }