Пример #1
0
        public ConstantDef([NotNull] IConstantScope owner, [NotNull] String name, [NotNull] Type type, [NotNull] Literal value, [CanBeNull, ItemNotNull] List <String> comments = null)
            : base(name, comments)
        {
            Value = value;
            Type  = type;
            Owner = owner;

            FullName = $"{owner.FullName}.{Name}";
        }
Пример #2
0
 private static void SaveConstants(IConstantScope constantScope, CodeWriter writer)
 {
     for (Int32 index = 0; index < constantScope.DefinedConstants.Count; index += 1)
     {
         ConstantDef constantDef = constantScope.DefinedConstants[index];
         SaveComments(constantDef, writer);
         SaveDecorators(constantDef, writer);
         writer.WriteLine("const {0} {1} = {2};", constantDef.Type, constantDef.Name, constantDef.Value);
         if (index + 1 < constantScope.DefinedConstants.Count)
         {
             writer.NewLine();
         }
     }
 }