This fixes #32 by adding positronUtil.makeStub(), which makes a "stub function" that warns the first time it's called, and then replacing all function() { /* stub */ } occurrences with functions created by makeStub().
Modules that are themselves stubs call makeStub()() to make a stub function and then immediately call it to output a warning (so we see the warning when the module is first evaluated).
Stub functions that need to return a value pass the return value to makeStub(), which then returns it each time the stub is called (although it still only warns once). Stubs that need to generate a return value (or do something else when the stub is called) pass a function argument for the returnValue property, which the "warn once" function will then call to generate the return value.
This is essentially the same as addUnimplementedNative() from PluotSorbet, except for a project-specific detail (it returns the stub instead of assigning it to a global map of stubs, since there is no such global map in Positron). Plus, let is the new var.
This fixes #32 by adding positronUtil.makeStub(), which makes a "stub function" that warns the first time it's called, and then replacing all
function() { /* stub */ }
occurrences with functions created by makeStub().Modules that are themselves stubs call makeStub()() to make a stub function and then immediately call it to output a warning (so we see the warning when the module is first evaluated).
Stub functions that need to return a value pass the return value to makeStub(), which then returns it each time the stub is called (although it still only warns once). Stubs that need to generate a return value (or do something else when the stub is called) pass a function argument for the returnValue property, which the "warn once" function will then call to generate the return value.
This is essentially the same as addUnimplementedNative() from PluotSorbet, except for a project-specific detail (it returns the stub instead of assigning it to a global map of stubs, since there is no such global map in Positron). Plus, let is the new var.
@marcoscaceres How does this look to you?