mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-18 11:33:59 +00:00
cgo: implement the constant parser as a real parser
Previously it was just a combination of heuristics to try to fit a
constant in an *ast.BasicLit. For more complex expressions, this is not
enough.
This change also introduces proper syntax error with locations, if
parsing a constant failed. For example, this will print a real error
message with source location:
#define FOO 5)
This commit is contained in:
committed by
Ron Evans
parent
5987233b99
commit
cadb75a4aa
+1
-1
@@ -42,7 +42,7 @@ type cgoPackage struct {
|
||||
// constantInfo stores some information about a CGo constant found by libclang
|
||||
// and declared in the Go AST.
|
||||
type constantInfo struct {
|
||||
expr *ast.BasicLit
|
||||
expr ast.Expr
|
||||
pos token.Pos
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user