go - 在编译时检查 go 表达式的可用性

标签 go

我正在为 Go 编写一个(业余)编译器。

现在为了优化我想知道:有没有办法检查 ast.Expr 中的数据是否可以在编译时访问?

我知道我可以解析为 ast.*Lit

最佳答案

目标代码是编译过程的结果。

In a general sense object code is a sequence of statements or instructions in a computer language, usually a machine code language (i.e., binary).

在编译完成之前,什么都不能访问。

关于go - 在编译时检查 go 表达式的可用性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42782735/

相关文章:

go - 实例新类型(Golang)

go - 数字常量的打印类型导致溢出

go build 错误 .go/src for go/src 在寻找依赖

validation - 如何验证字符串 slice

checkbox - 在 golang 中检查复选框的惯用方式

go - 使用 os.Getenv 在 golang 中声明常量导致 'const initializer in os.Getenv("MY_SECRET") 不是常量'

multithreading - Go 如何处理 Google App Engine 上的并发请求

nginx - 从 nginx 提供 golang 脚本

http - 如何在 Go 中禁用 http 警报

go - 结构初始化:p.U文字中的值太少还是p.U文字中未导出字段'c'的隐式赋值?