Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Commit 3b06585

Browse files
Merge pull request #807 from xamarin/cs-version
Bump .NET version to 7.0
2 parents 2c1aef0 + 16f90dd commit 3b06585

File tree

96 files changed

+3962
-5387
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+3962
-5387
lines changed

DylibBinder/DylibBinder.csproj

Lines changed: 22 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,22 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<PropertyGroup>
4-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5-
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6-
<ProjectGuid>{2BB83AA6-D9DB-432F-8FC1-7AC83E7FE97B}</ProjectGuid>
7-
<OutputType>Exe</OutputType>
8-
<RootNamespace>DylibBinder</RootNamespace>
9-
<AssemblyName>DylibBinder</AssemblyName>
10-
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
11-
</PropertyGroup>
12-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
13-
<DebugSymbols>true</DebugSymbols>
14-
<DebugType>full</DebugType>
15-
<Optimize>false</Optimize>
16-
<OutputPath>bin\Debug</OutputPath>
17-
<DefineConstants>DEBUG;</DefineConstants>
18-
<ErrorReport>prompt</ErrorReport>
19-
<WarningLevel>4</WarningLevel>
20-
<ExternalConsole>true</ExternalConsole>
21-
<PlatformTarget>x64</PlatformTarget>
22-
<LangVersion>latest</LangVersion>
23-
</PropertyGroup>
24-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
25-
<Optimize>true</Optimize>
26-
<OutputPath>bin\Release</OutputPath>
27-
<ErrorReport>prompt</ErrorReport>
28-
<WarningLevel>4</WarningLevel>
29-
<ExternalConsole>true</ExternalConsole>
30-
<PlatformTarget>x86</PlatformTarget>
31-
<LangVersion>latest</LangVersion>
32-
</PropertyGroup>
33-
<ItemGroup>
34-
<Reference Include="System" />
35-
<Reference Include="Mono.Options">
36-
<HintPath>..\packages\Mono.Options.6.6.0.161\lib\net40\Mono.Options.dll</HintPath>
37-
</Reference>
38-
<Reference Include="System.Xml.Linq" />
39-
<Reference Include="System.Xml" />
40-
<Reference Include="mscorlib" />
41-
</ItemGroup>
42-
<ItemGroup>
43-
<Compile Include="Program.cs" />
44-
<Compile Include="Properties\AssemblyInfo.cs" />
45-
<Compile Include="CheckInventory.cs" />
46-
<Compile Include="DylibBinderOptions.cs" />
47-
<Compile Include="InnerX.cs" />
48-
<Compile Include="StringExtensions.cs" />
49-
<Compile Include="DBTopLevel.cs" />
50-
<Compile Include="DBTypeDeclaration.cs" />
51-
<Compile Include="DBFunc.cs" />
52-
<Compile Include="DBProperty.cs" />
53-
<Compile Include="DBParameter.cs" />
54-
<Compile Include="DBGenericParameter.cs" />
55-
<Compile Include="DBAssociatedType.cs" />
56-
<Compile Include="SwiftTypeToString.cs" />
57-
<Compile Include="DBInnerTypes.cs" />
58-
<Compile Include="XmlGenerator.cs" />
59-
<Compile Include="Enums.cs" />
60-
<Compile Include="SortedSetExtensions.cs" />
61-
<Compile Include="DylibBinderReflector.cs" />
62-
<Compile Include="DBModule.cs" />
63-
</ItemGroup>
64-
<ItemGroup>
65-
<None Include="README.md" />
66-
<None Include="packages.config" />
67-
<None Include="Makefile" />
68-
<None Include="IgnoreList.txt" />
69-
</ItemGroup>
70-
<ItemGroup>
71-
<ProjectReference Include="..\Dynamo\Dynamo.csproj">
72-
<Project>{D0E2964B-34C9-4FEE-A638-A10E2E4A0917}</Project>
73-
<Name>Dynamo</Name>
74-
</ProjectReference>
75-
<ProjectReference Include="..\SwiftReflector\SwiftReflector.csproj">
76-
<Project>{65E8BE11-4D82-4EA5-9D14-3CA044D443EF}</Project>
77-
<Name>SwiftReflector</Name>
78-
</ProjectReference>
79-
<ProjectReference Include="..\SwiftRuntimeLibrary\SwiftRuntimeLibrary.csproj">
80-
<Project>{B7E6CF5A-B836-41CF-988C-A83607AF5445}</Project>
81-
<Name>SwiftRuntimeLibrary</Name>
82-
</ProjectReference>
83-
<ProjectReference Include="..\tom-swifty\tom-swifty.csproj">
84-
<Project>{8CAC7366-9650-440D-A3C5-36D880285DD5}</Project>
85-
<Name>tom-swifty</Name>
86-
</ProjectReference>
87-
</ItemGroup>
88-
<PropertyGroup>
89-
<LangVersion>latest</LangVersion>
90-
</PropertyGroup>
91-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
92-
</Project>
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net7.0</TargetFramework>
4+
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
5+
<OutputType>Exe</OutputType>
6+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
7+
<Platforms>x86;AnyCPU</Platforms>
8+
<ExternalConsole>true</ExternalConsole>
9+
</PropertyGroup>
10+
<ItemGroup>
11+
<ProjectReference Include="..\Dynamo\Dynamo.csproj" />
12+
<ProjectReference Include="..\SwiftReflector\SwiftReflector.csproj" />
13+
<ProjectReference Include="..\SwiftRuntimeLibrary\SwiftRuntimeLibrary.csproj" />
14+
<ProjectReference Include="..\tom-swifty\tom-swifty.csproj" />
15+
</ItemGroup>
16+
<ItemGroup>
17+
<PackageReference Include="Mono.Options" Version="6.6.0.161" />
18+
</ItemGroup>
19+
<PropertyGroup>
20+
<LangVersion>latest</LangVersion>
21+
</PropertyGroup>
22+
</Project>

DylibBinder/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
1818
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
1919

20-
[assembly: AssemblyVersion ("1.0.*")]
20+
[assembly: AssemblyVersion ("1.0.0")]
2121

2222
// The following attributes are used to specify the signing key for the assembly,
2323
// if desired. See the Mono documentation for more information about signing.

DylibBinder/packages.config

Lines changed: 0 additions & 4 deletions
This file was deleted.

Dynamo/Dynamo.CSLang/CSDelegateTypeDecl.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,27 @@
55

66
namespace Dynamo.CSLang {
77
public class CSDelegateTypeDecl : DelegatedSimpleElement, ICSStatement {
8-
public CSDelegateTypeDecl (CSVisibility vis, CSType type, CSIdentifier name, CSParameterList parms)
8+
public CSDelegateTypeDecl (CSVisibility vis, CSType type, CSIdentifier name, CSParameterList parms, bool isUnsafe = false)
99
{
1010
Visibility = vis;
1111
Type = type != null ? type : CSSimpleType.Void;
1212
Name = Exceptions.ThrowOnNull (name, "name");
1313
Parameters = parms;
14+
IsUnsafe = isUnsafe;
1415
}
1516

1617
public CSVisibility Visibility { get; private set; }
1718
public CSType Type { get; private set; }
1819
public CSIdentifier Name { get; private set; }
1920
public CSParameterList Parameters { get; private set; }
21+
public bool IsUnsafe { get; private set; }
2022

2123
protected override void LLWrite (ICodeWriter writer, object o)
2224
{
2325
writer.BeginNewLine (true);
2426
writer.Write (CSMethod.VisibilityToString (Visibility), false);
27+
if (IsUnsafe)
28+
writer.Write (" unsafe", true);
2529
writer.Write (" delegate ", true);
2630
Type.WriteAll (writer);
2731
writer.Write (' ', true);

Dynamo/Dynamo.CSLang/CSFieldDeclaration.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,20 @@ public static CSLine VarLine (CSIdentifier name, ICSExpression value)
5353
}
5454

5555
public class CSFieldDeclaration : CSVariableDeclaration {
56-
public CSFieldDeclaration (CSType type, IEnumerable<CSBinding> bindings, CSVisibility vis = CSVisibility.None, bool isStatic = false, bool isReadonly = false)
56+
public CSFieldDeclaration (CSType type, IEnumerable<CSBinding> bindings, CSVisibility vis = CSVisibility.None, bool isStatic = false, bool isReadonly = false, bool isUnsafe = false)
5757
: base (type, bindings)
5858
{
5959
Visibilty = vis;
6060
IsStatic = isStatic;
61+
IsUnsafe = isUnsafe;
6162
if (isReadonly) {
6263
this.Insert (0, new SimpleElement ("readonly"));
6364
this.Insert (1, SimpleElement.Spacer);
6465
}
66+
if (IsUnsafe) {
67+
this.Insert (0, new SimpleElement ("unsafe"));
68+
this.Insert (1, SimpleElement.Spacer);
69+
}
6570
if (isStatic) {
6671
this.Insert (0, new SimpleElement ("static"));
6772
this.Insert (1, SimpleElement.Spacer);
@@ -72,19 +77,20 @@ public CSFieldDeclaration (CSType type, IEnumerable<CSBinding> bindings, CSVisib
7277
}
7378
}
7479

75-
public CSFieldDeclaration (CSType type, string name, ICSExpression value = null, CSVisibility vis = CSVisibility.None, bool isSatic = false, bool isReadonly = false)
76-
: this (type, new CSIdentifier (name), value, vis, isSatic, isReadonly)
80+
public CSFieldDeclaration (CSType type, string name, ICSExpression value = null, CSVisibility vis = CSVisibility.None, bool isStatic = false, bool isReadonly = false, bool isUnsafe = false)
81+
: this (type, new CSIdentifier (name), value, vis, isStatic, isReadonly, isUnsafe)
7782
{
7883
}
7984

80-
public CSFieldDeclaration (CSType type, CSIdentifier name, ICSExpression value = null, CSVisibility vis = CSVisibility.None, bool isStatic = false, bool isReadOnly = false)
81-
: this (type, new CSBinding [] { new CSBinding (name, value) }, vis, isStatic, isReadOnly)
85+
public CSFieldDeclaration (CSType type, CSIdentifier name, ICSExpression value = null, CSVisibility vis = CSVisibility.None, bool isStatic = false, bool isReadOnly = false, bool isUnsafe = false)
86+
: this (type, new CSBinding [] { new CSBinding (name, value) }, vis, isStatic, isReadOnly, isUnsafe)
8287
{
8388
}
8489

8590

8691
public CSVisibility Visibilty { get; private set; }
8792
public bool IsStatic { get; private set; }
93+
public bool IsUnsafe { get; private set; }
8894

8995
public static CSLine FieldLine (CSType type, CSIdentifier name, ICSExpression value = null, CSVisibility vis = CSVisibility.None, bool isStatic = false)
9096
{

Dynamo/Dynamo.CSLang/CSType.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public string Name {
8787
public string GenericTypeName { get; private set; }
8888
public CSType [] GenericTypes { get; private set; }
8989
public bool IsArray { get; private set; }
90+
public bool IsPointer { get; private set; }
9091

9192
string GenerateName ()
9293
{
@@ -145,7 +146,7 @@ static CSSimpleType
145146
tObject = new CSSimpleType ("object"),
146147
tIntPtr = new CSSimpleType ("IntPtr"),
147148
tVoid = new CSSimpleType ("void"),
148-
tByteStar = new CSSimpleType ("byte *"),
149+
tByteStar = new CSSimpleType ("byte").Star,
149150
tType = new CSSimpleType ("Type"),
150151
tVar = new CSSimpleType ("var"),
151152
tNfloat = new CSSimpleType ("nfloat"),
@@ -158,7 +159,9 @@ public CSSimpleType Star {
158159
if (Name.EndsWith ("[]")) {
159160
throw new NotImplementedException ("Blindly making an array a pointer doesn't do what you think.");
160161
} else {
161-
return new CSSimpleType (Name + " *", false);
162+
var ptrType = new CSSimpleType (Name + " *", false);
163+
ptrType.IsPointer = true;
164+
return ptrType;
162165
}
163166
}
164167
}

Dynamo/Dynamo.CSLang/CSUnaryExpression.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ static string OperatorToString (CSUnaryOperator op)
4747
}
4848
}
4949

50+
public static CSUnaryExpression AddressOf (ICSExpression expr)
51+
{
52+
return new CSUnaryExpression (CSUnaryOperator.AddressOf, expr);
53+
}
54+
55+
public static CSUnaryExpression Star (ICSExpression expr)
56+
{
57+
return new CSUnaryExpression (CSUnaryOperator.Indirection, expr);
58+
}
59+
5060
public static CSUnaryExpression Out (CSIdentifier id)
5161
{
5262
return new CSUnaryExpression (CSUnaryOperator.Out, id);

0 commit comments

Comments
 (0)