1 // 2 // Copyright (c) 2010-2018 Antmicro 3 // 4 // This file is licensed under the MIT License. 5 // Full license text is available in 'licenses/MIT.txt'. 6 // 7 8 using System.Collections.Generic; 9 using System.Reflection; 10 11 namespace Antmicro.Renode.PlatformDescription.Syntax 12 { 13 public sealed class ConstructorOrPropertyAttribute : Attribute 14 { ConstructorOrPropertyAttribute(string name, Value value)15 public ConstructorOrPropertyAttribute(string name, Value value) 16 { 17 Name = name; 18 Value = value; 19 } 20 ToString()21 public override string ToString() 22 { 23 return string.Format("[ConstructorOrProperty: {0}: {1}]", Name, Value); 24 } 25 Visit()26 public override IEnumerable<object> Visit() 27 { 28 return new[] { Value }; 29 } 30 31 public string Name { get; private set; } 32 public Value Value { get; private set; } 33 public PropertyInfo Property { get; set; } 34 35 public bool IsPropertyAttribute 36 { 37 get 38 { 39 return char.IsUpper(Name[0]); 40 } 41 } 42 } 43 44 // the class is there because we are not able to have position aware IEnumerable 45 } 46