forked from EvilBeaver/OneScript
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStackRuntimeModule.cs
More file actions
64 lines (46 loc) · 2.03 KB
/
StackRuntimeModule.cs
File metadata and controls
64 lines (46 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*----------------------------------------------------------
This Source Code Form is subject to the terms of the
Mozilla Public License, v.2.0. If a copy of the MPL
was not distributed with this file, You can obtain one
at http://mozilla.org/MPL/2.0/.
----------------------------------------------------------*/
using System;
using System.Collections.Generic;
using OneScript.Compilation.Binding;
using OneScript.Contexts;
using OneScript.Execution;
using OneScript.Sources;
using OneScript.Values;
namespace ScriptEngine.Machine
{
public class StackRuntimeModule : IExecutableModule
{
public StackRuntimeModule(Type ownerType)
{
ClassType = ownerType;
}
public Type ClassType { get; }
public int EntryMethodIndex { get; set; } = -1;
public List<BslPrimitiveValue> Constants { get; } = new List<BslPrimitiveValue>();
internal IList<SymbolBinding> VariableRefs { get; } = new List<SymbolBinding>();
internal IList<SymbolBinding> MethodRefs { get; } = new List<SymbolBinding>();
#region IExecutableModule members
public BslScriptMethodInfo ModuleBody
{
get
{
if (EntryMethodIndex == -1)
return null;
return Methods[MethodRefs[EntryMethodIndex].MemberNumber];
}
}
public IList<BslAnnotationAttribute> ModuleAttributes { get; } = new List<BslAnnotationAttribute>();
public IList<BslScriptFieldInfo> Fields { get; } = new List<BslScriptFieldInfo>();
public IList<BslScriptPropertyInfo> Properties { get; } = new List<BslScriptPropertyInfo>();
public IList<BslScriptMethodInfo> Methods { get; } = new List<BslScriptMethodInfo>();
public IList<Command> Code { get; } = new List<Command>(512);
public SourceCode Source { get; set; }
public IDictionary<Type, object> Interfaces { get; } = new Dictionary<Type, object>();
#endregion
}
}