Skip to content

Commit

Permalink
sema, compiler: minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Jan 15, 2025
1 parent 4eb7690 commit c20ae7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/julec/obj/cxx/object.jule
Original file line number Diff line number Diff line change
Expand Up @@ -1146,8 +1146,8 @@ impl ObjectCoder {
}
}

// Generates VTM (virtual method table) object code for the trait.
fn traitData(mut &self, mut &hash: &traitHash, i: int, mut &s: &sema::StructIns) {
// Generates VTM (virtual method table) object code for the traitHash.
fn traitDataForHash(mut &self, mut &hash: &traitHash, i: int, mut &s: &sema::StructIns) {
mut ident := strings::Builder{}
ident.Grow(len(hash.traitDecl.Ident))
identCoder.traitDecl(ident, hash.traitDecl)
Expand All @@ -1169,12 +1169,12 @@ impl ObjectCoder {
}

// Generates VTM (virtual method table) object code for traits.
fn traitDatas(mut &self) {
fn traitData(mut &self) {
for (_, mut hash) in self.traitMap {
mut i := 0
for (_, mut s) in hash.traitDecl.Implemented {
for (_, mut ins) in s.Instances {
self.traitData(hash, i, ins)
self.traitDataForHsh(hash, i, ins)
i++
}
}
Expand Down Expand Up @@ -1203,7 +1203,7 @@ impl ObjectCoder {
self.wrapPos = self.Buf.Len()
self.traitWrappers()
self.write("\n\n")
self.traitDatas()
self.traitData()
self.write("\n\n")
self.declPos = self.Buf.Len()
self.globalDecls()
Expand Down
10 changes: 5 additions & 5 deletions std/jule/sema/eval.jule
Original file line number Diff line number Diff line change
Expand Up @@ -4474,16 +4474,16 @@ impl binaryEval {
applyCastModelByEnum(self.e.s, v, v.Type.Enum(), self.op, self.e.getOwnerRefers())
}

fn checkData(mut self, mut &v: &Value) {
fn checkValue(mut self, mut &v: &Value) {
f := v.Type.Func()
if f != nil && f.Decl != nil && f.Decl.IsMethod() {
self.e.pushErr(self.op, build::LogMsg.InvalidExprForBinary)
}
}

fn checkDatas(mut self) {
self.checkData(self.l)
self.checkData(self.r)
fn checkValues(mut self) {
self.checkValue(self.l)
self.checkValue(self.r)
}

fn setModel(mut self, mut &v: &Value) {
Expand Down Expand Up @@ -4523,7 +4523,7 @@ impl binaryEval {
fn solveExplicit(mut self, mut &l: &Value, mut &r: &Value): &Value {
self.l, self.r = l, r

self.checkDatas()
self.checkValues()

mut v := self.evalOp()

Expand Down

0 comments on commit c20ae7b

Please sign in to comment.