checker: remove unnecessary "no methods" error; builder: skip float.c.v with -nofloat

pull/11489/head
Alexander Medvednikov 2021-09-13 18:14:26 +03:00
parent 2ced845e30
commit cfcc57f5d3
3 changed files with 8 additions and 1 deletions

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by an MIT license that can be found in the LICENSE file.
module builtin
// TODO implement compile time conditional include
// [if !nofloat]
import strconv
#include <float.h>

View File

@ -2144,7 +2144,9 @@ pub fn (mut c Checker) method_call(mut node ast.CallExpr) ast.Type {
}
}
if left_type == ast.void_type {
c.error('`void` type has no methods', node.left.position())
// No need to print this error, since this means that the variable is unknown,
// and there already was an error before.
// c.error('`void` type has no methods', node.left.position())
return ast.void_type
}
mut has_generic := false // x.foo<T>() instead of x.foo<int>()

View File

@ -30,6 +30,9 @@ pub fn (prefs &Preferences) should_compile_filtered_files(dir string, files_ []s
if file.starts_with('.#') {
continue
}
if prefs.nofloat && file.ends_with('float.c.v') {
continue
}
if file.contains('_d_') {
if prefs.compile_defines_all.len == 0 {
continue