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
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
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.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Thanks.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
(Right now I'm looking at implementing intellisense in my AngelScript debugger, which is why I've been looking all these parsing details lately.)
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.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game