Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix and improve IntegerLiteral:

remove member 'pos' long time unused
rename 'numval' to 'intval'
fix some foreign access to internals
ensure type conversions in initialization and getters
  • Loading branch information...
commit 00bf6759142f03b450aa78b30e8abfec751b73c7 1 parent 39bdcb0
@NotFound authored
Showing with 17 additions and 26 deletions.
  1. +7 −10 winxedst1.winxed
  2. +10 −16 winxedst2.winxed
View
17 winxedst1.winxed
@@ -1049,7 +1049,7 @@ function string_from_literal(var arg)
string value;
switch {
case arg.isintegerliteral():
- value = arg.numval;
+ value = arg.getIntegerValue();
break;
case arg.isstringliteral():
value = arg.getStringValue();
@@ -1065,7 +1065,7 @@ function int_from_literal(var arg)
int value;
switch {
case arg.isintegerliteral():
- value = arg.numval;
+ value = arg.getIntegerValue();
break;
case arg.isstringliteral():
value = arg.getStringValue();
@@ -2861,24 +2861,21 @@ class Literal : SimpleExpr
class IntegerLiteral : Literal
{
- var pos;
- var numval;
- function IntegerLiteral(var owner, var start, var value)
+ var intval;
+ function IntegerLiteral(var owner, var start, int value)
{
self.Expr(owner, start);
- self.pos = start;
- int n = value;
- self.numval = n;
+ self.intval = value;
}
function isintegerliteral() { return true; }
function isintegerzero()
{
- return int(self.numval) == 0;
+ return int(self.intval) == 0;
}
function checkresult() { return REGint; }
function getIntegerValue()
{
- return self.numval;
+ return int(self.intval);
}
function emit(var e, string result)
{
View
26 winxedst2.winxed
@@ -3471,38 +3471,33 @@ class Literal : SimpleExpr
class IntegerLiteral : Literal
{
- var pos;
- var numval;
- function IntegerLiteral(var owner, var start, var value)
+ var intval;
+ function IntegerLiteral(var owner, var start, int value)
{
self.Expr(owner, start);
- self.pos = start;
- int n = value;
- self.numval = n;
+ self.intval = value;
}
function clone(var owner)
{
- return new IntegerLiteral(owner, self.pos, self.numval);
+ return new IntegerLiteral(owner, self.start, self.intval);
}
function isintegerliteral() { return true; }
function isintegerzero()
{
- return int(self.numval) == 0;
+ return int(self.intval) == 0;
}
function checkresult() { return REGint; }
function getIntegerValue()
{
- return self.numval;
+ return int(self.intval);
}
function getFloatValue()
{
- float value = self.getIntegerValue();
- return value;
+ return float(self.intval);
}
function getStringValue()
{
- string str = self.numval;
- return str;
+ return string(self.intval);
}
function getLiteralInteger()
{
@@ -3510,12 +3505,11 @@ class IntegerLiteral : Literal
}
function getLiteralFloat()
{
- return floatValue(self.owner, self.start, self.numval);
+ return floatValue(self.owner, self.start, self.intval);
}
function getLiteralString()
{
- int n = self.numval;
- return stringQuotedValue(self.owner, self.start, n);
+ return stringQuotedValue(self.owner, self.start, self.intval);
}
function emit(var e, string result)
{
Please sign in to comment.
Something went wrong with that request. Please try again.