-
831bef98
by Francis De Brabandere at 2026-06-08T20:25:01+02:00
vbscript/tests: Add tests for class declaration scope.
A Class declaration is only valid at script global scope. Test that one is
accepted after another statement on the same line (e.g. Dim x : Class C),
that a duplicate name is reported at the later declaration, and that a Class
declared in a procedure or control-flow body is rejected.
-
02361f57
by Francis De Brabandere at 2026-06-08T20:25:03+02:00
vbscript: Handle class declaration scope in the parser.
A ClassDeclaration was only accepted as a standalone top-level
SourceElement, so a class that followed another statement on the same line
(e.g. Dim x : Class C) failed to parse, and a duplicate class name was
reported at the first declaration rather than the later one.
Make a class one of the units a global line is built from, registered in
source order, so such a line parses and a redefinition is reported at the
later declaration as native does. Because a class is only valid at global
scope it is reachable only there, not from the shared statement grammar used
by procedure and control-flow bodies, so a class anywhere else is reported
as a syntax error at its location.
-
87ecf793
by Francis De Brabandere at 2026-06-08T20:25:05+02:00
vbscript/tests: Add tests for sub declaration scope.
A Sub or Function is only valid at script global scope: a global If/Select
block hoists it to global scope, but a loop or procedure body does not.
Test the hoisting cases, and mark todo_wine the disallowed cases that native
rejects but the parser does not yet (a Sub in another procedure body or in a
loop), since handling those is left to a follow-up.