Skip to content

Commit

Permalink
Major code format (xamarin#12254)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmarinho authored Sep 29, 2020
1 parent 82cae14 commit 79cc0f4
Show file tree
Hide file tree
Showing 1,953 changed files with 43,535 additions and 39,903 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ root = true
# A newline ending every file
# Use 4 spaces as indentation
[*]
insert_final_newline = false
# insert_final_newline = false
indent_style = space
indent_size = 4

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: InternalsVisibleTo ("Xamarin.Forms.Core")]
[assembly: ComVisible (false)]
[assembly: InternalsVisibleTo("Xamarin.Forms.Core")]
[assembly: ComVisible(false)]
6 changes: 3 additions & 3 deletions Stubs/Xamarin.Forms.Platform.Tizen/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: InternalsVisibleTo ("Xamarin.Forms.Core")]
[assembly: ComVisible (false)]
[assembly: InternalsVisibleTo("Xamarin.Forms.Core")]
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid ("d3f9fea6-cce8-4c30-b0d2-197b40c50757")]
[assembly: Guid("d3f9fea6-cce8-4c30-b0d2-197b40c50757")]
52 changes: 26 additions & 26 deletions Stubs/Xamarin.Forms.Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Xamarin.Forms.Platform
{
internal static class Loader
{
internal static void Load ()
internal static void Load()
{
}
}
Expand All @@ -32,23 +32,23 @@ internal class _BoxViewRenderer { }
[RenderWith(typeof(EntryRenderer))]
internal class _EntryRenderer { }

[RenderWith (typeof (EditorRenderer))]
[RenderWith(typeof(EditorRenderer))]
internal class _EditorRenderer { }
#if __ANDROID__
[RenderWith(typeof(Xamarin.Forms.Platform.Android.LabelRenderer))]
#else
[RenderWith (typeof (LabelRenderer))]
[RenderWith(typeof(LabelRenderer))]
#endif
internal class _LabelRenderer { }

#if __ANDROID__
[RenderWith(typeof(Xamarin.Forms.Platform.Android.ImageRenderer))]
#else
[RenderWith (typeof (ImageRenderer))]
[RenderWith(typeof(ImageRenderer))]
#endif
internal class _ImageRenderer { }

[RenderWith (typeof (ButtonRenderer))]
[RenderWith(typeof(ButtonRenderer))]
internal class _ButtonRenderer { }

[RenderWith(typeof(ImageButtonRenderer))]
Expand All @@ -59,22 +59,22 @@ internal class _ImageButtonRenderer { }
internal class _RadioButtonRenderer { }
#endif

[RenderWith (typeof (TableViewRenderer))]
[RenderWith(typeof(TableViewRenderer))]
internal class _TableViewRenderer { }

[RenderWith (typeof (ListViewRenderer))]
[RenderWith(typeof(ListViewRenderer))]
internal class _ListViewRenderer { }
#if !TIZEN4_0
[RenderWith (typeof (CollectionViewRenderer))]
[RenderWith(typeof(CollectionViewRenderer))]
#else
[RenderWith (typeof (StructuredItemsViewRenderer))]
#endif
internal class _CollectionViewRenderer { }

[RenderWith (typeof (CarouselViewRenderer))]
[RenderWith(typeof(CarouselViewRenderer))]
internal class _CarouselViewRenderer { }

[RenderWith (typeof (SliderRenderer))]
[RenderWith(typeof(SliderRenderer))]
internal class _SliderRenderer { }

#if __IOS__
Expand All @@ -85,34 +85,34 @@ internal class _WebViewRenderer { }
internal class _WebViewRenderer { }
#endif

[RenderWith (typeof (SearchBarRenderer))]
[RenderWith(typeof(SearchBarRenderer))]
internal class _SearchBarRenderer { }

[RenderWith (typeof (SwitchRenderer))]
[RenderWith(typeof(SwitchRenderer))]
internal class _SwitchRenderer { }

[RenderWith (typeof (DatePickerRenderer))]
[RenderWith(typeof(DatePickerRenderer))]
internal class _DatePickerRenderer { }

[RenderWith (typeof (TimePickerRenderer))]
[RenderWith(typeof(TimePickerRenderer))]
internal class _TimePickerRenderer { }

[RenderWith (typeof (PickerRenderer))]
[RenderWith(typeof(PickerRenderer))]
internal class _PickerRenderer { }

[RenderWith (typeof (StepperRenderer))]
[RenderWith(typeof(StepperRenderer))]
internal class _StepperRenderer { }

[RenderWith (typeof (ProgressBarRenderer))]
[RenderWith(typeof(ProgressBarRenderer))]
internal class _ProgressBarRenderer { }

[RenderWith (typeof (ScrollViewRenderer))]
[RenderWith(typeof(ScrollViewRenderer))]
internal class _ScrollViewRenderer { }

[RenderWith (typeof (ActivityIndicatorRenderer))]
[RenderWith(typeof(ActivityIndicatorRenderer))]
internal class _ActivityIndicatorRenderer { }

[RenderWith (typeof (FrameRenderer))]
[RenderWith(typeof(FrameRenderer))]
internal class _FrameRenderer { }

#if __ANDROID__
Expand All @@ -133,30 +133,30 @@ internal class _CheckBoxRenderer { }
#endif

#if !WINDOWS_PHONE && !WINDOWS_PHONE_APP && !TIZEN4_0
[RenderWith (typeof (OpenGLViewRenderer))]
[RenderWith(typeof(OpenGLViewRenderer))]
#else
[RenderWith (null)]
#endif
internal class _OpenGLViewRenderer { }

#if !WINDOWS_PHONE && !WINDOWS_PHONE_APP && !TIZEN4_0
[RenderWith (typeof (TabbedRenderer))]
[RenderWith(typeof(TabbedRenderer))]
#else
[RenderWith (typeof (TabbedPageRenderer))]
#endif
internal class _TabbedPageRenderer { }

#if !WINDOWS_PHONE && !WINDOWS_PHONE_APP && !TIZEN4_0
[RenderWith (typeof (NavigationRenderer))]
[RenderWith(typeof(NavigationRenderer))]
#else
[RenderWith (typeof (NavigationPageRenderer))]
#endif
internal class _NavigationPageRenderer { }

[RenderWith (typeof (CarouselPageRenderer))]
[RenderWith(typeof(CarouselPageRenderer))]
internal class _CarouselPageRenderer { }

[RenderWith (typeof (PageRenderer))]
[RenderWith(typeof(PageRenderer))]
internal class _PageRenderer { }


Expand Down Expand Up @@ -192,7 +192,7 @@ internal class _SwipeViewRenderer { }
#if !TIZEN4_0
[RenderWith(typeof(PathRenderer))]
internal class _PathRenderer { }

[RenderWith(typeof(EllipseRenderer))]
internal class _EllipseRenderer { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static TypeReference GetBindablePropertyTypeConverter(this FieldReference
if (staticGetter != null && staticGetter.ReturnType.ResolveGenericParameters(bpRef.DeclaringType).ResolveCached().HasCustomAttributes)
attributes.AddRange(staticGetter.ReturnType.ResolveGenericParameters(bpRef.DeclaringType).ResolveCached().CustomAttributes);

return attributes.FirstOrDefault(cad => TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName))?.ConstructorArguments [0].Value as TypeReference;
return attributes.FirstOrDefault(cad => TypeConverterAttribute.TypeConvertersType.Contains(cad.AttributeType.FullName))?.ConstructorArguments[0].Value as TypeReference;
}
}
}
52 changes: 26 additions & 26 deletions Xamarin.Forms.Build.Tasks/BuildException.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Xml;
using System.Linq;
using System.Xml;

namespace Xamarin.Forms.Build.Tasks
{
Expand All @@ -20,7 +20,7 @@ public BuildException(BuildExceptionCode code, IXmlLineInfo xmlInfo, Exception i
{
Code = code;
XmlInfo = xmlInfo;
MessageArgs = args?.Select(a=>a?.ToString()).ToArray();
MessageArgs = args?.Select(a => a?.ToString()).ToArray();
}

protected BuildException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
Expand All @@ -41,51 +41,51 @@ static string FormatMessage(BuildExceptionCode code, IXmlLineInfo xmlinfo, objec
class BuildExceptionCode
{
//Assemblies, Types, Members
public static BuildExceptionCode TypeResolution = new BuildExceptionCode("XFC0000", nameof(TypeResolution), "");
public static BuildExceptionCode PropertyResolution = new BuildExceptionCode("XFC0001", nameof(PropertyResolution), "");
public static BuildExceptionCode MissingEventHandler = new BuildExceptionCode("XFC0002", nameof(MissingEventHandler), "");
public static BuildExceptionCode PropertyMissing = new BuildExceptionCode("XFC0003", nameof(PropertyMissing), "");
public static BuildExceptionCode TypeResolution = new BuildExceptionCode("XFC0000", nameof(TypeResolution), "");
public static BuildExceptionCode PropertyResolution = new BuildExceptionCode("XFC0001", nameof(PropertyResolution), "");
public static BuildExceptionCode MissingEventHandler = new BuildExceptionCode("XFC0002", nameof(MissingEventHandler), "");
public static BuildExceptionCode PropertyMissing = new BuildExceptionCode("XFC0003", nameof(PropertyMissing), "");
public static BuildExceptionCode ConstructorDefaultMissing = new BuildExceptionCode("XFC0004", nameof(ConstructorDefaultMissing), "");
public static BuildExceptionCode ConstructorXArgsMissing = new BuildExceptionCode("XFC0005", nameof(ConstructorXArgsMissing), "");
public static BuildExceptionCode MethodStaticMissing = new BuildExceptionCode("XFC0006", nameof(MethodStaticMissing), "");
public static BuildExceptionCode EnumValueMissing = new BuildExceptionCode("XFC0007", nameof(EnumValueMissing), "");
public static BuildExceptionCode AdderMissing = new BuildExceptionCode("XFC0008", nameof(AdderMissing), "");
public static BuildExceptionCode MemberResolution = new BuildExceptionCode("XFC0009", nameof(MemberResolution), "");
public static BuildExceptionCode MethodStaticMissing = new BuildExceptionCode("XFC0006", nameof(MethodStaticMissing), "");
public static BuildExceptionCode EnumValueMissing = new BuildExceptionCode("XFC0007", nameof(EnumValueMissing), "");
public static BuildExceptionCode AdderMissing = new BuildExceptionCode("XFC0008", nameof(AdderMissing), "");
public static BuildExceptionCode MemberResolution = new BuildExceptionCode("XFC0009", nameof(MemberResolution), "");



//BP,BO
public static BuildExceptionCode BPName = new BuildExceptionCode("XFC0020", nameof(BPName), "");
public static BuildExceptionCode BPMissingGetter = new BuildExceptionCode("XFC0021", nameof(BPMissingGetter), "");
public static BuildExceptionCode BPName = new BuildExceptionCode("XFC0020", nameof(BPName), "");
public static BuildExceptionCode BPMissingGetter = new BuildExceptionCode("XFC0021", nameof(BPMissingGetter), "");

//Bindings, conversions
public static BuildExceptionCode Conversion = new BuildExceptionCode("XFC0040", nameof(Conversion), "");
public static BuildExceptionCode Conversion = new BuildExceptionCode("XFC0040", nameof(Conversion), "");
public static BuildExceptionCode BindingIndexerNotClosed = new BuildExceptionCode("XFC0041", nameof(BindingIndexerNotClosed), "");
public static BuildExceptionCode BindingIndexerEmpty = new BuildExceptionCode("XFC0042", nameof(BindingIndexerEmpty), "");
public static BuildExceptionCode BindingIndexerEmpty = new BuildExceptionCode("XFC0042", nameof(BindingIndexerEmpty), "");
public static BuildExceptionCode BindingIndexerTypeUnsupported = new BuildExceptionCode("XFC0043", nameof(BindingIndexerTypeUnsupported), "");
public static BuildExceptionCode BindingIndexerParse = new BuildExceptionCode("XFC0044", nameof(BindingIndexerParse), "");
public static BuildExceptionCode BindingIndexerParse = new BuildExceptionCode("XFC0044", nameof(BindingIndexerParse), "");
public static BuildExceptionCode BindingPropertyNotFound = new BuildExceptionCode("XFC0045", nameof(BindingPropertyNotFound), "");

//XAML issues
public static BuildExceptionCode MarkupNotClosed = new BuildExceptionCode("XFC0060", nameof(MarkupNotClosed), "");
public static BuildExceptionCode MarkupParsingFailed = new BuildExceptionCode("XFC0061", nameof(MarkupParsingFailed), "");
public static BuildExceptionCode XmlnsUndeclared = new BuildExceptionCode("XFC0062", nameof(XmlnsUndeclared), "");
public static BuildExceptionCode SByteEnums = new BuildExceptionCode("XFC0063", nameof(SByteEnums), "");
public static BuildExceptionCode NamescopeDuplicate = new BuildExceptionCode("XFC0064", nameof(NamescopeDuplicate), "");
public static BuildExceptionCode MarkupNotClosed = new BuildExceptionCode("XFC0060", nameof(MarkupNotClosed), "");
public static BuildExceptionCode MarkupParsingFailed = new BuildExceptionCode("XFC0061", nameof(MarkupParsingFailed), "");
public static BuildExceptionCode XmlnsUndeclared = new BuildExceptionCode("XFC0062", nameof(XmlnsUndeclared), "");
public static BuildExceptionCode SByteEnums = new BuildExceptionCode("XFC0063", nameof(SByteEnums), "");
public static BuildExceptionCode NamescopeDuplicate = new BuildExceptionCode("XFC0064", nameof(NamescopeDuplicate), "");
public static BuildExceptionCode ContentPropertyAttributeMissing = new BuildExceptionCode("XFC0065", nameof(ContentPropertyAttributeMissing), "");
public static BuildExceptionCode InvalidXaml = new BuildExceptionCode("XFC0066", nameof(InvalidXaml), "");
public static BuildExceptionCode InvalidXaml = new BuildExceptionCode("XFC0066", nameof(InvalidXaml), "");


//Extensions
public static BuildExceptionCode XStaticSyntax = new BuildExceptionCode("XFC0100", nameof(XStaticSyntax), "");
public static BuildExceptionCode XStaticResolution = new BuildExceptionCode("XFC0101", nameof(XStaticResolution), "");
public static BuildExceptionCode XDataTypeSyntax = new BuildExceptionCode("XFC0102", nameof(XDataTypeSyntax), "");
public static BuildExceptionCode XStaticSyntax = new BuildExceptionCode("XFC0100", nameof(XStaticSyntax), "");
public static BuildExceptionCode XStaticResolution = new BuildExceptionCode("XFC0101", nameof(XStaticResolution), "");
public static BuildExceptionCode XDataTypeSyntax = new BuildExceptionCode("XFC0102", nameof(XDataTypeSyntax), "");

//Style, StyleSheets, Resources
public static BuildExceptionCode StyleSheetSourceOrContent = new BuildExceptionCode("XFC0120", nameof(StyleSheetSourceOrContent), "");
public static BuildExceptionCode StyleSheetNoSourceOrContent = new BuildExceptionCode("XFC0121", nameof(StyleSheetNoSourceOrContent), "");
public static BuildExceptionCode StyleSheetStyleNotALiteral = new BuildExceptionCode("XFC0122", nameof(StyleSheetStyleNotALiteral), "");
public static BuildExceptionCode StyleSheetSourceNotALiteral = new BuildExceptionCode("XFC0123", nameof(StyleSheetSourceNotALiteral), "");
public static BuildExceptionCode ResourceMissing = new BuildExceptionCode("XFC0124", nameof(ResourceMissing), "");
public static BuildExceptionCode ResourceMissing = new BuildExceptionCode("XFC0124", nameof(ResourceMissing), "");
public static BuildExceptionCode ResourceDictDuplicateKey = new BuildExceptionCode("XFC0125", nameof(ResourceDictDuplicateKey), "");
public static BuildExceptionCode ResourceDictMissingKey = new BuildExceptionCode("XFC0126", nameof(ResourceDictMissingKey), "");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public IEnumerable<Instruction> ConvertFromString(string value, ILContext contex
{
var module = context.Body.Method.Module;

if (IsNullOrEmpty(value)) {
if (IsNullOrEmpty(value))
{
yield return Instruction.Create(OpCodes.Ldnull);
yield break;
}
Expand Down Expand Up @@ -90,8 +91,8 @@ static string FindTypeNameForVisualState(IElementNode parent, IXmlLineInfo lineI
throw new XamlParseException($"Expected {nameof(VisualStateGroup)} but found {parent.Parent}", lineInfo);

//3. if the VSG is in a VSGL, skip that as it could be implicit
if ( target.Parent is ListNode
|| ( (target.Parent as IElementNode)?.XmlType.NamespaceUri == XamlParser.XFUri
if (target.Parent is ListNode
|| ((target.Parent as IElementNode)?.XmlType.NamespaceUri == XamlParser.XFUri
&& (target.Parent as IElementNode)?.XmlType.Name == nameof(VisualStateGroupList)))
target = target.Parent.Parent as IElementNode;
else
Expand All @@ -108,7 +109,8 @@ public static FieldReference GetBindablePropertyFieldReference(TypeReference typ
{
TypeReference declaringTypeReference;
FieldReference bpRef = typeRef.GetField(fd => fd.Name == $"{propertyName}Property" && fd.IsStatic && fd.IsPublic, out declaringTypeReference);
if (bpRef != null) {
if (bpRef != null)
{
bpRef = module.ImportReference(bpRef.ResolveGenericParameters(declaringTypeReference));
bpRef.FieldType = module.ImportReference(bpRef.FieldType);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System.Collections.Generic;
using Mono.Cecil.Cil;

using Xamarin.Forms.Build.Tasks;
using Xamarin.Forms.Xaml;

using static System.String;
using Xamarin.Forms.Build.Tasks;

namespace Xamarin.Forms.Core.XamlC
{
Expand Down
31 changes: 16 additions & 15 deletions Xamarin.Forms.Build.Tasks/CompiledConverters/BoundsTypeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;

using Mono.Cecil;
using Mono.Cecil.Cil;

using Xamarin.Forms.Xaml;
using Xamarin.Forms.Build.Tasks;
using Xamarin.Forms.Xaml;

namespace Xamarin.Forms.Core.XamlC
{
Expand All @@ -27,22 +25,25 @@ public IEnumerable<Instruction> ConvertFromString(string value, ILContext contex
if (xywh.Length != 2 && xywh.Length != 4)
throw new BuildException(BuildExceptionCode.Conversion, node, null, value, typeof(Rectangle));

hasX = (xywh.Length == 2 || xywh.Length == 4) && double.TryParse(xywh [0], NumberStyles.Number, CultureInfo.InvariantCulture, out x);
hasY = (xywh.Length == 2 || xywh.Length == 4) && double.TryParse(xywh [1], NumberStyles.Number, CultureInfo.InvariantCulture, out y);
hasW = xywh.Length == 4 && double.TryParse(xywh [2], NumberStyles.Number, CultureInfo.InvariantCulture, out w);
hasH = xywh.Length == 4 && double.TryParse(xywh [3], NumberStyles.Number, CultureInfo.InvariantCulture, out h);
hasX = (xywh.Length == 2 || xywh.Length == 4) && double.TryParse(xywh[0], NumberStyles.Number, CultureInfo.InvariantCulture, out x);
hasY = (xywh.Length == 2 || xywh.Length == 4) && double.TryParse(xywh[1], NumberStyles.Number, CultureInfo.InvariantCulture, out y);
hasW = xywh.Length == 4 && double.TryParse(xywh[2], NumberStyles.Number, CultureInfo.InvariantCulture, out w);
hasH = xywh.Length == 4 && double.TryParse(xywh[3], NumberStyles.Number, CultureInfo.InvariantCulture, out h);

if (!hasW && xywh.Length == 4 && string.Compare("AutoSize", xywh [2].Trim(), StringComparison.OrdinalIgnoreCase) == 0) {
if (!hasW && xywh.Length == 4 && string.Compare("AutoSize", xywh[2].Trim(), StringComparison.OrdinalIgnoreCase) == 0)
{
hasW = true;
w = AbsoluteLayout.AutoSize;
}

if (!hasH && xywh.Length == 4 && string.Compare("AutoSize", xywh [3].Trim(), StringComparison.OrdinalIgnoreCase) == 0) {
if (!hasH && xywh.Length == 4 && string.Compare("AutoSize", xywh[3].Trim(), StringComparison.OrdinalIgnoreCase) == 0)
{
hasH = true;
h = AbsoluteLayout.AutoSize;
}

if (hasX && hasY && xywh.Length == 2) {
if (hasX && hasY && xywh.Length == 2)
{
hasW = true;
w = AbsoluteLayout.AutoSize;
hasH = true;
Expand All @@ -57,11 +58,11 @@ public IEnumerable<Instruction> ConvertFromString(string value, ILContext contex

IEnumerable<Instruction> GenerateIL(double x, double y, double w, double h, ModuleDefinition module)
{
// IL_0000: ldc.r8 3.1000000000000001
// IL_0009: ldc.r8 4.2000000000000002
// IL_0012: ldc.r8 5.2999999999999998
// IL_001b: ldc.r8 6.4000000000000004
// IL_0024: newobj instance void valuetype Test.Rectangle::'.ctor'(float64, float64, float64, float64)
// IL_0000: ldc.r8 3.1000000000000001
// IL_0009: ldc.r8 4.2000000000000002
// IL_0012: ldc.r8 5.2999999999999998
// IL_001b: ldc.r8 6.4000000000000004
// IL_0024: newobj instance void valuetype Test.Rectangle::'.ctor'(float64, float64, float64, float64)

yield return Instruction.Create(OpCodes.Ldc_R8, x);
yield return Instruction.Create(OpCodes.Ldc_R8, y);
Expand Down
Loading

0 comments on commit 79cc0f4

Please sign in to comment.