Repository navigation
Wildcard import support - #35
Conversation
`-D hscriptNoWildcardImports` btw
ff999af to
bca3637
Compare
Jamextreme140
left a comment
There was a problem hiding this comment.
Man, I was thinking about making this possible. Thanks for the contribution :3
np :3 |
| function exprImportWildcard(pkg):Void { | ||
| final types = TypeListRegistry.get(pkg); | ||
|
|
||
| if(types == null) { |
There was a problem hiding this comment.
This pull request has already been merged, but I have noticed that importFailedCallback is not used here (or anywhere in the pull request), the variable does use only 2 parameters being Array<String>, Null<String>, so it could be changed to include an isWildCard:Bool parameter so that it could fit here (or just make another callback though that's a bit much).
Adding the resolver here would allow for wildcard scripted packages, and making it more consistent with what you'd expect importFailedCallback to do.
This is all really just my thoughts and opinions, as someone who has been messing around with hscript for the last 2 years, so take what I say with a grain of salt.
There was a problem hiding this comment.
This PR (as the name suggests) adds wildcard import support. :3
I've added a public variable called

allowWildcardImportsto theInterpclass (omitted when compiled with-D hscriptNoWildcardImports). When this variable isfalse, wildcard import support is disabled for that interp instance, and when used, results in the following error:Important
This was tested using both hscript-improved built-in unit tests & nightly cne.
Wildcard import:
Result:

Wildcard import on a package that doesn't exist:
Result:

ason wildcard import:Result:

With
-D hscriptNoWildcardImports, interpreter-based support for wildcard imports is omitted from the build entirely.Attempting to use wildcard imports on a build created with

-D hscriptNoWildcardImportswill result in this error: