You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of #42
- fix: visit return types in function declarations
- fix: add `type` reference flags to returned identifiers
- fix: return types are in same scope as the rest of the function's
prototype
- fix: simple function prototype nodes not being visited
Record where symbols are referenced and how they are used.
Create a
Reference
struct and store it in theSymbolTable
. It should include the following fieldsnode_id
: theAst.Node.Index
of the AST node making the reference. Note that.identifier
does not have its own AST node.token_id
: theTokenIndex
of the.identifier
token.symbol_id
: The symbol being referenced.null
if it could not be resolved.flags
:ReferenceFlags
describing how it's being used. This is a packed struct (i.e. a struct only containing bitflags) with these fields:read
: symbol's value is being read. Also set for LHS offield_access
nodes.write
: symbol's value is being modified.call
: symbol is being called.type
: symbol is used in a type alias (const Foo = std.ArrayList(Bar)
), function signature, or type annotation.Acceptance Criteria
SoA
withinSymbolTable
SemanticBuilder
. Each time it exits a scope, it should attempt to resolve references.Reference flags edge cases:
var x = 1; x += 1
,x
is both.read
and.write
foo.bar()
,foo
is only.read
, whilebar
is.call
TODO
.type
flag to type references.alias
reference flagsnull
,undefined
, builtin types, and builtin functions?.member
reference flags. I don't think field accesses are bound correctly yet.The text was updated successfully, but these errors were encountered: