Skip to content
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

Investigation: can we deliver wasm meta-data for generating autocompletion #9

Open
veewee opened this issue Apr 15, 2023 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@veewee
Copy link
Owner

veewee commented Apr 15, 2023

See:

/**
 * @property int $one
 * @property int $some
 * @method int get_one()
 * @method int get_some()
 * @method int set_some(int $param)
 */
final class MyInstanceDecorator extends Wasm\WasmInstance {
  public function __construct() {
    parent::__construct(
      <<<'EOWAT'
      (module
        (global $one (export "one") i32 (i32.const 1))
        (global $some (export "some") (mut i32) (i32.const 0))
        (func (export "get_one") (result i32) (global.get $one))
        (func (export "get_some") (result i32) (global.get $some))
        (func (export "set_some") (param i32) (global.set $some (local.get 0))))
      EOWAT
    );
  }
}

❗ Currently decorating the WasmInstance like this throws an exception. This probably needs to be fixed in the rs-php-ext project.

It would be nice if we can provide $instance->getMetaData() that gives us all the raw information to build the @method and @property.
That way, we could build a code-generator that gives us autocompletable and staticly analyzer safe PHP code.

The goal of this issue is solely to provide the meta data. Doing something with it seems more appropriate for doing in a separate PHP-based package.

@veewee veewee added enhancement New feature or request help wanted Extra attention is needed labels Apr 15, 2023
@veewee veewee modified the milestones: 0.1.0, 0.2.0 Apr 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Status: Todo
Development

No branches or pull requests

1 participant