aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorDaniel Gavin <danielgavin5@hotmail.com>2022-03-04 19:22:33 +0100
committerDaniel Gavin <danielgavin5@hotmail.com>2022-03-04 19:22:33 +0100
commit2d9f5709d74992e0cd485099a5a8cdf12178e80d (patch)
treeaebd707471ee0d6a62334bfd69f5681299f692cb /src/common
parent75ab88b2c81c164b851c4e064f4da1c11b2a5679 (diff)
Add support for builtin symbols.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/ast.odin10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/common/ast.odin b/src/common/ast.odin
index 669b44a..7a32cde 100644
--- a/src/common/ast.odin
+++ b/src/common/ast.odin
@@ -73,9 +73,9 @@ GlobalExpr :: struct {
deprecated: bool,
file_private: bool,
package_private: bool,
+ builtin: bool,
}
-
unwrap_pointer :: proc(expr: ^ast.Expr) -> (ast.Ident, bool) {
expr := expr
for expr != nil {
@@ -99,10 +99,10 @@ unwrap_pointer :: proc(expr: ^ast.Expr) -> (ast.Ident, bool) {
collect_value_decl :: proc(exprs: ^[dynamic]GlobalExpr, file: ast.File, stmt: ^ast.Node, skip_private: bool) {
if value_decl, ok := stmt.derived.(^ast.Value_Decl); ok {
-
is_deprecated := false
is_private_file := false
is_package_file := false
+ is_builtin := false
for attribute in value_decl.attributes {
for elem in attribute.elems {
@@ -118,14 +118,14 @@ collect_value_decl :: proc(exprs: ^[dynamic]GlobalExpr, file: ast.File, stmt: ^a
is_package_file = true
}
}
- case "deprecated":
- is_deprecated = true
}
}
} else if ident, ok := elem.derived.(^ast.Ident); ok {
switch ident.name {
case "deprecated":
is_deprecated = true
+ case "builtin":
+ is_builtin = true
}
}
}
@@ -146,6 +146,7 @@ collect_value_decl :: proc(exprs: ^[dynamic]GlobalExpr, file: ast.File, stmt: ^a
docs = value_decl.docs,
attributes = value_decl.attributes[:],
deprecated = is_deprecated,
+ builtin = is_builtin,
})
} else {
if len(value_decl.values) > i {
@@ -156,6 +157,7 @@ collect_value_decl :: proc(exprs: ^[dynamic]GlobalExpr, file: ast.File, stmt: ^a
docs = value_decl.docs,
attributes = value_decl.attributes[:],
deprecated = is_deprecated,
+ builtin = is_builtin,
})
}
}