private void Export(Parameter prm) { Write("{0} {1}", Class(prm.Type), Identifier(prm.Name)); if (prm.IsOptional) { if (prm.Type.Name == "bool") Write("=false"); else Write("=null"); } }
private static Parameter ProcessParam( ExtParam prm2 ) { var prm = new Parameter { Name = prm2.name, Type = GetClass( prm2.type ), IsOptional = prm2.optional, Summary = prm2.doc, IsParams = prm2.name.Equals( "add", StringComparison.Ordinal ) || prm2.doc.Contains( "ariable number of" ) }; if ( prm.IsParams ) prm.IsOptional = false; return prm; }
Parameter GenerateParameter(object node) { var names = node.GetNames(); var prm = new Parameter { Name = node.Get<string>("name"), Type = FindClass(node.Get<string>("type")), IsOptional = node.Get("optional") != null, }; // if (prm.Type == null || prm.Name.IsNullOrEmpty()) // return null; return prm; }
private void Export( Parameter prm ) { Write( "{0}{1}{2} {3}", prm.IsParams.IfTrue( "params " ), Class( prm.Type ), prm.IsParams.IfTrue( "[]" ), Identifier( prm.Name ) ); if ( prm.IsOptional ) { if ( prm.Type.Name == "bool" ) Write( "=false" ); else Write( "=null" ); } }