2
2
3
3
public abstract class ExecutableScript : IDisposable
4
4
{
5
- public bool IsDisposed { get ; protected set ; }
6
-
7
5
public abstract ReadOnlySpan < byte > Code { get ; }
8
6
9
7
public abstract ReadOnlySpan < Value > Constants { get ; }
10
8
11
- public virtual byte GetByteAt ( int idx ) => Code [ idx ] ;
12
-
13
- public int GetMaskedByteAt ( int idx ) => GetByteAt ( idx ) & 0xFF ;
9
+ public abstract void Dispose ( ) ;
14
10
15
- public StringSegment Execute ( StarscriptHypervisor hypervisor )
16
- {
17
- if ( IsDisposed )
18
- throw new ObjectDisposedException ( nameof ( ExecutableScript ) , "Cannot execute a disposed Script." ) ;
11
+ public virtual byte GetByteAt ( int idx ) => Code [ idx ] ;
19
12
20
- return hypervisor . Run ( this ) ;
21
- }
22
13
23
- public StringSegment Execute ( StarscriptHypervisor hypervisor , ValueMap locals )
24
- {
25
- if ( IsDisposed )
26
- throw new ObjectDisposedException ( nameof ( ExecutableScript ) , "Cannot execute a disposed Script." ) ;
14
+ public bool IsDisposed { get ; protected set ; }
27
15
28
- return hypervisor . Run ( this , locals ) ;
29
- }
16
+ public int GetMaskedByteAt ( int idx ) => GetByteAt ( idx ) & 0xFF ;
30
17
31
- public StringSegment Execute ( StarscriptHypervisor hypervisor , IStarscriptObject obj )
32
- {
33
- if ( IsDisposed )
34
- throw new ObjectDisposedException ( nameof ( ExecutableScript ) , "Cannot execute a disposed Script." ) ;
18
+ public StringSegment Execute ( StarscriptHypervisor hypervisor )
19
+ => hypervisor . Run ( this ) ;
35
20
36
- return hypervisor . Run ( this , obj ) ;
37
- }
21
+ public StringSegment Execute ( StarscriptHypervisor hypervisor , ValueMap locals )
22
+ => hypervisor . Run ( this , locals ) ;
38
23
39
- public abstract void Dispose ( ) ;
24
+ public StringSegment Execute ( StarscriptHypervisor hypervisor , IStarscriptObject obj )
25
+ => hypervisor . Run ( this , obj ) ;
40
26
}
0 commit comments