/// <summary> /// Generate the body of the <c>encode</c> function for the given <see cref="FieldsDefinition"/>. /// </summary> /// <param name="definition">The definition to generate code for.</param> /// <returns>The generated Dart <c>encode</c> function body.</returns> public string CompileEncode(FieldsDefinition definition) { return(definition switch { MessageDefinition d => CompileEncodeMessage(d), StructDefinition d => CompileEncodeStruct(d), _ => throw new InvalidOperationException($"invalid CompileEncode value: {definition}"), });
protected override void ExitFieldsDefinition(PrinterContext context, FieldsDefinition fieldsDefinition) { context.Append(" } "); }
protected virtual void ExitFieldsDefinition(TContext context, FieldsDefinition fieldsDefinition) { }