From 8edec9b3596e1c7cb5db551b6da0e3ba1c90bb5e Mon Sep 17 00:00:00 2001 From: Piotr Fusik Date: Fri, 16 Feb 2024 19:21:52 +0100 Subject: [PATCH] [json] Python type annotation. Fixes host-diff #140 --- GenPy.fu | 5 ++++- libfut.cpp | 3 +++ libfut.cs | 3 +++ libfut.js | 3 +++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/GenPy.fu b/GenPy.fu index 35f09c34..7f1c05dc 100644 --- a/GenPy.fu +++ b/GenPy.fu @@ -1,6 +1,6 @@ // GenPy.fu - Python code generator // -// Copyright (C) 2020-2023 Piotr Fusik +// Copyright (C) 2020-2024 Piotr Fusik // // This file is part of Fusion Transpiler, // see https://github.com/fusionlanguage/fut @@ -340,6 +340,9 @@ public class GenPy : GenPySwift Include("re"); Write("re.Match"); break; + case FuId.JsonElementClass: + Write("dict | list | str | float | bool | None"); + break; case FuId.LockClass: Include("threading"); Write("threading.RLock"); diff --git a/libfut.cpp b/libfut.cpp index 44c4294a..d1d7bb84 100644 --- a/libfut.cpp +++ b/libfut.cpp @@ -22464,6 +22464,9 @@ void GenPy::writeTypeAnnotation(const FuType * type, bool nullable) include("re"); write("re.Match"); break; + case FuId::jsonElementClass: + write("dict | list | str | float | bool | None"); + break; case FuId::lockClass: include("threading"); write("threading.RLock"); diff --git a/libfut.cs b/libfut.cs index 05feb18d..5a3e05ec 100644 --- a/libfut.cs +++ b/libfut.cs @@ -23323,6 +23323,9 @@ void WriteTypeAnnotation(FuType type, bool nullable = false) Include("re"); Write("re.Match"); break; + case FuId.JsonElementClass: + Write("dict | list | str | float | bool | None"); + break; case FuId.LockClass: Include("threading"); Write("threading.RLock"); diff --git a/libfut.js b/libfut.js index 2772e101..c259ebbc 100644 --- a/libfut.js +++ b/libfut.js @@ -23900,6 +23900,9 @@ export class GenPy extends GenPySwift this.include("re"); this.write("re.Match"); break; + case FuId.JSON_ELEMENT_CLASS: + this.write("dict | list | str | float | bool | None"); + break; case FuId.LOCK_CLASS: this.include("threading"); this.write("threading.RLock");