Skip to content

Commit a252c7a

Browse files
committed
Code style fixes
***NO_CI***
1 parent e5a8849 commit a252c7a

File tree

2 files changed

+49
-10
lines changed

2 files changed

+49
-10
lines changed

src/CLR/Core/Interpreter.cpp

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,9 @@ bool CLR_RT_Thread::FindEhBlock(
433433
_ASSERTE(from);
434434
// onlyFinallys is false when we're searching for a handler for an exception, and to should be nullptr
435435
_ASSERTE(FIMPLIES(!onlyFinallys, to == nullptr));
436-
// onlyFinallys is true in Phase2, endfinally, leave, etc. to is nullptr when we want to leave outside of the current
437-
// stack frame, or non-nullptr and pointing to an IL instruction that we are going to when finally's, if any, are
438-
// processed.
436+
// onlyFinallys is true in Phase2, endfinally, leave, etc. to is nullptr when we want to leave outside of the
437+
// current stack frame, or non-nullptr and pointing to an IL instruction that we are going to when finally's, if
438+
// any, are processed.
439439

440440
#if defined(NANOCLR_TRACE_EXCEPTIONS)
441441
if (CLR_EE_DBG_IS_NOT(NoStackTraceInExceptions) && s_CLR_RT_fTrace_Exceptions >= c_CLR_RT_Trace_Annoying)
@@ -936,7 +936,10 @@ HRESULT CLR_RT_Thread::Execute_DelegateInvoke(CLR_RT_StackFrame &stackArg)
936936

937937
ptr = &stack->m_arguments[0];
938938
if (ptr->DataType() != DATATYPE_OBJECT)
939+
{
939940
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
941+
}
942+
940943
dlg = ptr->DereferenceDelegate();
941944
FAULT_ON_NULL(dlg);
942945

@@ -2171,9 +2174,9 @@ HRESULT CLR_RT_Thread::Execute_IL(CLR_RT_StackFrame &stackArg)
21712174
NANOCLR_CHECK_HRESULT(CLR_RT_TypeDescriptor::ExtractTypeIndexFromObject(pThis[0], cls));
21722175

21732176
// This test is for performance reasons. c# emits a callvirt on all instance methods to
2174-
// make sure that a NullReferenceException is thrown if 'this' is nullptr. However, if the
2175-
// instance method isn't virtual we don't need to do the more expensive virtual method
2176-
// lookup.
2177+
// make sure that a NullReferenceException is thrown if 'this' is nullptr. However, if
2178+
// the instance method isn't virtual we don't need to do the more expensive virtual
2179+
// method lookup.
21772180
if (op == CEE_CALLVIRT &&
21782181
(calleeInst.target->flags &
21792182
(CLR_RECORD_METHODDEF::MD_Abstract | CLR_RECORD_METHODDEF::MD_Virtual)))
@@ -2290,7 +2293,9 @@ HRESULT CLR_RT_Thread::Execute_IL(CLR_RT_StackFrame &stackArg)
22902293
CLR_RT_TypeDef_Index cls;
22912294

22922295
if (type.ResolveToken(arg, assm, &stack->m_call) == false)
2296+
{
22932297
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
2298+
}
22942299

22952300
NANOCLR_CHECK_HRESULT(CLR_RT_TypeDescriptor::ExtractTypeIndexFromObject(evalPos[0], cls));
22962301

@@ -2530,7 +2535,10 @@ HRESULT CLR_RT_Thread::Execute_IL(CLR_RT_StackFrame &stackArg)
25302535

25312536
CLR_RT_FieldDef_Instance fieldInst;
25322537
if (fieldInst.ResolveToken(arg, assm) == false)
2538+
{
25332539
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
2540+
}
2541+
25342542
CLR_RT_HeapBlock *obj = &evalPos[0];
25352543
NanoCLRDataType dt = obj->DataType();
25362544

@@ -2580,7 +2588,10 @@ HRESULT CLR_RT_Thread::Execute_IL(CLR_RT_StackFrame &stackArg)
25802588

25812589
CLR_RT_FieldDef_Instance fieldInst;
25822590
if (fieldInst.ResolveToken(arg, assm) == false)
2591+
{
25832592
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
2593+
}
2594+
25842595
CLR_RT_HeapBlock *obj = &evalPos[0];
25852596
NanoCLRDataType dt = obj->DataType();
25862597

@@ -2699,7 +2710,9 @@ HRESULT CLR_RT_Thread::Execute_IL(CLR_RT_StackFrame &stackArg)
26992710

27002711
CLR_RT_FieldDef_Instance field;
27012712
if (field.ResolveToken(arg, assm) == false)
2713+
{
27022714
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
2715+
}
27032716

27042717
CLR_RT_HeapBlock *ptr = CLR_RT_ExecutionEngine::AccessStaticField(field);
27052718

@@ -2724,7 +2737,9 @@ HRESULT CLR_RT_Thread::Execute_IL(CLR_RT_StackFrame &stackArg)
27242737

27252738
CLR_RT_FieldDef_Instance field;
27262739
if (field.ResolveToken(arg, assm) == false)
2740+
{
27272741
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
2742+
}
27282743

27292744
CLR_RT_HeapBlock *ptr = CLR_RT_ExecutionEngine::AccessStaticField(field);
27302745

@@ -2780,7 +2795,9 @@ HRESULT CLR_RT_Thread::Execute_IL(CLR_RT_StackFrame &stackArg)
27802795

27812796
CLR_RT_TypeDef_Instance typeInst{};
27822797
if (typeInst.ResolveToken(arg, assm, &stack->m_call) == false)
2798+
{
27832799
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
2800+
}
27842801

27852802
UPDATESTACK(stack, evalPos);
27862803

@@ -2831,7 +2848,9 @@ HRESULT CLR_RT_Thread::Execute_IL(CLR_RT_StackFrame &stackArg)
28312848
{
28322849
hr = CLR_RT_HeapBlock_Array::CreateInstance(evalPos[0], size, assm, arg);
28332850
if (SUCCEEDED(hr))
2851+
{
28342852
break;
2853+
}
28352854

28362855
// if we have an out of memory exception, perform a compaction and try again.
28372856
if (hr == CLR_E_OUT_OF_MEMORY && pass == 0)
@@ -2938,13 +2957,17 @@ HRESULT CLR_RT_Thread::Execute_IL(CLR_RT_StackFrame &stackArg)
29382957
CLR_RT_TypeDef_Index cls;
29392958

29402959
if (!type.ResolveToken(arg, assm, &stack->m_call))
2960+
{
29412961
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
2962+
}
29422963

29432964
NANOCLR_CHECK_HRESULT(CLR_RT_TypeDescriptor::ExtractTypeIndexFromObject(evalPos[0], cls));
29442965

29452966
// Check this is an object of the requested type.
29462967
if (type.data != cls.data)
2968+
{
29472969
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
2970+
}
29482971

29492972
UPDATESTACK(stack, evalPos);
29502973
{
@@ -3130,7 +3153,9 @@ HRESULT CLR_RT_Thread::Execute_IL(CLR_RT_StackFrame &stackArg)
31303153
{
31313154
CLR_RT_TypeSpec_Instance sig{};
31323155
if (sig.ResolveToken(arg, assm) == false)
3156+
{
31333157
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
3158+
}
31343159

31353160
evalPos[0].SetReflection(sig);
31363161
}
@@ -3141,7 +3166,9 @@ HRESULT CLR_RT_Thread::Execute_IL(CLR_RT_StackFrame &stackArg)
31413166
{
31423167
CLR_RT_TypeDef_Instance cls{};
31433168
if (cls.ResolveToken(arg, assm, &stack->m_call) == false)
3169+
{
31443170
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
3171+
}
31453172

31463173
evalPos[0].SetReflection(cls);
31473174
}
@@ -3152,7 +3179,9 @@ HRESULT CLR_RT_Thread::Execute_IL(CLR_RT_StackFrame &stackArg)
31523179
{
31533180
CLR_RT_FieldDef_Instance field;
31543181
if (field.ResolveToken(arg, assm) == false)
3182+
{
31553183
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
3184+
}
31563185

31573186
evalPos[0].SetReflection(field);
31583187
}
@@ -3163,7 +3192,9 @@ HRESULT CLR_RT_Thread::Execute_IL(CLR_RT_StackFrame &stackArg)
31633192
{
31643193
CLR_RT_MethodDef_Instance method{};
31653194
if (method.ResolveToken(arg, assm) == false)
3195+
{
31663196
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
3197+
}
31673198

31683199
evalPos[0].SetReflection(method);
31693200
}
@@ -3329,7 +3360,9 @@ HRESULT CLR_RT_Thread::Execute_IL(CLR_RT_StackFrame &stackArg)
33293360

33303361
CLR_RT_MethodDef_Instance method{};
33313362
if (method.ResolveToken(arg, assm) == false)
3363+
{
33323364
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
3365+
}
33333366

33343367
UPDATESTACK(stack, evalPos);
33353368

@@ -3345,7 +3378,10 @@ HRESULT CLR_RT_Thread::Execute_IL(CLR_RT_StackFrame &stackArg)
33453378

33463379
CLR_RT_MethodDef_Instance callee{};
33473380
if (callee.ResolveToken(arg, assm) == false)
3381+
{
33483382
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
3383+
}
3384+
33493385
CLR_RT_TypeDef_Index cls;
33503386

33513387
NANOCLR_CHECK_HRESULT(CLR_RT_TypeDescriptor::ExtractTypeIndexFromObject(evalPos[0], cls));
@@ -3410,7 +3446,10 @@ HRESULT CLR_RT_Thread::Execute_IL(CLR_RT_StackFrame &stackArg)
34103446

34113447
CLR_RT_TypeDef_Instance clsInst{};
34123448
if (clsInst.ResolveToken(arg, assm, &stack->m_call) == false)
3449+
{
34133450
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
3451+
}
3452+
34143453
CLR_INT32 len;
34153454

34163455
if (clsInst.target->dataType)

src/CLR/Include/nanoCLR_Runtime__HeapBlock.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,16 +459,16 @@ struct CLR_RT_HeapBlock
459459
R8 &operator+=(const R8 &num)
460460
{
461461
auto value = (double)*this; // uses conversion
462-
value += (double)num; // uses conversion and then built-in type double
463-
*this = value; // uses assignment operator (operator=)
462+
value += (double)num; // uses conversion and then built-in type double
463+
*this = value; // uses assignment operator (operator=)
464464
return *this;
465465
}
466466

467467
R8 &operator-=(const R8 &num)
468468
{
469469
auto value = (double)*this; // uses conversion
470-
value -= (double)num; // uses conversion and then built-in type double
471-
*this = value; // uses assignment operator (operator=)
470+
value -= (double)num; // uses conversion and then built-in type double
471+
*this = value; // uses assignment operator (operator=)
472472
return *this;
473473
}
474474

0 commit comments

Comments
 (0)