예제 #1
0
        protected override void WriteInitCode(CiNamedValue def)
        {
            if (!HasInitCode(def))
            {
                return;
            }
            CiArrayStorageType array = (CiArrayStorageType)def.Type;
            int nesting = 0;

            while (array.ElementType is CiArrayStorageType innerArray)
            {
                OpenLoop("let", nesting++, array.Length);
                WriteArrayElement(def, nesting);
                Write(" = ");
                WriteNewArray(innerArray.ElementType, innerArray.LengthExpr, CiPriority.Argument);
                WriteLine(';');
                array = innerArray;
            }
            if (array.ElementType is CiClass klass)
            {
                OpenLoop("let", nesting++, array.Length);
                WriteArrayElement(def, nesting);
                Write(" = ");
                WriteNew(klass, CiPriority.Argument);
                WriteLine(';');
            }
            while (--nesting >= 0)
            {
                CloseBlock();
            }
        }
예제 #2
0
파일: GenCCpp.cs 프로젝트: pfusik/cito
 protected override void WriteVarInit(CiNamedValue def)
 {
     if (!(def.Type is CiClass) || def.Value != null)
     {
         base.WriteVarInit(def);
     }
 }
예제 #3
0
 protected override void WriteVarInit(CiNamedValue def)
 {
     if (def.Type is CiClass klass)
     {
         return;
     }
     base.WriteVarInit(def);
 }
예제 #4
0
 protected override void WriteTypeAndName(CiNamedValue value)
 {
     WriteName(value);
     if (!value.Type.IsFinal)
     {
         Write(" : ");
         Write(value.Type);
     }
 }
예제 #5
0
파일: GenBase.cs 프로젝트: pfusik/cito
 protected virtual void WriteVarInit(CiNamedValue def)
 {
     if (def.IsAssignableStorage)
     {
     }
     else if (def.Type is CiArrayStorageType array && !(def.Value is CiAggregateInitializer))
     {
         WriteArrayStorageInit(array, def.Value);
     }
예제 #6
0
 protected virtual void WriteVarInit(CiNamedValue def)
 {
     if (def.Type is CiClass klass)
     {
         Write(" = ");
         WriteNew(klass, CiPriority.Statement);
     }
     else if (def.Type is CiArrayStorageType array && !(def.Value is CiCollection))
     {
         WriteArrayStorageInit(array, def.Value);
     }
예제 #7
0
파일: GenCpp.cs 프로젝트: jedwards1211/cito
 protected override void WriteVarInit(CiNamedValue def)
 {
     if (def.Value != null && def.Type == CiSystem.StringStorageType)
     {
         Write('{');
         def.Value.Accept(this, CiPriority.Statement);
         Write('}');
     }
     else
     {
         base.WriteVarInit(def);
     }
 }
예제 #8
0
 protected override void WriteTypeAndName(CiNamedValue value)
 {
     WriteName(value);
 }
예제 #9
0
 bool HasInitCode(CiNamedValue def)
 {
     return(def.Type is CiArrayStorageType array &&
            (array.ElementType is CiClass || array.ElementType is CiArrayStorageType));
 }
예제 #10
0
 protected override void WriteVar(CiNamedValue def)
 {
     Write(def.Type.IsFinal && !def.IsAssignableStorage ? "const " : "let ");
     base.WriteVar(def);
 }
예제 #11
0
 protected override void WriteTypeAndName(CiNamedValue value)
 {
     Write(value.Type, true);
     Write(' ');
     WriteName(value);
 }
예제 #12
0
파일: GenCpp.cs 프로젝트: jedwards1211/cito
 protected override void WriteInitCode(CiNamedValue def)
 {
 }
예제 #13
0
파일: GenCpp.cs 프로젝트: jedwards1211/cito
 protected override bool HasInitCode(CiNamedValue def)
 {
     return(false);
 }
예제 #14
0
파일: GenJs.cs 프로젝트: 00mjk/cito
 protected override void WriteVar(CiNamedValue def)
 {
     Write(def.Type.IsFinal ? "const " : "let ");
     base.WriteVar(def);
 }
예제 #15
0
 protected abstract void WriteTypeAndName(CiNamedValue value);
예제 #16
0
 protected override void WriteVar(CiNamedValue def)
 {
     Write("var ");
     base.WriteVar(def);
 }