Skip to content

Commit

Permalink
sema: catch ignore operatored sub ident expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Mar 5, 2024
1 parent 044cddf commit df65090
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 6 additions & 0 deletions std/jule/sema/eval.jule
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ use lex for std::jule::lex::{
is_bool,
is_rune,
is_raw_str,
is_ignore_ident,
}
use types for std::jule::types
use strings for std::strings
Expand Down Expand Up @@ -2964,6 +2965,11 @@ impl Eval {
}

fn eval_obj_sub_ident(mut self, mut d: &Data, mut si: &SubIdentExpr): &Data {
if is_ignore_ident(si.ident.kind) {
self.push_err(si.ident, LogMsg.InvalidSyntax)
ret nil
}

let mut kind = d.kind
if d.kind.ptr() != nil {
let ptr = d.kind.ptr()
Expand Down
3 changes: 0 additions & 3 deletions std/jule/sema/sema.jule
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ fn is_valid_model_for_ref(mut &m: ExprModel): bool {
match type m {
| &Var:
ret true

| &StructSubIdentExprModel:
let mut model = (&StructSubIdentExprModel)(m)
ret is_valid_model_for_ref(model.expr)

| &TraitSubIdentExprModel:
let mut model = (&TraitSubIdentExprModel)(m)
ret is_valid_model_for_ref(model.expr)

| &UnaryExprModel:
let mut unary = (&UnaryExprModel)(m)
if unary.op.kind != TokenKind.Star {
Expand Down

0 comments on commit df65090

Please sign in to comment.