From e82a4bb1c444f8edd7ccc5e25822aa0db5234fde Mon Sep 17 00:00:00 2001 From: mappu Date: Thu, 9 Apr 2020 19:55:03 +1200 Subject: [PATCH] doc: update README status --- README.md | 62 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index ce90742..f74fd48 100644 --- a/README.md +++ b/README.md @@ -6,31 +6,21 @@ The goal is to produce idiomatic, maintainable Go code as part of a one-off conv ## Progress +### Phase 1 + [X] Convert some small programs [X] Error handling - [X] All functions return `(type, error)` - [X] Convert `throw` to err return - - [ ] Elide error return for functions that cannot throw - - ?? Could be a standalone Go refactoring tool - [X] Non-leaf function calls need to check + bubble errors - - [ ] Behaviour of function calls in rvalue cases where err cannot be checked -[ ] Comprehensive coverage of all AST node types - - [ ] Node - - [ ] Stmt - - [ ] Expr - - [X] Binary - - [ ] Scalar - - [ ] Heredocs/nowdocs [X] Array handling - [X] Infer whether to use slice/map for PHP array - - [ ] Infer whether map use should be order-preserving [ ] Multi-file programs - [ ] Include/Require -[X] Namespaces +[-] Namespaces - [X] Basic support for `namespace` -> package name transformation - - [ ] Namespace resolution in calls - - [ ] `use` - - [ ] Support scoped namespace (`namespace { ... }`) and multiple namespaces in file + - [ ] Resolve namespace names in calls + - [ ] Resolve `use` statements [ ] Generators [ ] Numbered break/continue [ ] Goto @@ -46,16 +36,16 @@ The goal is to produce idiomatic, maintainable Go code as part of a one-off conv - [ ] `finally` - Runs before any return statement inside the try block or catch block; also runs after the try block is complete - Maybe `finally` would be more concisely implemented as defer inside an IIFE, but that is not idiomatic, maintainable Go code -[ ] Abandon upon sight of `eval` / `extract` / ... -[ ] Assignment expressions +[ ] Abandon upon sight of `eval` / `extract` / variable-variables ... +[X] Detect assignment expressions - Go doesn't support assignment in rvalues, only as a statement - When walking below stmt level, need to first fully walk and check for any function calls + assignments that may need hoisting (and we can probably only do that correctly if there is no short-circuiting) - [X] Add subtree walk + catch error for this case - - [ ] Add hoisting pass [ ] Closures - [ ] Handle value/reference captures [X] Convert top-level calls to `init()`/`main()` - - *Currently always `init`* + - [X] Wrap in function + - [X] Determine init/main based on package name [ ] Class/object transformations - [X] Convert `new X` constructor calls to `NewX` - [X] Visibility @@ -73,13 +63,37 @@ The goal is to produce idiomatic, maintainable Go code as part of a one-off conv - [ ] static:: - [ ] Traits / `use` - [ ] Abstract methods +[X] Track golang package imports +[X] Variadic function parameters +[X] Preserve comments + +### Productionize + +[ ] Infer whether to declare variable (`var` / `:=`) or reuse (`=`) + - [ ] Track current visibility scope +[ ] Comprehensive coverage of all AST node types + - [ ] Node + - [ ] Stmt + - [ ] Expr + - [X] Binary + - [ ] Scalar + - [ ] Heredocs/nowdocs [ ] Type inference - [ ] Type declarations for literals (string, slice/map with constant initializer, etc) - [ ] Convert known PHP typenames to Go equivalents - [ ] Parse extra types from phpdoc blocks -[ ] Infer whether to declare variable (`var` / `:=`) or reuse (`=`) - - [ ] Track current visibility scope -[ ] Library/environment transformations +[ ] Hoisting pass for rvalue expressions + - [ ] Behaviour of function calls in rvalue cases where err cannot be checked + - [ ] Assignment expressions +[ ] Simple standard library transformations + - [ ] string/array functions + - [ ] uasort -> sort.Slice +[ ] Elide error return for functions that cannot throw + - ?? Could be a standalone Go refactoring tool + +### Wishlist + +[ ] Extended library/environment transformations - [ ] Standard library transformations - [X] Track golang package imports - [ ] Handle conflicts between golang stdlib packages / local variable names @@ -94,9 +108,9 @@ The goal is to produce idiomatic, maintainable Go code as part of a one-off conv - [ ] AWS SDK - [ ] PHPUnit -> Go Test - [ ] Replace Composer/PSR-4 autoloading with Go imports -[X] Variadic function parameters -[X] Preserve comments [ ] Preserve rough line spacing +[ ] Somehow detect whether map use should be order-preserving +[ ] Support scoped namespace (`namespace { ... }`) and multiple namespaces in file [ ] Convert wordpress / mediawiki / symfony - [ ] Option to convert with preset=cli, preset=web, webroot path - [ ] Option to generate built-in web server