public override IEnumerable <IProperty> GetProperties(ITypeResolveContext context, Predicate <IProperty> filter = null) { ITypeDefinition arrayDef = systemArray.Resolve(context) as ITypeDefinition; if (arrayDef != null) { foreach (IProperty p in arrayDef.GetProperties(context, filter)) { yield return(p); } DefaultProperty indexer = new DefaultProperty(arrayDef, "Items") { EntityType = EntityType.Indexer, ReturnType = elementType, Accessibility = Accessibility.Public, Getter = DefaultAccessor.GetFromAccessibility(Accessibility.Public), Setter = DefaultAccessor.GetFromAccessibility(Accessibility.Public), IsSynthetic = true }; for (int i = 0; i < dimensions; i++) { indexer.Parameters.Add(indexerParam); } indexer.Freeze(); if (filter == null || filter(indexer)) { yield return(indexer); } } }
IAccessor ConvertAccessor(Accessor accessor, Accessibility defaultAccessibility) { DefaultAccessor a = new DefaultAccessor(); a.Accessibility = GetAccessibility(accessor.Modifiers) ?? defaultAccessibility; a.Region = MakeRegion(accessor); ConvertAttributes(a.Attributes, accessor.Attributes); return(a); }
IAccessor ConvertAccessor(Accessor accessor, ICSharpCode.NRefactory.TypeSystem.Accessibility defaultAccessibility) { DefaultAccessor a = new DefaultAccessor(); a.Accessibility = GetAccessibility(accessor.Modifiers) ?? defaultAccessibility; a.Region = MakeRegion(accessor); ConvertAttributes(a.Attributes, accessor.Attributes); return(a); }
static void Main(string[] args) { var clientStabA = new PlatformClientStub(new System.Net.CookieContainer()); clientStabA.AtValue = "initDt_AtValue"; clientStabA.EjxValue = "initDt_EjxValue"; clientStabA.PvtValue = "initDt_PvtValue"; var apiWrapper = new ApiWrapperWithLogger(); var api = new DefaultAccessor(apiWrapper); var hmInit = api.GetInitDataAsync(clientStabA).Result; }
public override IEntity VisitEventDeclaration(EventDeclaration eventDeclaration, object data) { bool isSingleEvent = eventDeclaration.Variables.Count() == 1; Modifiers modifiers = eventDeclaration.Modifiers; DefaultEvent ev = null; foreach (VariableInitializer vi in eventDeclaration.Variables) { ev = new DefaultEvent(currentTypeDefinition, vi.Name); ev.Region = isSingleEvent ? MakeRegion(eventDeclaration) : MakeRegion(vi); ev.BodyRegion = MakeRegion(vi); ApplyModifiers(ev, modifiers); ev.ReturnType = ConvertType(eventDeclaration.ReturnType); if (eventDeclaration.Attributes.Any(a => a.AttributeTarget == "method")) { ev.AddAccessor = ev.RemoveAccessor = new DefaultAccessor { Accessibility = ev.Accessibility }; } else { // if there's no attributes on the accessors, we can re-use the shared accessor instance ev.AddAccessor = ev.RemoveAccessor = DefaultAccessor.GetFromAccessibility(ev.Accessibility); } foreach (AttributeSection section in eventDeclaration.Attributes) { if (section.AttributeTarget == "method") { // as we use the same instance for AddAccessor and RemoveAccessor, we only need to add the attribute once ConvertAttributes(ev.AddAccessor.Attributes, section); } else if (section.AttributeTarget != "field") { ConvertAttributes(ev.Attributes, section); } } currentTypeDefinition.Events.Add(ev); } return(isSingleEvent ? ev : null); }
IAccessor ConvertAccessor(Accessor accessor, Accessibility defaultAccessibility) { DefaultAccessor a = new DefaultAccessor(); a.Accessibility = GetAccessibility(accessor.Modifiers) ?? defaultAccessibility; a.Region = MakeRegion(accessor); foreach (AttributeSection section in accessor.Attributes) { if (section.AttributeTarget == "return") { ConvertAttributes(a.ReturnTypeAttributes, section); } else if (section.AttributeTarget != "param") { ConvertAttributes(a.Attributes, section); } } return(a); }
public async Task GetInitDataAsyncTest() { var target = new DefaultAccessor(new ApiWrapperStub()); var res = await target.GetInitDataAsync(clientStabA); Assert.Fail(); }