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

fix v2 parser int.v error

This commit is contained in:
Alexander Medvednikov 2020-03-01 14:57:54 +01:00
parent d7a8b1b4f2
commit 82b0024758
3 changed files with 20 additions and 5 deletions

View File

@ -156,14 +156,18 @@ pub fn (n int) hex() string {
pub fn (n i64) hex() string {
len := if n >= 0 { n.str().len + 3 } else { 19 }
hex := malloc(len)
count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
// TODO
//count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
count := C.sprintf(charptr(hex), '0x%llx', n)
return tos(hex, count)
}
pub fn (n u64) hex() string {
len := if n > 0 { n.str().len + 3 } else { 19 }
hex := malloc(len)
count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
//count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
count := C.sprintf(charptr(hex), '0x%llx', n)
//count := C.sprintf(charptr(hex), '0x%lx', n)
return tos(hex, count)
}

View File

@ -11,7 +11,8 @@ import (
pub type Expr = InfixExpr | IfExpr | StringLiteral | IntegerLiteral | CharLiteral |
FloatLiteral | Ident | CallExpr | BoolLiteral | StructInit | ArrayInit | SelectorExpr | PostfixExpr |
AssignExpr | PrefixExpr | MethodCallExpr | IndexExpr | RangeExpr | MatchExpr |
CastExpr | EnumVal | Assoc | SizeOf | None | MapInit | IfGuardExpr | ParExpr | OrExpr
CastExpr | EnumVal | Assoc | SizeOf | None | MapInit | IfGuardExpr | ParExpr | OrExpr |
ConcatExpr
pub type Stmt = VarDecl | GlobalDecl | FnDecl | Return | Module | Import | ExprStmt |
ForStmt | StructDecl | ForCStmt | ForInStmt | CompIf | ConstDecl | Attr | BranchStmt |
@ -535,6 +536,11 @@ pub:
text string
}
pub struct ConcatExpr {
pub:
vals []Expr
}
pub struct None {
pub:
foo int // todo

View File

@ -439,11 +439,16 @@ fn (c mut Checker) stmt(node ast.Stmt) {
it.typ = typ
}
else {
println('checker.stmt(): unhandled node')
}
/*
println('1')
node_name := typeof(node)
if !(node_name) in c.unhandled_stmts {
println('2')
if !(node_name in c.unhandled_stmts) {
c.unhandled_stmts << node_name
}
}
*/
}
}