From 2e68cf903877b944a53041fc756c27be95c18539 Mon Sep 17 00:00:00 2001
From: rschoene <rene.schoene@tu-dresden.de>
Date: Tue, 31 May 2022 11:52:33 +0200
Subject: [PATCH] Move state initialization for circular attribute equations to
 begin of method.

---
 src/template/ast/Circular.tt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/template/ast/Circular.tt b/src/template/ast/Circular.tt
index b584c991..710d6a58 100644
--- a/src/template/ast/Circular.tt
+++ b/src/template/ast/Circular.tt
@@ -36,8 +36,8 @@ AttrDecl.circularEquation:unparameterized [[
   #annotations
   $include(AttrDecl.generatedAnnotations)
   public #getType #name() {
-    $include(AttrDecl.cacheCheck)
     $StateClass state = state();
+    $include(AttrDecl.cacheCheck)
     if (!#(signature)_initialized) {
 $if(#isCollection)
       $ASTNode _node = this;
@@ -155,6 +155,7 @@ AttrDecl.circularEquation:parameterized [[
 
     $include(AttrDecl.incHookAttrRead)
 
+    $StateClass state = state();
     #initLazyMaps
     $StateClass.CircularValue _value;
     if (#(signature)_values.containsKey(_parameters)) {
@@ -179,7 +180,6 @@ $if(#getNTA)
       }
 $endif
     }
-    $StateClass state = state();
     if (!state.inCircle() || state.calledByLazyAttribute()) {
       $include(AttrDecl.traceCircularEnterCase1)
       state.enterCircle();
-- 
GitLab