Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Дублирование числовых констант #1448

Open
Mr-Rm opened this issue Aug 30, 2024 · 2 comments
Open

Дублирование числовых констант #1448

Mr-Rm opened this issue Aug 30, 2024 · 2 comments

Comments

@Mr-Rm
Copy link
Collaborator

Mr-Rm commented Aug 30, 2024

Опишите ошибку
При компиляции в таблице констант повторяются равные числовые значения, если они имеют различное представление в исходном коде

Воспроизведение ошибки
issue.os:

x = 0;
x = 00;
x = 0000;
x = 0.00000;
x = 000.000;
x = 00000.0;
x = 000001;
x = 0001;
x = 01;
x = 01.20;
x = 001.200;
  • v1
    oscript -compile issue.os

.variableFrame:
.constants
0 :type: Number, val: 0
1 :type: Number, val: 00
2 :type: Number, val: 0000
3 :type: Number, val: 0.00000
4 :type: Number, val: 000.000
5 :type: Number, val: 00000.0
6 :type: Number, val: 000001
7 :type: Number, val: 0001
8 :type: Number, val: 01
9 :type: Number, val: 01.20
10 :type: Number, val: 001.200
.code
0 :(LineNum 1)
1 :(PushConst 0)
2 :(LoadLoc 0)
3 :(LineNum 2)
4 :(PushConst 1)
5 :(LoadLoc 0)
6 :(LineNum 3)
7 :(PushConst 2)
...

представление чисел сохраняется в исходном виде

  • v2
    oscript -compile issue.os

.variableFrame:
.constants
0 :type: Number, val: 0
1 :type: Number, val: 0
2 :type: Number, val: 0
3 :type: Number, val: 0.00000
4 :type: Number, val: 0.000
5 :type: Number, val: 0.0
6 :type: Number, val: 1
7 :type: Number, val: 1
8 :type: Number, val: 1
9 :type: Number, val: 1.20
10 :type: Number, val: 1.200
.code
0 :(LineNum 1)
1 :(PushConst 0)
2 :(LoadLoc 0)
3 :(LineNum 2)
4 :(PushConst 1)
5 :(LoadLoc 0)
6 :(LineNum 3)
7 :(PushConst 2)
...

сохраняется только дробная часть

Ожидаемое поведение
0 :type: Number, val: 0
1 :type: Number, val: 1
2 :type: Number, val: 1.2

Дополнительная информация
1С:
{"Const",3,
{"N",0},
{"N",1},
{"N",1.2}
},

@EvilBeaver
Copy link
Owner

Так может и пофиг?

@EvilBeaver
Copy link
Owner

Разве что в v2 поправить, т.к. там больше нет ModuleImage и сериализованные константы заменены на BslValue сразу же

akpaevj added a commit to akpaevj/OneScript that referenced this issue Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants