From 4c95e59d5cd28db5a0ad0ea453d2bbab42ee9cc8 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 21 Feb 2020 18:13:34 +0100 Subject: [PATCH] fmt, doc: &; update 0.2 roadmap --- 0.2_roadmap.txt | 13 +++++-------- vlib/v/ast/str.v | 7 +++++++ vlib/v/fmt/tests/simple_expected.vv | 6 ++++++ vlib/v/fmt/tests/simple_input.vv | 4 ++++ vlib/v/table/atype_symbols.v | 8 ++++++++ 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/0.2_roadmap.txt b/0.2_roadmap.txt index 3ead88262a..058e358852 100644 --- a/0.2_roadmap.txt +++ b/0.2_roadmap.txt @@ -21,20 +21,14 @@ + wrap up orm + bring back vweb + fix vorum, migrate to orm -- wrap up memory management -- remove all compiler memory leaks + fix child function calls + enable vfmt + bring back vdoc and regenerate all module docs + optimize the parser -- chat.vlang.io -- doom.v + v ui -- ui/orm demo: a simple gui client for postgres/mysql/sqlite + ui demo: calculator -- declarative ui with hot reload (similar to swiftui) ++ declarative ui with hot reload (similar to swiftui) + "building a simple blog with vweb" tutorial + -- youtube video + fix interfaces + fast.vlang.io + bare metal support @@ -42,7 +36,10 @@ + x64 machine code generation (ELF) + require explicit C.fn definitions, add all missing definitions + string.index() ?int -- new AST based parser ++ new AST based parser +- wrap up memory management +- remove all compiler memory leaks +- doom.v diff --git a/vlib/v/ast/str.v b/vlib/v/ast/str.v index 1acbcb0531..b6756ac628 100644 --- a/vlib/v/ast/str.v +++ b/vlib/v/ast/str.v @@ -1,4 +1,11 @@ +// Copyright (c) 2019-2020 Alexander Medvednikov. All rights reserved. +// Use of this source code is governed by an MIT license +// that can be found in the LICENSE file. module ast +/* +These methods are used only by vfmt, vdoc, and for debugging. +*/ + import ( v.table diff --git a/vlib/v/fmt/tests/simple_expected.vv b/vlib/v/fmt/tests/simple_expected.vv index 1d592ea307..df17c630a3 100644 --- a/vlib/v/fmt/tests/simple_expected.vv +++ b/vlib/v/fmt/tests/simple_expected.vv @@ -73,3 +73,9 @@ fn (this User) fn_with_receiver() { fn get_user() ?User { return none } + +fn get_user_ptr() &User { + return &User{ + + } +} diff --git a/vlib/v/fmt/tests/simple_input.vv b/vlib/v/fmt/tests/simple_input.vv index f286bf9bdd..3f9dd1c918 100644 --- a/vlib/v/fmt/tests/simple_input.vv +++ b/vlib/v/fmt/tests/simple_input.vv @@ -77,3 +77,7 @@ println('') fn get_user() ? User { return none } + +fn get_user_ptr() & User { + return &User{} +} diff --git a/vlib/v/table/atype_symbols.v b/vlib/v/table/atype_symbols.v index 330a9978ee..4a91298c97 100644 --- a/vlib/v/table/atype_symbols.v +++ b/vlib/v/table/atype_symbols.v @@ -3,6 +3,10 @@ // that can be found in the LICENSE file. module table +import ( + strings +) + pub type TypeInfo = Array | ArrayFixed | Map | Struct | MultiReturn | Alias @@ -399,5 +403,9 @@ pub fn (table &Table) type_to_str(t Type) string { if type_is_optional(t) { res = '?' + res } + nr_muls := type_nr_muls(t) + if nr_muls > 0 { + res = strings.repeat(`&`, nr_muls) + res + } return res }