1 write to Context
Microsoft.Maui.Controls.Build.Tasks (1)
SetNamescopesAndRegisterNamesVisitor.cs (1)
13
public SetNamescopesAndRegisterNamesVisitor(ILContext context) =>
Context
= context;
97 references to Context
Microsoft.Maui.Controls.Build.Tasks (97)
SetNamescopesAndRegisterNamesVisitor.cs (97)
25
var parentVar =
Context
.Variables[node];
32
Context
.Scopes[node] =
Context
.Scopes[parentNode];
35
RegisterName((string)node.Value,
Context
.Scopes[node].Item1,
Context
.Scopes[node].Item2,
Context
.Variables[(IElementNode)parentNode], node);
36
SetStyleId((string)node.Value,
Context
.Variables[(IElementNode)parentNode]);
41
Context
.Scopes[node] =
Context
.Scopes[parentNode];
57
namescopeVarDef =
Context
.Scopes[parentNode].Item1;
58
namesInNamescope =
Context
.Scopes[parentNode].Item2;
60
if (setNameScope &&
Context
.Variables[node].VariableType.InheritsFromOrImplements(
Context
.Cache,
Context
.Body.Method.Module.ImportReference(
Context
.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "BindableObject"))))
63
else if (
Context
.Variables[node].VariableType.InheritsFromOrImplements(
Context
.Cache,
Context
.Body.Method.Module.ImportReference(
Context
.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "Element"))))
65
var module =
Context
.Body.Method.Module;
70
Context
.IL.Append(
Context
.Variables[node].LoadAs(
Context
.Cache, module.GetTypeDefinition(
Context
.Cache, parameterTypes[0]), module));
71
Context
.IL.Append(namescopeVarDef.LoadAs(
Context
.Cache, module.GetTypeDefinition(
Context
.Cache, parameterTypes[1]), module));
72
Context
.IL.Emit(OpCodes.Stfld, module.ImportFieldReference(
Context
.Cache, parameterTypes[0], nameof(Element.transientNamescope)));
74
Context
.Scopes[node] = new Tuple<VariableDefinition, IList<string>>(namescopeVarDef, namesInNamescope);
81
if (
Context
.Variables[node].VariableType.InheritsFromOrImplements(
Context
.Cache,
Context
.Body.Method.Module.ImportReference(
Context
.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "BindableObject"))))
83
Context
.Scopes[node] = new System.Tuple<VariableDefinition, IList<string>>(namescopeVarDef, namesInNamescope);
88
Context
.Scopes[node] =
Context
.Scopes[parentNode];
103
var module =
Context
.Body.Method.Module;
104
var vardef = new VariableDefinition(module.ImportReference(
Context
.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "NameScope")));
105
Context
.Body.Variables.Add(vardef);
108
if (
Context
.Variables[node].VariableType.InheritsFromOrImplements(
Context
.Cache,
Context
.Body.Method.Module.ImportReference(
Context
.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "BindableObject"))))
111
Context
.IL.Append(
Context
.Variables[node].LoadAs(
Context
.Cache, module.GetTypeDefinition(
Context
.Cache, namescoperef), module));
112
Context
.IL.Emit(OpCodes.Call, module.ImportMethodReference(
Context
.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "NameScope"),
116
Context
.IL.Emit(OpCodes.Dup);
117
Context
.IL.Emit(OpCodes.Brtrue, stloc);
119
Context
.IL.Emit(OpCodes.Pop);
121
Context
.IL.Emit(OpCodes.Newobj, module.ImportCtorReference(
Context
.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "NameScope"), parameterTypes: null));
123
Context
.IL.Append(stloc);
129
var module =
Context
.Body.Method.Module;
130
var vardef = new VariableDefinition(module.ImportReference(
Context
.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "NameScope")));
131
Context
.Body.Variables.Add(vardef);
132
Context
.IL.Emit(OpCodes.Newobj, module.ImportCtorReference(
Context
.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "NameScope"), parameterTypes: null));
133
Context
.IL.Emit(OpCodes.Stloc, vardef);
139
var module =
Context
.Body.Method.Module;
144
Context
.IL.Append(
Context
.Variables[node].LoadAs(
Context
.Cache, module.GetTypeDefinition(
Context
.Cache, parameterTypes[0]), module));
145
Context
.IL.Append(ns.LoadAs(
Context
.Cache, module.GetTypeDefinition(
Context
.Cache, parameterTypes[1]), module));
146
Context
.IL.Emit(OpCodes.Call, module.ImportMethodReference(
Context
.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "NameScope"),
158
var module =
Context
.Body.Method.Module;
160
Context
.IL.Append(namescopeVarDef.LoadAs(
Context
.Cache, module.GetTypeDefinition(
Context
.Cache, namescopeType), module));
161
Context
.IL.Emit(OpCodes.Ldstr, str);
162
Context
.IL.Append(element.LoadAs(
Context
.Cache, module.TypeSystem.Object, module));
163
Context
.IL.Emit(OpCodes.Callvirt, module.ImportMethodReference(
Context
.Cache,
174
if (!element.VariableType.InheritsFromOrImplements(
Context
.Cache,
Context
.Body.Method.Module.ImportReference(
Context
.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "Element"))))
177
var module =
Context
.Body.Method.Module;
179
var elementTypeRef = module.GetTypeDefinition(
Context
.Cache, elementType);
182
Context
.IL.Append(element.LoadAs(
Context
.Cache, elementTypeRef, module));
183
Context
.IL.Emit(OpCodes.Callvirt, module.ImportPropertyGetterReference(
Context
.Cache, elementType, propertyName: "StyleId"));
184
Context
.IL.Emit(OpCodes.Brtrue, nop);
185
Context
.IL.Append(element.LoadAs(
Context
.Cache, elementTypeRef, module));
186
Context
.IL.Emit(OpCodes.Ldstr, str);
187
Context
.IL.Emit(OpCodes.Callvirt, module.ImportPropertySetterReference(
Context
.Cache, elementType, propertyName: "StyleId"));
188
Context
.IL.Append(nop);