mirror of
https://github.com/ZuneDev/MicrosoftIris.git
synced 2026-07-27 13:13:29 -07:00
Create script ID helper function
This commit is contained in:
@@ -150,6 +150,18 @@ namespace Microsoft.Iris.Markup
|
|||||||
|
|
||||||
public override bool HasDefaultConstructor => true;
|
public override bool HasDefaultConstructor => true;
|
||||||
|
|
||||||
|
public MarkupTypeSchema ResolveScriptId(uint scriptId, out uint offset) => ResolveScriptId(this, scriptId, out offset);
|
||||||
|
|
||||||
|
public static MarkupTypeSchema ResolveScriptId(MarkupTypeSchema type, uint scriptId, out uint offset)
|
||||||
|
{
|
||||||
|
uint num = scriptId >> c_TypeDepthShift;
|
||||||
|
while (num != type._typeDepth)
|
||||||
|
type = type._baseType;
|
||||||
|
|
||||||
|
offset = scriptId & c_ScriptOffsetMask;
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
public object Run(
|
public object Run(
|
||||||
IMarkupTypeBase markupType,
|
IMarkupTypeBase markupType,
|
||||||
uint scriptId,
|
uint scriptId,
|
||||||
@@ -157,11 +169,8 @@ namespace Microsoft.Iris.Markup
|
|||||||
ParameterContext parameterContext)
|
ParameterContext parameterContext)
|
||||||
{
|
{
|
||||||
ErrorManager.EnterContext(markupType.TypeSchema.Owner.ErrorContextUri, ignoreErrors);
|
ErrorManager.EnterContext(markupType.TypeSchema.Owner.ErrorContextUri, ignoreErrors);
|
||||||
MarkupTypeSchema markupTypeSchema = this;
|
var markupTypeSchema = ResolveScriptId(scriptId, out var offset);
|
||||||
uint num = scriptId >> c_TypeDepthShift;
|
object obj = markupTypeSchema.RunAtOffset(markupType, offset, parameterContext);
|
||||||
while ((int)num != (int)markupTypeSchema._typeDepth)
|
|
||||||
markupTypeSchema = markupTypeSchema._baseType;
|
|
||||||
object obj = markupTypeSchema.RunAtOffset(markupType, scriptId & c_ScriptOffsetMask, parameterContext);
|
|
||||||
ErrorManager.ExitContext();
|
ErrorManager.ExitContext();
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user