1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

parser: $if blocks for headers

This commit is contained in:
Alexander Medvednikov 2020-03-19 07:59:01 +01:00
parent f798a0937a
commit 3dc3b11435
3 changed files with 8 additions and 3 deletions

View File

@ -4,8 +4,7 @@ import os
#include <sys/ioctl.h>
$if solaris
{
$if solaris {
#include <unistd.h> // ioctl
#include <sys/termios.h> // TIOCGWINSZ
}

View File

@ -614,7 +614,7 @@ fn (g mut Gen) expr(node ast.Expr) {
}
}
ast.Assoc {
g.write('/* assoc */')
g.assoc(it)
}
ast.BoolLiteral {
g.write(it.val.str())
@ -1348,6 +1348,9 @@ fn (g mut Gen) const_decl(node ast.ConstDecl) {
}
}
// { user | name: 'new name' }
fn (g mut Gen) assoc(node ast.Assoc) {}
fn (g mut Gen) call_args(args []ast.CallArg) {
for i, arg in args {
if table.type_is_variadic(arg.expected_type) {

View File

@ -370,6 +370,9 @@ pub fn (p mut Parser) stmt() ast.Stmt {
stmts: stmts
}
}
.hash {
return p.hash()
}
.key_defer {
p.next()
stmts := p.parse_block()