1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-06-26 11:29:28 +00:00

Undo the sizeof change for now

This commit is contained in:
Karol Stasiak 2019-11-03 23:17:44 +01:00
parent 38e4dd14a6
commit 68fcf8f2d7
2 changed files with 5 additions and 2 deletions

View File

@ -292,7 +292,7 @@ but not
some enum → `word`
* `sizeof`: size of the argument in bytes; the argument can be an expression or a type,
and the result is a constant of type `word`
and the result is a constant of either `byte` or `word` type, depending on the actual value
* `call`: calls a function via a pointer;
the first argument is the pointer to the function;

View File

@ -453,7 +453,10 @@ object AbstractExpressionCompiler {
case FunctionCallExpression("sin", params) => if (params.size < 2) b else getExpressionTypeImpl(env, log, params(1), loosely)
case FunctionCallExpression("cos", params) => if (params.size < 2) b else getExpressionTypeImpl(env, log, params(1), loosely)
case FunctionCallExpression("tan", params) => if (params.size < 2) b else getExpressionTypeImpl(env, log, params(1), loosely)
case FunctionCallExpression("sizeof", _) => w
case FunctionCallExpression("sizeof", params) => env.evalSizeof(params.head).requiredSize match {
case 1 => b
case 2 => w
}
case FunctionCallExpression("%%", params) => params.map { e => getExpressionTypeImpl(env, log, e, loosely).size } match {
case List(1, 1) | List(2, 1) => b
case List(1, 2) | List(2, 2) => w