From 2293f712972708a08f9b800bc8a50dd3909d2fb2 Mon Sep 17 00:00:00 2001 From: Dag Brattli Date: Tue, 28 Nov 2023 22:41:53 +0100 Subject: [PATCH] Move code to replacements --- src/Fable.Transforms/Python/Fable2Python.fs | 27 --------------------- src/Fable.Transforms/Python/Replacements.fs | 4 ++- 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/src/Fable.Transforms/Python/Fable2Python.fs b/src/Fable.Transforms/Python/Fable2Python.fs index d46e9667e5..219556fa03 100644 --- a/src/Fable.Transforms/Python/Fable2Python.fs +++ b/src/Fable.Transforms/Python/Fable2Python.fs @@ -3959,14 +3959,6 @@ module Util = _, _range) -> transformAsArray com ctx expr info - | Fable.Call(Fable.Get(expr, Fable.FieldGet { Name = name }, _, _), - _info, - _, - _range) when name.ToLower() = "tostring" -> - let func = Expression.name "str" - let left, stmts = com.TransformAsExpr(ctx, expr) - Expression.call (func, [ left ]), stmts - | Fable.Call(Fable.Get(expr, Fable.FieldGet { Name = "Equals" }, _, _), { Args = [ arg ] }, _, @@ -3975,25 +3967,6 @@ module Util = let left, stmts' = com.TransformAsExpr(ctx, expr) Expression.compare (left, [ Eq ], [ right ]), stmts @ stmts' - | Fable.Call(Fable.Get(expr, Fable.FieldGet { Name = "split" }, _, _), - { Args = [ Fable.Value(kind = Fable.StringConstant "") ] }, - _, - _range) -> - let func = Expression.name "list" - let value, stmts = com.TransformAsExpr(ctx, expr) - Expression.call (func, [ value ]), stmts - - | Fable.Call(Fable.Get(expr, - Fable.FieldGet { Name = "charCodeAt" }, - _, - _), - _info, - _, - _range) -> - let func = Expression.name "ord" - let value, stmts = com.TransformAsExpr(ctx, expr) - Expression.call (func, [ value ]), stmts - | Fable.Call(callee, info, _, range) -> transformCall com ctx range callee info diff --git a/src/Fable.Transforms/Python/Replacements.fs b/src/Fable.Transforms/Python/Replacements.fs index e5ec9aea43..964465437e 100644 --- a/src/Fable.Transforms/Python/Replacements.fs +++ b/src/Fable.Transforms/Python/Replacements.fs @@ -648,7 +648,9 @@ let toList com returnType expr = Helper.LibCall(com, "list", "ofSeq", returnType, [ expr ]) let stringToCharArray t e = - Helper.InstanceCall(e, "split", t, [ makeStrConst "" ]) + //Helper.InstanceCall(e, "split", t, [ makeStrConst "" ]) + // Write as global call `list` instead + Helper.GlobalCall("list", t, [ e ]) let toSeq t (e: Expr) = match e.Type with