@@ -14,28 +14,31 @@ public partial class StarscriptHypervisor
14
14
15
15
public ValueMap ? Locals { get ; private set ; }
16
16
17
+ private readonly bool _persistentLocals ;
18
+
17
19
public static StarscriptHypervisor Create ( )
18
20
=> new ( ) ;
19
21
20
22
public static StarscriptHypervisor CreateFromParent ( StarscriptHypervisor hv )
21
23
=> new ( hv . Globals ) ;
22
24
23
- public static StarscriptHypervisor CreateWithLocals ( ValueMap locals )
24
- => new ( locals : locals ) ;
25
+ public static StarscriptHypervisor CreateWithLocals ( ValueMap locals , bool persistentLocals = false )
26
+ => new ( locals : locals , persistentLocals : persistentLocals ) ;
25
27
26
- public static StarscriptHypervisor CreateFromParentWithLocals ( StarscriptHypervisor hv , ValueMap locals )
27
- => new ( hv . Globals , locals ) ;
28
+ public static StarscriptHypervisor CreateFromParentWithLocals ( StarscriptHypervisor hv , ValueMap locals , bool persistentLocals = false )
29
+ => new ( hv . Globals , locals , persistentLocals ) ;
28
30
29
- public static StarscriptHypervisor CreateWithLocals ( IStarscriptObject obj )
30
- => new ( locals : obj . ToStarscript ( ) ) ;
31
+ public static StarscriptHypervisor CreateWithLocals ( IStarscriptObject obj , bool persistentLocals = false )
32
+ => CreateWithLocals ( obj . ToStarscript ( ) , persistentLocals ) ;
31
33
32
- public static StarscriptHypervisor CreateFromParentWithLocals ( StarscriptHypervisor hv , IStarscriptObject obj )
33
- => new ( hv . Globals , obj . ToStarscript ( ) ) ;
34
+ public static StarscriptHypervisor CreateFromParentWithLocals ( StarscriptHypervisor hv , IStarscriptObject obj , bool persistentLocals = false )
35
+ => CreateFromParentWithLocals ( hv , obj . ToStarscript ( ) , persistentLocals ) ;
34
36
35
- private StarscriptHypervisor ( ValueMap ? globals = null , ValueMap ? locals = null )
37
+ private StarscriptHypervisor ( ValueMap ? globals = null , ValueMap ? locals = null , bool persistentLocals = false )
36
38
{
37
39
Globals = globals ? . Copy ( ) ?? new ValueMap ( ) ;
38
40
Locals = locals ;
41
+ _persistentLocals = persistentLocals ;
39
42
}
40
43
41
44
public static StarscriptException Error ( [ StringSyntax ( "CompositeFormat" ) ] string format , params object ? [ ] args )
0 commit comments