You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, ILValues have a literal_val attribute that stores None if the ILValue does not have a known compile-time integer literal value, or the integer value as a Python number if it does.
A better implementation of literal values would involve a LiteralValue class, from which IntegerLiteralValue, StringLiteralValue, etc. would inherit. Then, the literal_val attribute of an IL value that has a fixed value known at compile time would be an instance of a subclass of LiteralValue.
The text was updated successfully, but these errors were encountered:
#98 did most of this, but there are still some potential improvements to explore. Specifically, it may be interesting to explore adding a raw() function to the _Literal object. Then, we write something like literal.raw() to get a raw representation of the literal value that can be directly inserted into ASM code.
Also, the code in #98 assumes that the type of the literal for an IL value will be compatible with the type of the IL value itself; that is, an IL value of integral type will have a literal_val of only integral type. While this works for now, I'm not sure it's a fair assumption going forwards. To protect for this, we can add a test for int array[5]; array[(int)"hello"]
Today, ILValues have a
literal_val
attribute that storesNone
if the ILValue does not have a known compile-time integer literal value, or the integer value as a Python number if it does.A better implementation of literal values would involve a
LiteralValue
class, from whichIntegerLiteralValue
,StringLiteralValue
, etc. would inherit. Then, theliteral_val
attribute of an IL value that has a fixed value known at compile time would be an instance of a subclass ofLiteralValue
.The text was updated successfully, but these errors were encountered: