-
Notifications
You must be signed in to change notification settings - Fork 0
/
ActionQueryException.cs
48 lines (42 loc) · 1.49 KB
/
ActionQueryException.cs
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
using System;
using System.Collections.Generic;
namespace Ccf.Ck.Libs.ActionQuery
{
public class ActionQueryException<ResolverValue>: Exception where ResolverValue: new() {
private const string INSTRUCTION = "Instruction";
private const string AQSTACK = "AQ STACK";
private const string PC = "PC";
public ActionQueryException(string description,Instruction instruction, ResolverValue[] stack,int pc, Exception inner = null):base(description,inner) {
this.Data.Add(AQSTACK, stack);
Data.Add(INSTRUCTION, instruction);
Data.Add(PC, pc);
}
#region Obtain specifics
public IEnumerable<ResolverValue> AQStack {
get {
if (this.Data.Contains(AQSTACK)) {
var stack = this.Data[AQSTACK] as ResolverValue[];
if (stack != null) return stack;
}
return null;
}
}
public Instruction Instruction {
get {
if (this.Data.Contains(INSTRUCTION) && this.Data[INSTRUCTION] is Instruction) {
return (Instruction)this.Data[INSTRUCTION];
}
return default(Instruction);
}
}
public int Pc {
get {
if (this.Data.Contains(PC) && this.Data[PC] is int n) {
return n;
}
return -1;
}
}
#endregion
}
}