From c351f8fa47aa8d8b10c28a4e74279073d4c95fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kr=C3=BCger?= <45282134+UweKrueger@users.noreply.github.com> Date: Sun, 30 Aug 2020 08:55:31 +0200 Subject: [PATCH] checker, builtin: prepage for builtin channels (#6262) --- vlib/v/builder/compile.v | 2 +- vlib/v/parser/parse_type.v | 3 +++ vlib/v/util/util.v | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/vlib/v/builder/compile.v b/vlib/v/builder/compile.v index d04c885c9e..7eb91a9637 100644 --- a/vlib/v/builder/compile.v +++ b/vlib/v/builder/compile.v @@ -197,7 +197,7 @@ Did you forget to add vlib to the path? (Use @vlib for default vlib)') } pub fn (v &Builder) get_user_files() []string { - if v.pref.path in ['vlib/builtin', 'vlib/strconv', 'vlib/strings', 'vlib/hash'] { + if v.pref.path in ['vlib/builtin', 'vlib/strconv', 'vlib/strings', 'vlib/hash', 'vlib/time'] { // This means we are building a builtin module with `v build-module vlib/strings` etc // get_builtin_files() has already added the files in this module, // do nothing here to avoid duplicate definition errors. diff --git a/vlib/v/parser/parse_type.v b/vlib/v/parser/parse_type.v index 91deee26ec..af4e85ad6b 100644 --- a/vlib/v/parser/parse_type.v +++ b/vlib/v/parser/parse_type.v @@ -53,6 +53,9 @@ pub fn (mut p Parser) parse_map_type() table.Type { pub fn (mut p Parser) parse_chan_type() table.Type { p.next() + if p.tok.kind != .name && p.tok.kind != .key_mut && p.tok.kind != .amp { + return table.chan_type + } elem_type := p.parse_type() idx := p.table.find_or_register_chan(elem_type) return table.new_type(idx) diff --git a/vlib/v/util/util.v b/vlib/v/util/util.v index ee46da5cb2..5735e7bbf2 100644 --- a/vlib/v/util/util.v +++ b/vlib/v/util/util.v @@ -13,7 +13,7 @@ pub const ( // math.bits is needed by strconv.ftoa pub const ( - builtin_module_parts = ['math.bits', 'strconv', 'strconv.ftoa', 'hash', 'strings', 'builtin'] + builtin_module_parts = ['math.bits', 'strconv', 'strconv.ftoa', 'hash', 'strings', 'time', 'builtin'] ) pub const (