class MyClass {
int a;
MyClass(int a) { this.a = a; }
int foo() { return a; }
}
void main() {
MyClass m(5);
int i = (m = MyClass(10)).a;
print(i + "\n"); // prints 1804132792
MyClass n(10);
MyClass o(15);
m = n = o; // works
// m = n = MyClass(20); // assert error in as_scriptstruct.cpp line 403
(m = n).foo(); // works
// (m = MyClass(20)).foo(); // access violation
}
This seems to occur not only with using MyClass(a) to create a temporary, but also if the temporary is the return value of a function.
Bug in AS 2.14.1 script struct temporary assignment expression value
The expression value of the result of assigning a temporary to a script struct seems to be funky in AngelScript 2.14.1. Ex:
I've found and fixed this bug. The fix will be available in the SVN in a few hours.
This bug has been around for years. It's funny how some bugs can live within the code for so long without anyone encountering them.
This bug has been around for years. It's funny how some bugs can live within the code for so long without anyone encountering them.
Well one weird thing I noticed, though it doesn't cause any crashes, is that AngelScript accepts hexadecimal literals starting with any character from 0-9. Ex: 9xf and 0xf are both hexadecimal literals for the number 15. Is this deliberate?
(Right now I'm looking at implementing intellisense in my AngelScript debugger, which is why I've been looking all these parsing details lately.)
(Right now I'm looking at implementing intellisense in my AngelScript debugger, which is why I've been looking all these parsing details lately.)
That would be a bug. Only 0x and 0X should be accepted for hex literals.
One of the things that I have planned for 2.15.0 is to expose a function that will return the token found in a string. The function will also classify this token, e.g. identifier, constant, comment, etc. Perhaps that may be of use for your intellisense implementation.
One of the things that I have planned for 2.15.0 is to expose a function that will return the token found in a string. The function will also classify this token, e.g. identifier, constant, comment, etc. Perhaps that may be of use for your intellisense implementation.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement