WIP name gather, add fields for struct nodes.

# Conflicts:
#	src/name_analysis/gather.rs
This commit is contained in:
Jesse Brault 2025-10-08 17:23:56 -05:00
parent 6d37545b35
commit 5d41a22899
3 changed files with 62 additions and 18 deletions

View File

@ -228,6 +228,9 @@ fn gather_node(
AstNodeRef::IfElse(_) => {}
AstNodeRef::WhileStatement(_) => {}
AstNodeRef::ForStatement(_) => {}
AstNodeRef::LValue(_) => {},
AstNodeRef::LValueSuffix(_) => {},
AstNodeRef::VariableUse(_) => {},
AstNodeRef::Expression(_) => {}
AstNodeRef::TernaryExpression(_) => {}
AstNodeRef::TernaryRhs(_) => {}

View File

@ -1,16 +1,16 @@
# $schema: ./ast.schema.yaml
# Operators
Operator:
struct:
struct:
children:
- inner:
member:
member:
rule: OperatorInner
- file_id:
special:
special:
kind: file_id
- range:
special:
special:
kind: range
OperatorInner:
leaf_enum:
@ -442,24 +442,24 @@ PlatformFunction:
- parameters
- return_type
PlatformOperatorFunction:
struct:
struct:
children:
- is_public:
member:
member:
rule: Pub
build:
boolean:
build:
boolean:
on: rule_present
- platform_kw:
skip:
skip:
rule: Platform
- op_kw:
skip:
rule: Op
- generics:
member:
member:
rule: GenericParameters
build:
build:
node:
or_else_default: true
- operator
@ -628,12 +628,8 @@ VariableDeclaration:
AssignmentStatement:
struct:
children:
- left:
member:
rule: Expression
- right:
member:
rule: Expression
- l_value
- expression
ExpressionStatement:
struct:
children:
@ -715,6 +711,26 @@ ForStatement:
skip:
rule: End
# LValue
LValue:
struct:
children:
- variable_use
- suffixes:
vec:
rule: LValueSuffix
LValueSuffix:
tree_enum:
rules:
- ObjectProperty
- ObjectIndex
# VariableUse
VariableUse:
struct:
children:
- identifier
# Expressions
Expression:
polymorphic_type:
@ -749,6 +765,9 @@ Expression:
- Literal:
inner:
kind: Literal
- VariableUse:
inner:
kind: VariableUse
- Fqn:
inner:
kind: FullyQualifiedName
@ -1091,6 +1110,9 @@ PrimaryExpression:
- Literal:
inner:
kind: Literal
- VariableUse:
inner:
kind: VariableUse
- Fqn:
inner:
kind: FullyQualifiedName

View File

@ -542,7 +542,7 @@ VariableDeclaration = {
}
AssignmentStatement = {
Expression
LValue
~ "="
~ Expression
}
@ -593,6 +593,24 @@ ForStatement = {
~ End
}
// LValue
LValue = {
VariableUse
~ LValueSuffix*
}
LValueSuffix = {
ObjectProperty
| ObjectIndex
}
// Variable Use
VariableUse = {
Identifier
}
// Expressions
Expression = {
@ -741,6 +759,7 @@ ObjectIndex = {
PrimaryExpression = {
Literal
| VariableUse
| FullyQualifiedName
| Closure
| ListExpression