Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim8y committed Aug 26, 2024
1 parent 0e9e01a commit bff60be
Show file tree
Hide file tree
Showing 9 changed files with 306 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ private void ConvertFieldIdentifierNameCoalesceAssignment(SemanticModel model, I
byte index = Context.AddStaticField(left);
_instructionsBuilder.LdSFld(index);
_instructionsBuilder.IsNull();
_instructionsBuilder.Jump(OpCode.JMPIF_L, assignmentTarget);
_instructionsBuilder.JmpIfL(assignmentTarget);
_instructionsBuilder.LdSFld(index);
_instructionsBuilder.Jump(OpCode.JMP_L, endTarget);
_instructionsBuilder.JmpL(endTarget);
_instructionsBuilder.AddTarget(assignmentTarget);
ConvertExpression(model, right);
_instructionsBuilder.Dup();
Expand Down Expand Up @@ -228,7 +228,7 @@ private void ConvertPropertyIdentifierNameCoalesceAssignment(SemanticModel model
CallMethodWithConvention(model, left.GetMethod!);
_instructionsBuilder.Dup();
_instructionsBuilder.IsNull();
_instructionsBuilder.Jump(OpCode.JMPIFNOT_L, endTarget);
_instructionsBuilder.JmpIfNotL(endTarget);
_instructionsBuilder.Drop();
ConvertExpression(model, right);
_instructionsBuilder.Dup();
Expand All @@ -240,7 +240,7 @@ private void ConvertPropertyIdentifierNameCoalesceAssignment(SemanticModel model
CallMethodWithConvention(model, left.GetMethod!);
_instructionsBuilder.Dup();
_instructionsBuilder.IsNull();
_instructionsBuilder.Jump(OpCode.JMPIFNOT_L, endTarget);
_instructionsBuilder.JmpIfNotL(endTarget);
_instructionsBuilder.Drop();
_instructionsBuilder.LdArg0();
ConvertExpression(model, right);
Expand Down Expand Up @@ -297,7 +297,7 @@ private void ConvertPropertyMemberAccessCoalesceAssignment(SemanticModel model,
CallMethodWithConvention(model, property.GetMethod!);
_instructionsBuilder.Dup();
_instructionsBuilder.IsNull();
_instructionsBuilder.Jump(OpCode.JMPIFNOT_L, endTarget);
_instructionsBuilder.JmpIfNotL(endTarget);
_instructionsBuilder.Drop();
ConvertExpression(model, right);
_instructionsBuilder.Dup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private void ConvertIndexOrRange(SemanticModel model, ITypeSymbol type, Expressi
_instructionsBuilder.Swap();
if (range.LeftOperand is null)
{
_instructionsBuilder.Push(0);
_instructionsBuilder.Push0();
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,14 @@ private void EnsureIntegerInRange(ITypeSymbol type)
}
else
{
adjustTarget.Instruction = _instructionsBuilder.Push(mask);
_instructionsBuilder.Push(mask).AddTarget(adjustTarget);
_instructionsBuilder.And();
if (minValue < 0)
{
_instructionsBuilder.Dup();
_instructionsBuilder.Push(maxValue);
_instructionsBuilder.JmpLeL(endTarget);
_instructionsBuilder.Push(mask + 1);
_instructionsBuilder.Sub();
_instructionsBuilder.Sub(mask + 1);
}
}
_instructionsBuilder.AddTarget(endTarget);
Expand Down Expand Up @@ -320,7 +319,7 @@ private void ConvertObjectToString(SemanticModel model, ExpressionSyntax express
case "ulong":
case "System.Numerics.BigInteger":
ConvertExpression(model, expression);
CallContractMethod(NativeContract.StdLib.Hash, "itoa", 1, true);
_instructionsBuilder.Itoa(this);
break;
case "char":
ConvertExpression(model, expression);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private void ConvertDefaultLiteralExpression(SemanticModel model, LiteralExpress
case SpecialType.System_Single:
case SpecialType.System_Double:
case SpecialType.System_Char:
_instructionsBuilder.Push(0);
_instructionsBuilder.Push0();
break;
case SpecialType.System_String:
case SpecialType.System_Object:
Expand All @@ -103,7 +103,7 @@ private void ConvertDefaultLiteralExpression(SemanticModel model, LiteralExpress
if (type.ToString() == "System.Numerics.BigInteger")
{
// BigInteger's default value is 0
_instructionsBuilder.Push(0);
_instructionsBuilder.Push0();
}
else if (type.IsReferenceType)
{
Expand Down
Loading

0 comments on commit bff60be

Please sign in to comment.