Skip to content

Code cleanups and improvements #1713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Feb 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "build/modules/premake-qt"]
path = build/modules/premake-qt
url = https://github.com/dcourtois/premake-qt.git
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<GeneratorFileExtension>dll</GeneratorFileExtension>
<DotNetCmd Condition="'$(PlatformTarget)' == 'x86' AND Exists('$(MSBuildProgramFiles32)\dotnet\dotnet.exe')">"$(MSBuildProgramFiles32)\dotnet\dotnet.exe"</DotNetCmd>
<DotNetCmd Condition="'$(PlatformTarget)' == 'x64' AND Exists('$(ProgramW6432)\dotnet\dotnet.exe')">"$(ProgramW6432)\dotnet\dotnet.exe"</DotNetCmd>
<RID Condition="$(IsWindows)">win</RID>
<RID Condition="$(IsWindows)">win</RID>
<RID Condition="$(IsLinux)">linux</RID>
<RID Condition="$(IsMacOSX)">osx</RID>
<RID>$(RID)-$(PlatformTarget)</RID>
Expand Down
2 changes: 1 addition & 1 deletion build/Helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ rootdir = path.getabsolute("../")
srcdir = path.join(rootdir, "src");
incdir = path.join(rootdir, "include");
examplesdir = path.join(rootdir, "examples");
testsdir = path.join(rootdir, "tests");
testsdir = path.join(rootdir, "tests/dotnet");
builddir = path.join(rootdir, "build")
bindir = path.join(rootdir, "bin")
objsdir = path.join(builddir, "obj");
Expand Down
1 change: 0 additions & 1 deletion build/modules/premake-qt
Submodule premake-qt deleted from 0ddc49
2 changes: 1 addition & 1 deletion build/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ workspace "CppSharp"
workspacefiles(path.join(builddir, "premake5.lua"))
workspacefiles(path.join(builddir, "*.sh"))
workspacefiles(path.join(rootdir, ".github/workflows/*.yml"))
workspacefiles(path.join(rootdir, "tests/Test*.props"))
workspacefiles(path.join(testsdir, "Test*.props"))

group "Libraries"
if EnableNativeProjects() then
Expand Down
111 changes: 32 additions & 79 deletions src/AST/Property.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,109 +22,62 @@ public Property(Property property)
parameters.AddRange(property.Parameters);
}

public Type Type
{
get { return QualifiedType.Type; }
}
public Type Type => QualifiedType.Type;

public QualifiedType QualifiedType { get; set; }

public bool IsStatic
{
get
{
return (GetMethod != null && GetMethod.IsStatic) ||
(SetMethod != null && SetMethod.IsStatic);
}
}
public bool IsStatic =>
GetMethod is {IsStatic: true} ||
SetMethod is {IsStatic: true};

public bool IsPure
{
get
{
return (GetMethod != null && GetMethod.IsPure) ||
(SetMethod != null && SetMethod.IsPure);
}
}
public bool IsPure =>
GetMethod is {IsPure: true} ||
SetMethod is {IsPure: true};

public bool IsVirtual
{
get
{
return (GetMethod != null && GetMethod.IsVirtual) ||
(SetMethod != null && SetMethod.IsVirtual);
}
}
public bool IsVirtual =>
GetMethod is {IsVirtual: true} ||
SetMethod is {IsVirtual: true};

public bool IsOverride
{
get
{
return (GetMethod != null && GetMethod.IsOverride) ||
(SetMethod != null && SetMethod.IsOverride);
}
}
public bool IsOverride =>
GetMethod is {IsOverride: true} ||
SetMethod is {IsOverride: true};

public Method GetMethod { get; set; }

public Method SetMethod { get; set; }

public bool HasGetter
{
get
{
return (GetMethod != null &&
GetMethod.GenerationKind != GenerationKind.None) ||
(Field != null &&
Field.GenerationKind != GenerationKind.None);
}
}
public bool HasGetter =>
(GetMethod != null &&
GetMethod.GenerationKind != GenerationKind.None) ||
(Field != null &&
Field.GenerationKind != GenerationKind.None);

public bool HasSetter
{
get
{
return (SetMethod != null &&
SetMethod.GenerationKind != GenerationKind.None) ||
(Field != null &&
(!Field.QualifiedType.IsConst() ||
Field.Type.IsConstCharString()) &&
Field.GenerationKind != GenerationKind.None);
}
}
public bool HasSetter =>
(SetMethod != null &&
SetMethod.GenerationKind != GenerationKind.None) ||
(Field != null &&
(!Field.QualifiedType.IsConst() ||
Field.Type.IsConstCharString()) &&
Field.GenerationKind != GenerationKind.None);

// The field that should be get and set by this property
public Field Field { get; set; }

public Class ExplicitInterfaceImpl { get; set; }

private readonly List<Parameter> parameters = new List<Parameter>();
private readonly List<Parameter> parameters = new();

/// <summary>
/// Only applicable to index ([]) properties.
/// </summary>
public List<Parameter> Parameters
{
get { return parameters; }
}
public List<Parameter> Parameters => parameters;

public bool IsIndexer
{
get
{
return GetMethod != null &&
GetMethod.OperatorKind == CXXOperatorKind.Subscript;
}
}
public bool IsIndexer =>
GetMethod is {OperatorKind: CXXOperatorKind.Subscript};

public bool IsSynthetized
{
get
{
return (GetMethod != null && GetMethod.IsSynthetized) ||
(SetMethod != null && SetMethod.IsSynthetized);
}
}
public bool IsSynthetized =>
(GetMethod != null && GetMethod.IsSynthetized) ||
(SetMethod != null && SetMethod.IsSynthetized);

public override T Visit<T>(IDeclVisitor<T> visitor)
{
Expand Down
141 changes: 0 additions & 141 deletions src/ASTViewer/AstModel.cpp

This file was deleted.

35 changes: 0 additions & 35 deletions src/ASTViewer/AstModel.h

This file was deleted.

Loading