@@ -2291,6 +2291,24 @@ int FORTRAN::classDeclaration(Node *n) {
2291
2291
}
2292
2292
}
2293
2293
2294
+ // Define policy
2295
+ if (CPlusPlus) {
2296
+ if (SwigType *name = Getattr (n, " name" )) {
2297
+ String *policystr = Swig_string_mangle (name);
2298
+ Insert (policystr, 0 , " SWIGPOLICY_" );
2299
+ Setattr (n, " fortran:policy" , policystr);
2300
+
2301
+ // Define policies for the class
2302
+ const char *policy = " swig::ASSIGNMENT_DEFAULT" ;
2303
+ if (Getattr (n, " feature:smartptr" )) {
2304
+ policy = " swig::ASSIGNMENT_SMARTPTR" ;
2305
+ } else if (!GetFlag (n, " allocate:default_destructor" )) {
2306
+ policy = " swig::ASSIGNMENT_NODESTRUCT" ;
2307
+ }
2308
+ Printv (f_policies, " #define " , policystr, " " , policy, " \n " , NULL );
2309
+ }
2310
+ }
2311
+
2294
2312
return Language::classDeclaration (n);
2295
2313
}
2296
2314
@@ -2346,25 +2364,6 @@ int FORTRAN::classHandler(Node *n) {
2346
2364
}
2347
2365
Printv (f_class, " , public :: " , fsymname, " \n " , NULL );
2348
2366
2349
- // Define policy
2350
- if (CPlusPlus)
2351
- {
2352
- SwigType *name = Getattr (n, " name" );
2353
- ASSERT_OR_PRINT_NODE (name, n);
2354
- String *policystr = Swig_string_mangle (name);
2355
- Insert (policystr, 0 , " SWIGPOLICY_" );
2356
- Setattr (n, " fortran:policy" , policystr);
2357
-
2358
- // Define policies for the class
2359
- const char *policy = " swig::ASSIGNMENT_DEFAULT" ;
2360
- if (Getattr (n, " feature:smartptr" )) {
2361
- policy = " swig::ASSIGNMENT_SMARTPTR" ;
2362
- } else if (!GetFlag (n, " allocate:default_destructor" )) {
2363
- policy = " swig::ASSIGNMENT_NODESTRUCT" ;
2364
- }
2365
- Printv (f_policies, " #define " , policystr, " " , policy, " \n " , NULL );
2366
- }
2367
-
2368
2367
if (!bindc) {
2369
2368
if (!base_fsymname) {
2370
2369
// Insert the class data if this doesn't inherit from anything
0 commit comments