Skip to content

Commit

Permalink
Comments: struct --> class
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli committed Jan 10, 2025
1 parent 315fb9e commit 7bd4926
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion compiler/ast.jou
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ class AstIfStatement:
# for init; cond; incr:
# ...body...
class AstForLoop:
# init and incr must be pointers because this struct goes inside AstStatement.
# init and incr must be pointers because this goes inside AstStatement.
init: AstStatement*
cond: AstExpression
incr: AstStatement*
Expand Down
2 changes: 1 addition & 1 deletion compiler/cf_graph.jou
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Control Flow Graph.
# Struct names not prefixed with Cfg because it looks too much like "config" to me
# Class names not prefixed with Cfg because it looks too much like "config" to me

import "stdlib/mem.jou"
import "stdlib/io.jou"
Expand Down
4 changes: 2 additions & 2 deletions compiler/codegen.jou
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def codegen_class_type(type: Type*) -> LLVMType*:

flat_elems: LLVMType** = malloc(sizeof(flat_elems[0]) * n)
for i = 0; i < n; i++:
# Treat all pointers inside structs as if they were void*.
# This allows structs to contain pointers to themselves.
# Treat all pointers inside classes as if they were void*.
# This allows classes to contain pointers to themselves.
if type->classdata.fields[i].type->kind == TypeKind::Pointer:
flat_elems[i] = codegen_type(voidPtrType)
else:
Expand Down
2 changes: 1 addition & 1 deletion compiler/typecheck/step2_populate_types.jou
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def handle_signature(ft: FileTypes*, astsig: AstSignature*, self_class: Type*) -


def handle_class_members(ft: FileTypes*, classdef: AstClassDef*) -> None:
# Previous type-checking step created an opaque struct.
# Previous type-checking step created an opaque class.
type: Type* = NULL
for s = ft->owned_types; s < &ft->owned_types[ft->n_owned_types]; s++:
if strcmp((*s)->name, classdef->name) == 0:
Expand Down

0 comments on commit 7bd4926

Please sign in to comment.