feat: add method call support and analyzeFull

- Add analyzeFull() to return Sema context with method table
- Improve method call desugaring: obj.method() → Type_method(obj)
- Search methodTable by method name when type inference fails
- Add methods.bux example demonstrating struct with extend blocks
- Use analyzeFull in cli.nim for proper method resolution
This commit is contained in:
2026-05-30 23:22:33 +03:00
parent 52608d5601
commit b59e852330
5 changed files with 61 additions and 12 deletions
+8
View File
@@ -573,3 +573,11 @@ proc analyze*(modu: Module): SemaResult =
sema.collectGlobals()
sema.checkBodies()
result = SemaResult(diagnostics: sema.diagnostics)
proc analyzeFull*(modu: Module): tuple[result: SemaResult, sema: Sema] =
## Analyze module and return both result and full Sema context
## Use this when you need the Sema for lowering (method table, etc.)
var sema = Sema(module: modu, globalScope: newScope())
sema.collectGlobals()
sema.checkBodies()
result = (SemaResult(diagnostics: sema.diagnostics), sema)