Skip to content

Language: Class methods and property access in JIT #58

@PurHur

Description

@PurHur

Problem

Classes can be declared (properties only in class body—see lib/Compiler.php compileClassBody). VM supports new, property fetch; JIT throws Other class body types are not jittable for now for methods.

Goal

Simple OOP for web apps: controller classes with methods, $this->prop.

Tasks

  • JIT: TYPE_METHOD_CALL, constructor, $this handling
  • Align with lib/JIT/Builtin/Type/Object_.php
  • No inheritance in v1 (matches assert(null === $class->extends))
  • PHPT: class with method returning string
  • Optional: public function visibility only

Acceptance criteria

class Page { public function render(): string { return '<p>ok</p>'; } }
echo (new Page())->render();

in JIT mode.

Files

  • lib/VM.php, lib/JIT.php, lib/JIT/Builtin/Type/Object_.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions