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(); } }
protected override void WriteVarInit(CiNamedValue def) { if (!(def.Type is CiClass) || def.Value != null) { base.WriteVarInit(def); } }
protected override void WriteVarInit(CiNamedValue def) { if (def.Type is CiClass klass) { return; } base.WriteVarInit(def); }
protected override void WriteTypeAndName(CiNamedValue value) { WriteName(value); if (!value.Type.IsFinal) { Write(" : "); Write(value.Type); } }
protected virtual void WriteVarInit(CiNamedValue def) { if (def.IsAssignableStorage) { } else if (def.Type is CiArrayStorageType array && !(def.Value is CiAggregateInitializer)) { WriteArrayStorageInit(array, def.Value); }
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); }
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); } }
protected override void WriteTypeAndName(CiNamedValue value) { WriteName(value); }
bool HasInitCode(CiNamedValue def) { return(def.Type is CiArrayStorageType array && (array.ElementType is CiClass || array.ElementType is CiArrayStorageType)); }
protected override void WriteVar(CiNamedValue def) { Write(def.Type.IsFinal && !def.IsAssignableStorage ? "const " : "let "); base.WriteVar(def); }
protected override void WriteTypeAndName(CiNamedValue value) { Write(value.Type, true); Write(' '); WriteName(value); }
protected override void WriteInitCode(CiNamedValue def) { }
protected override bool HasInitCode(CiNamedValue def) { return(false); }
protected override void WriteVar(CiNamedValue def) { Write(def.Type.IsFinal ? "const " : "let "); base.WriteVar(def); }
protected abstract void WriteTypeAndName(CiNamedValue value);
protected override void WriteVar(CiNamedValue def) { Write("var "); base.WriteVar(def); }