Skip to content

Commit

Permalink
Fix comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaanstra committed Mar 13, 2024
1 parent 2901891 commit c895b0d
Showing 1 changed file with 29 additions and 37 deletions.
66 changes: 29 additions & 37 deletions src/cswinrt/code_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -1980,14 +1980,12 @@ private static IObjectReference %
get
{
var factory = __%;
if (factory != null && factory.IsInCurrentContext)
if (factory is not null && factory.IsInCurrentContext)
{
return factory;
}
else
{
return __% = ActivationFactory.Get("%.%");
}
return __% = ActivationFactory.Get("%.%");
}
}
)",
Expand All @@ -2012,14 +2010,12 @@ private static ObjectReference<%> %
get
{
var factory = __%;
if (factory != null && factory.IsInCurrentContext)
if (factory is not null && factory.IsInCurrentContext)
{
return factory;
}
else
{
return __% = ActivationFactory.Get<%>("%.%", %.IID);
}
return __% = ActivationFactory.Get<%>("%.%", %.IID);
}
}
)",
Expand All @@ -2044,14 +2040,12 @@ private static IObjectReference %
get
{
var factory = __%;
if (factory != null && factory.IsInCurrentContext)
if (factory is not null && factory.IsInCurrentContext)
{
return factory;
}
else
{
return __% = ActivationFactory.Get("%.%", %.IID);
}
return __% = ActivationFactory.Get("%.%", %.IID);
}
}
)",
Expand Down Expand Up @@ -3838,7 +3832,7 @@ private static global::System.Runtime.CompilerServices.ConditionalWeakTable<obje
get
{
var table = _%_;
if (table != null)
if (table is not null)
{
return table;
}
Expand Down Expand Up @@ -5215,7 +5209,7 @@ internal unsafe volatile static delegate*<IObjectReference, %%%> _%;
else if (projected_signature_has_generic && !is_generic_method_instantiation_class)
{
w.write(R"(
if (!RuntimeFeature.IsDynamicCodeCompiled || _% != null)
if (!RuntimeFeature.IsDynamicCodeCompiled || _% is not null)
{
% _%(_genericObj%%);
}
Expand Down Expand Up @@ -5290,7 +5284,7 @@ else
else if (projected_signature_has_generic && !is_generic_method_instantiation_class)
{
w.write(R"(
if (!RuntimeFeature.IsDynamicCodeCompiled || _% != null)
if (!RuntimeFeature.IsDynamicCodeCompiled || _% is not null)
{
return _%(_genericObj);
}
Expand Down Expand Up @@ -5340,7 +5334,7 @@ else
if (projected_signature_has_generic && !is_generic_method_instantiation_class)
{
w.write(R"(
if (!RuntimeFeature.IsDynamicCodeCompiled || _% != null)
if (!RuntimeFeature.IsDynamicCodeCompiled || _% is not null)
{
_%(_genericObj, value);
}
Expand Down Expand Up @@ -6557,7 +6551,7 @@ private static global::System.Runtime.CompilerServices.ConditionalWeakTable<%, g
get
{
var tokenTables = _%_tokenTables;
if (tokenTables != null)
if (tokenTables is not null)
{
return tokenTables;
}
Expand Down Expand Up @@ -6625,7 +6619,7 @@ private static unsafe int Do_Abi_%%
try
{
var __this = global::WinRT.ComWrappersSupport.FindObject<%>(thisPtr);
if(__this != null && _%_TokenTables.TryGetValue(__this, out var __table) && __table.RemoveEventHandler(%, out var __handler))
if(__this is not null && _%_TokenTables.TryGetValue(__this, out var __table) && __table.RemoveEventHandler(%, out var __handler))
{
__this.% -= __handler;
}
Expand Down Expand Up @@ -6659,7 +6653,7 @@ private static global::System.Runtime.CompilerServices.ConditionalWeakTable<%, g
get
{
var tokenTables = _%_tokenTables;
if (tokenTables != null)
if (tokenTables is not null)
{
return tokenTables;
}
Expand Down Expand Up @@ -6698,7 +6692,7 @@ return token;
public static void Do_Abi_%(IntPtr thisPtr, global::WinRT.EventRegistrationToken token)
{
var __this = global::WinRT.ComWrappersSupport.FindObject<%>(thisPtr);
if(__this != null && _%_TokenTables.TryGetValue(__this, out var __table) && __table.RemoveEventHandler(token, out var __handler))
if(__this is not null && _%_TokenTables.TryGetValue(__this, out var __table) && __table.RemoveEventHandler(token, out var __handler))
{
__this.% -= __handler;
}
Expand Down Expand Up @@ -7262,7 +7256,7 @@ IInspectableVftbl = global::WinRT.IInspectable.Vftbl.AbiToProjectionVftable,
{
%
internal static ObjectReference<Vftbl> FromAbi(IntPtr thisPtr)%
public static implicit operator %(IObjectReference obj) => (obj != null) ? new %(obj) : null;
public static implicit operator %(IObjectReference obj) => (obj is not null) ? new %(obj) : null;
protected readonly ObjectReference<Vftbl> _obj;
public IObjectReference ObjRef { get => _obj; }
public IntPtr ThisPtr => _obj.ThisPtr;
Expand Down Expand Up @@ -7385,7 +7379,7 @@ global::System.Collections.Concurrent.ConcurrentDictionary<RuntimeTypeHandle, IO
get
{
var cache = _queryInterfaceCache;
if (cache != null)
if (cache is not null)
{
return cache;
}
Expand All @@ -7402,7 +7396,7 @@ global::System.Collections.Concurrent.ConcurrentDictionary<RuntimeTypeHandle, ob
get
{
var typeData = _additionalTypeData;
if (typeData != null)
if (typeData is not null)
{
return typeData;
}
Expand Down Expand Up @@ -7445,15 +7439,13 @@ private IObjectReference %
get
{
var objRef = __%;
if (objRef != null)
if (objRef is not null)
{
return objRef;
}
else
{
global::System.Threading.Interlocked.CompareExchange(ref __%, ((IWinRTObject)this).NativeObject.As<IUnknownVftbl>(%.IID), null);
return __%;
}
global::System.Threading.Interlocked.CompareExchange(ref __%, ((IWinRTObject)this).NativeObject.As<IUnknownVftbl>(%.IID), null);
return __%;
}
}
)",
Expand Down Expand Up @@ -8630,7 +8622,7 @@ global::System.Collections.Concurrent.ConcurrentDictionary<RuntimeTypeHandle, IO
get
{
var cache = _queryInterfaceCache;
if (cache != null)
if (cache is not null)
{
return cache;
}
Expand All @@ -8647,7 +8639,7 @@ global::System.Collections.Concurrent.ConcurrentDictionary<RuntimeTypeHandle, ob
get
{
var typeData = _additionalTypeData;
if (typeData != null)
if (typeData is not null)
{
return typeData;
}
Expand Down Expand Up @@ -8924,7 +8916,7 @@ global::System.Collections.Concurrent.ConcurrentDictionary<RuntimeTypeHandle, IO
get
{
var cache = _queryInterfaceCache;
if (cache != null)
if (cache is not null)
{
return cache;
}
Expand All @@ -8941,7 +8933,7 @@ global::System.Collections.Concurrent.ConcurrentDictionary<RuntimeTypeHandle, ob
get
{
var typeData = _additionalTypeData;
if (typeData != null)
if (typeData is not null)
{
return typeData;
}
Expand Down Expand Up @@ -9164,7 +9156,7 @@ Abi_Invoke_Type = Expression.GetDelegateType(new Type[] { typeof(void*), %typeof
if (!settings.netstandard_compat && have_generic_params)
{
w.write(R"(
if (%._Invoke != null || !RuntimeFeature.IsDynamicCodeCompiled)
if (%._Invoke is not null || !RuntimeFeature.IsDynamicCodeCompiled)
{
%._Invoke(_nativeDelegate, %);
}
Expand Down

0 comments on commit c895b0d

Please sign in to comment.