Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ValidateJump()

void System.Linq.Expressions.Compiler.LabelInfo.ValidateJump ( LabelScopeInfo reference)
inlineprivate

Definition at line 84 of file LabelInfo.cs.

85 {
86 _opCode = (_canReturn ? OpCodes.Ret : OpCodes.Br);
87 for (LabelScopeInfo labelScopeInfo = reference; labelScopeInfo != null; labelScopeInfo = labelScopeInfo.Parent)
88 {
90 {
91 return;
92 }
93 if (labelScopeInfo.Kind == LabelScopeKind.Finally || labelScopeInfo.Kind == LabelScopeKind.Filter)
94 {
95 break;
96 }
97 if (labelScopeInfo.Kind == LabelScopeKind.Try || labelScopeInfo.Kind == LabelScopeKind.Catch)
98 {
100 }
101 }
102 _acrossBlockJump = true;
103 if (_node != null && _node.Type != typeof(void))
104 {
105 throw Error.NonLocalJumpWithValue(_node.Name);
106 }
107 if (_definitions.Count > 1)
108 {
109 throw Error.AmbiguousJump(_node.Name);
110 }
111 LabelScopeInfo labelScopeInfo2 = _definitions.First();
112 LabelScopeInfo labelScopeInfo3 = Helpers.CommonNode(labelScopeInfo2, reference, (LabelScopeInfo b) => b.Parent);
113 _opCode = (_canReturn ? OpCodes.Ret : OpCodes.Br);
115 {
116 if (labelScopeInfo4.Kind == LabelScopeKind.Finally)
117 {
118 throw Error.ControlCannotLeaveFinally();
119 }
120 if (labelScopeInfo4.Kind == LabelScopeKind.Filter)
121 {
122 throw Error.ControlCannotLeaveFilterTest();
123 }
124 if (labelScopeInfo4.Kind == LabelScopeKind.Try || labelScopeInfo4.Kind == LabelScopeKind.Catch)
125 {
127 }
128 }
130 {
131 if (!labelScopeInfo5.CanJumpInto)
132 {
133 if (labelScopeInfo5.Kind == LabelScopeKind.Expression)
134 {
135 throw Error.ControlCannotEnterExpression();
136 }
137 throw Error.ControlCannotEnterTry();
138 }
139 }
140 }
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
readonly HashSet< LabelScopeInfo > _definitions
Definition LabelInfo.cs:17
static readonly OpCode Leave
Definition OpCodes.cs:379
static readonly OpCode Br
Definition OpCodes.cs:115

References System.Linq.Expressions.Compiler.LabelInfo._acrossBlockJump, System.Linq.Expressions.Compiler.LabelInfo._canReturn, System.Linq.Expressions.Compiler.LabelInfo._definitions, System.Linq.Expressions.Compiler.LabelInfo._node, System.Linq.Expressions.Compiler.LabelInfo._opCode, System.Linq.Expressions.Error.AmbiguousJump(), System.Reflection.Emit.OpCodes.Br, System.Collections.Generic.Dictionary< TKey, TValue >.Contains(), System.Linq.Expressions.Error.ControlCannotEnterExpression(), System.Linq.Expressions.Error.ControlCannotEnterTry(), System.Linq.Expressions.Error.ControlCannotLeaveFilterTest(), System.Linq.Expressions.Error.ControlCannotLeaveFinally(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Reflection.Emit.OpCodes.Leave, System.Linq.Expressions.LabelTarget.Name, System.Linq.Expressions.Error.NonLocalJumpWithValue(), and System.Linq.Expressions.LabelTarget.Type.

Referenced by System.Linq.Expressions.Compiler.LabelInfo.Define(), and System.Linq.Expressions.Compiler.LabelInfo.Reference().