// Currently it matters whether you put modifiers like // "public" left or right of the "simplyCached". svoid test_tok_simplyCachedFunctions() { testTranspilationFunction tok_simplyCachedFunctions( "transient simplyCached S x() { null; }", [[ transient S x_cache; S x() { if (x_cache == null) x_cache = x_load(); ret x_cache; } S x_load() { null; } ]], "simplyCached final S x() { null; }", [[ S x_cache; final S x() { if (x_cache == null) x_cache = x_load(); ret x_cache; } final S x_load() { null; } ]], "simplyCached void x() { y(); }", [[ bool ran_x; void x() { if (ran_x) ret; set ran_x; x_impl(); } void x_impl() { y(); } ]], // abstract load method "simplyCached abstract S x();", [[ S x_cache; S x() { if (x_cache == null) x_cache = x_load(); ret x_cache; } abstract S x_load(); ]], // public "simplyCached public S x() { null; }", [[ public S x_cache; public S x() { if (x_cache == null) x_cache = x_load(); ret x_cache; } public S x_load() { null; } ]], // primitive return type "simplyCached int x() { null; }", [[ Int x_cache; int x() { if (x_cache == null) x_cache = x_load(); ret x_cache; } int x_load() { null; } ]], ); }