Skip to content

Commit

Permalink
final change
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Dec 7, 2023
1 parent 6338888 commit 92aecfb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/rivet/src/ast/Scope.ri
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub struct Scope {

pub func add_or_get(mut self, sym: Sym) -> !Sym {
if old_sym := self.find(sym.name) {
if sym is TypeSym as type_sym and old_sym is TypeSym as mut old_type_sym {
if sym is TypeSym(type_sym) and old_sym is TypeSym(mut old_type_sym) {
if old_type_sym.update(type_sym)! {
return old_sym;
}
Expand Down Expand Up @@ -117,23 +117,23 @@ pub struct Scope {

pub func update_type(self, name: string, type: Type) {
if sym := self.lookup(name) {
if sym is Var as var_info {
if sym is Var(var_info) {
var_info.type = type;
}
}
}

pub func update_is_hidden_ref(self, name: string, is_hidden_ref: bool) {
if sym := self.lookup(name) {
if sym is Var as var_info {
if sym is Var(var_info) {
var_info.is_hidden_ref = is_hidden_ref;
}
}
}

pub func update_is_used(self, name: string, is_used: bool) {
if sym := self.lookup(name) {
if sym is Var as var_info {
if sym is Var(var_info) {
var_info.is_used = is_used;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rivet/src/ast/Sym.ri
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub trait Sym {
func module(self) -> ?Module {
mut p := self;
while {
if p is Module as mod {
if p is Module(mod) {
return mod;
} else if p_ := p.parent {
p = p_;
Expand Down
4 changes: 2 additions & 2 deletions lib/rivet/src/ast/TypeSym.ri
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ pub struct TypeSym < Sym {

#[inline]
pub func find_func(self, name: string) -> ?Func {
return if sym := self.scope.find(name); sym is Func as func_ {
return if sym := self.scope.find(name); sym is Func(func_) {
if self.info !is .Trait and !func_.has_body {
return none;
}
func_
} else if sym := self.find_in_base(name); sym is Func as func_ {
} else if sym := self.find_in_base(name); sym is Func(func_) {
if self.info !is .Trait and !func_.has_body {
return none;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/valid/src/traits.ri
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@ struct IntegerStruct {

test "traits with `default_value` attribute" {
is_ := IntegerStruct();
@assert(is_.i is IntegerValue as int_v and int_v.int == 5);
@assert(is_.i is IntegerValue(int_v) and int_v.int == 5);
}

0 comments on commit 92aecfb

Please sign in to comment.