public override void EnterDictionaryMember([NotNull] WebIDLParser.DictionaryMemberContext context) { base.EnterDictionaryMember(context); var type = TranslateType(context.type().GetText()); var rawName = context.IDENTIFIER_WEBIDL().GetText(); var name = CSharpify(rawName); var value = context.default_().defaultValue()?.GetText(); outputStream.WriteLine($" public {type} {name}"); if (value == null) { outputStream.WriteLine($" {{ get; set; }}"); } else { outputStream.WriteLine($" {{"); outputStream.WriteLine($" get => ({type})Handle.GetObjectProperty(\"{rawName}\");"); outputStream.WriteLine($" set => Handle.SetObjectProperty(\"{rawName}\", value);"); outputStream.WriteLine($" }}"); } outputStream.WriteLine(); }
public override void EnterDictionaryMember([NotNull] WebIDLParser.DictionaryMemberContext context) { base.EnterDictionaryMember(context); var type = TranslateType(context.type().GetText()); var name = CSharpify(context.IDENTIFIER_WEBIDL().GetText()); var value = context.default_().defaultValue()?.GetText(); outputStream.Write($" public {type} {name} {{ get; set; }}"); if (value != null) { outputStream.WriteLine($" = {value};"); } outputStream.WriteLine(); }