Skip to content

[FEATURE] Import Scripted Classes #194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: experiment/static-fields
Choose a base branch
from

Conversation

lemz1
Copy link

@lemz1 lemz1 commented Feb 22, 2025

DESCRIPTION

This pr adds the ability to import scripted classes like you would do in regular haxe, meaning:

package my.mod.game;

import game.ScriptedGame;
import my.mod.objects.ModdedPlayer;

class ModdedGame extends ScriptedGame {
  public function new() {
    var player = new ModdedPlayer();
  }
}

EXPLANATION

We create another imports variable to the PolymodClassDeclEx, because a script might import a class that hasn't been registered yet.
After all classes have been registered and parsed, we validate the imports. If the import still can't be found we give the user an error.

@lemz1 lemz1 force-pushed the feature/import-scripted-class branch 3 times, most recently from 3eacb74 to 8cee453 Compare February 22, 2025 11:25
Copy link

@AbnormalPoof AbnormalPoof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please

@cyn0x8
Copy link

cyn0x8 commented Mar 3, 2025

will #201 replace this? or is it a separate thing
i see "ability to extend scripted classes" but idk if this implies the ability to import or not

@lemz1
Copy link
Author

lemz1 commented Mar 3, 2025

will #201 replace this? or is it a separate thing i see "ability to extend scripted classes" but idk if this implies the ability to import or not

#201 does implement importing scripted classes. So i guess #201 would also replace this pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants