feat(vast/ast): 新增 extern 软关键字声明 FFI 函数(等价 t.State)

TPC 侧 vast:
- extern [def] A(...) [-> T] [: pass] 四种语法解析为 FunctionDef
- 返回注解改写为 <原类型> | t.State,复用 TPC 的 IsState 外部函数路径
- 设 Extern 标记,Unparser 还原 extern 语法(round-trip 一致)

TPV 侧 includes/ast(自举前端):
- Keyword.Extern 枚举与 intern,_is_funcdef_kw 软判定
  (extern def / extern Name+'( 或 '[')
- _parse_funcdef 支持无冒号声明、FLAG_IS_EXTERN 标记、
  returns 改写为 <原类型> | t.State(vpi 含 State → 定义端裸名 + 不生成函数体)
This commit is contained in:
TermiNexus committed 2026-08-17 10:41:44 +08:00
1 parent aa9042173e
commit ce568e10b7
6 files changed
+114 -12

No files matched your search

+1
View File
@@ -154,6 +154,7 @@ CONST_CHAR: t.CDefine = 6
FLAG_IS_ASYNC: t.CDefine = 1
FLAG_SIMPLE: t.CDefine = 2
FLAG_HAS_STAR: t.CDefine = 4
FLAG_IS_EXTERN: t.CDefine = 8
# ============================================================