Skip to content

Commit

Permalink
sema: fix structure ast node instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Mar 25, 2024
1 parent 7a9e6bc commit bd711cf
Showing 1 changed file with 8 additions and 20 deletions.
28 changes: 8 additions & 20 deletions std/jule/sema/struct.jule
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ impl Struct {
let mut ins = &StructIns{
decl: self,
fields: make([]&FieldIns, 0, self.fields.len),
methods: make([]&Fn, 0, self.methods.len),
references: ReferenceStack.new(),
}

Expand All @@ -146,26 +145,15 @@ impl Struct {
}
}

for (_, mut f) in self.methods {
let mut fins = &Fn{
sema: f.sema,
token: f.token,
global: f.global,
unsafety: f.unsafety,
public: f.public,
cpp_linked: f.cpp_linked,
statically: f.statically,
exceptional: f.exceptional,
ident: f.ident,
directives: f.directives,
scope: f.scope,
generics: f.generics,
result: f.result,
params: f.params,
owner: f.owner,
instances: nil,
if self.generics.len == 0 {
ins.methods = self.methods
} else {
ins.methods = make([]&Fn, 0, self.methods.len)
for (_, mut f) in self.methods {
let mut fins = new(Fn, *f)
fins.instances = nil
ins.methods = append(ins.methods, fins)
}
ins.methods = append(ins.methods, fins)
}

ret ins
Expand Down

0 comments on commit bd711cf

Please sign in to comment.