Page MenuHomeFeedback Tracker

Enscript accessibility modifiers ignored
Closed, ResolvedPublic

Description

Enscript does not check for accessibility when passing functions to various invocation functions.

class A {
  protected void ProtectedMethod() { Print("Hello from protected method."); }
}
void Fn(A a) {
  a.ProtectedMethod(); // compile error
  GetGame().GetCallqueue().CallLater(a.ProtectedMethod, 500); // ok, runs fine.
  GetGame().GetScriptModule().Call(a, "ProtectedMethod", null); // ok, runs fine.
}

The first call correctly diags inaccessibility.
The second one, compiles fine, it should be throwing a compile error just like the first one.
The last one, compiles fine, it should most likely also throw a compile error, though if RTTI saves accessibility modifiers, a vm exception would be more proper (as this is more or less a reflected call). Here's a pastebin with occurances of this in the game code (excuse the typo for the 'in' instead of 'is' in the diagnostics :D)

Details

Severity
None
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce

Make a class with a protected method, and call it in any way but using the function call expression.

Event Timeline

sharp1337 updated the task description. (Show Details)Aug 19 2022, 7:52 PM
sharp1337 changed Category from General to Scripting.Aug 19 2022, 8:18 PM
Geez changed the task status from New to Awaiting internal Testing.Aug 30 2022, 12:52 PM
Geez closed this task as Resolved.Jun 9 2023, 10:57 AM
Geez claimed this task.
Geez added a subscriber: Geez.

Resolved for one of the future updates.