aboutsummaryrefslogtreecommitdiffhomepage
path: root/cgo/cgo.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2019-11-04 16:30:57 +0100
committerRon Evans <[email protected]>2019-11-05 14:18:38 +0100
commitcadb75a4aa1cdf9a447842013e5616c2b2e4b894 (patch)
tree1f66cfc66ae98f77716b587cd15ef7d2f6e72f52 /cgo/cgo.go
parent5987233b99c7b78f28a358ddf98f74853c27635b (diff)
downloadtinygo-cadb75a4aa1cdf9a447842013e5616c2b2e4b894.tar.gz
tinygo-cadb75a4aa1cdf9a447842013e5616c2b2e4b894.zip
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)
Diffstat (limited to 'cgo/cgo.go')
-rw-r--r--cgo/cgo.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/cgo/cgo.go b/cgo/cgo.go
index d42034c1a..9867b875e 100644
--- a/cgo/cgo.go
+++ b/cgo/cgo.go
@@ -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
}