diff --git a/ICSharpCode.Decompiler/DecompilerSettings.cs b/ICSharpCode.Decompiler/DecompilerSettings.cs
index a72427aed..89dbb6905 100644
--- a/ICSharpCode.Decompiler/DecompilerSettings.cs
+++ b/ICSharpCode.Decompiler/DecompilerSettings.cs
@@ -795,7 +795,7 @@ namespace ICSharpCode.Decompiler
///
/// Gets/Sets whether C# 7.0 local functions should be used.
- /// Note: this language feature is currenly not implemented and this setting is always false.
+ /// Note: this language feature is currently not implemented and this setting is always false.
///
public bool LocalFunctions {
get { return localFunctions; }
diff --git a/ICSharpCode.Decompiler/IL/Instructions.cs b/ICSharpCode.Decompiler/IL/Instructions.cs
index a8a530531..5dba36269 100644
--- a/ICSharpCode.Decompiler/IL/Instructions.cs
+++ b/ICSharpCode.Decompiler/IL/Instructions.cs
@@ -3617,6 +3617,8 @@ namespace ICSharpCode.Decompiler.IL
public override void WriteTo(ITextOutput output, ILAstWritingOptions options)
{
ILRange.WriteTo(output, options);
+ if (DelayExceptions)
+ output.Write("delayex.");
output.Write(OpCode);
output.Write(' ');
field.WriteTo(output);
@@ -3639,7 +3641,7 @@ namespace ICSharpCode.Decompiler.IL
protected internal override bool PerformMatch(ILInstruction other, ref Patterns.Match match)
{
var o = other as LdFlda;
- return o != null && this.target.PerformMatch(o.target, ref match) && field.Equals(o.field);
+ return o != null && this.target.PerformMatch(o.target, ref match) && DelayExceptions == o.DelayExceptions && field.Equals(o.field);
}
}
}
@@ -4642,6 +4644,8 @@ namespace ICSharpCode.Decompiler.IL
public override void WriteTo(ITextOutput output, ILAstWritingOptions options)
{
ILRange.WriteTo(output, options);
+ if (DelayExceptions)
+ output.Write("delayex.");
if (IsReadOnly)
output.Write("readonly.");
output.Write(OpCode);
@@ -4670,7 +4674,7 @@ namespace ICSharpCode.Decompiler.IL
protected internal override bool PerformMatch(ILInstruction other, ref Patterns.Match match)
{
var o = other as LdElema;
- return o != null && type.Equals(o.type) && this.array.PerformMatch(o.array, ref match) && Patterns.ListMatch.DoMatch(this.Indices, o.Indices, ref match) && IsReadOnly == o.IsReadOnly;
+ return o != null && type.Equals(o.type) && this.array.PerformMatch(o.array, ref match) && Patterns.ListMatch.DoMatch(this.Indices, o.Indices, ref match) && DelayExceptions == o.DelayExceptions && IsReadOnly == o.IsReadOnly;
}
}
}
diff --git a/ICSharpCode.Decompiler/IL/Instructions.tt b/ICSharpCode.Decompiler/IL/Instructions.tt
index ec97f65ac..2ab4f2091 100644
--- a/ICSharpCode.Decompiler/IL/Instructions.tt
+++ b/ICSharpCode.Decompiler/IL/Instructions.tt
@@ -708,6 +708,9 @@ namespace ICSharpCode.Decompiler.IL
static Action MayThrowIfNotDelayed = HasFlag("(DelayExceptions ? InstructionFlags.None : InstructionFlags.MayThrow)") + (opCode => {
opCode.Members.Add("public bool DelayExceptions; // NullReferenceException/IndexOutOfBoundsException only occurs when the reference is dereferenced");
+ opCode.GenerateWriteTo = true;
+ opCode.WriteOpCodePrefix.Add("if (DelayExceptions)" + Environment.NewLine + "\toutput.Write(\"delayex.\");");
+ opCode.PerformMatchConditions.Add("DelayExceptions == o.DelayExceptions");
});
static Action BaseClass(string name)