3 Commits 4e3fdd8f14 ... b7c2e82e2f

Author SHA1 Message Date
  Gabriel Czernikier b7c2e82e2f java7.c 2 years ago
  Gabriel Czernikier c746084d65 java7.c 2 years ago
  Gabriel Czernikier c06db38995 java7.[ch] 2 years ago
2 changed files with 12 additions and 5 deletions
  1. 10 3
      src/main/java7.c
  2. 2 2
      src/main/java7.h

+ 10 - 3
src/main/java7.c

@@ -34,7 +34,7 @@ struct ident_st *init_ident(lgwseq_t ident) {
 	return i;
 }
 struct top_code_st *init_top_code() {
-	struct tc = (struct top_code_st*)malloc(sizeof(struct top_code_st));
+	struct top_code_st *tc = (struct top_code_st*)malloc(sizeof(struct top_code_st));
 	tc->package=NULL;
 	INIT_LIST_HEAD(&tc->imports_head);
 	tc->context=init_context();
@@ -61,7 +61,6 @@ struct context_st *get_context(struct top_code_st *top_code) {
 }
 struct context_st *open_context(struct context_st *current_context) {
 	struct context_st *c = init_context();
-	c->enclosing_context=current_context;
 	list_add_tail(&c->subcontext_list,&current_context->subcontext_head);
 	c->enclosing=current_context;
 	return c;
@@ -183,6 +182,14 @@ struct maybequalif_schent *mayqual_ary;
 size_t ary_len;
 size_t at_end_idx;
 
+lgwseq_t schent(struct maybequalif_schent *mayqual) {
+	return mayqual->just_qualif?mayqual->schent.ident_mark->mark.ident:mayqual->schent.justqualif;
+}
+
+int maybequalif_schent_compar(const struct maybequalif_schent *a, const struct maybequalif_schent *b) {
+	return lgwseq_t_compar(&schent(a),&schent(b));
+}
+
 /* Set up a data structure of anithing that may be a qualifier, regardless if indeed it is.
  * X may be a qualifier if any of the following expressions denotes a referential:
  * X.Y.Z, Y.X.Z, even Y.Z.X, otherwise noting about X doesn't match to be a qualifier
@@ -243,7 +250,7 @@ void expand_qualifiees(struct maybequalif_schent *bounds, size_t *at_end_idx, si
 		eqcls_repre->qualifiee_base=at_end_idx;
 
 		while(bounds->qualifiee_base+bounds->qualifiee_nelems!=eqcls_other&&!maybequalif_schent_compar(eqcls_repre, eqcls_other)) {
-			bare_expand(eqcls_other,eqcls_repre,&at_end_idx,&ary_len); // TODO ARRAY_APPPEND(at_end_idx,ary_len,data=other); repre->qualifiee_nelems++;
+			bare_expand(eqcls_other,eqcls_repre,&at_end_idx,&ary_len);
 			if(eqcls_other==eqcls_repre)
 				eqcls_repre->eqcls_vec=NULL;
 			else

+ 2 - 2
src/main/java7.h

@@ -33,8 +33,8 @@ struct top_code_st {
 };
 
 struct context_st {
-	struct list_head referentials_head;   // for example a Reference Type as "class Foo" is a referential.
-	struct list_head subcontext_head;  // for example "class Foo { class subcontext {} }"
+	struct list_head referentials_head;   //  "class A", "interface B" and "enum C" are all examples of referential.
+	struct list_head subcontext_head;  //  for example "class A { subcontext of A }"
 	struct list_head subcontext_list;
 	struct context_st *enclosing;  // for example "class enclosing { class Foo {} }"
 	struct mayqualif_schent *reftials_inctx; // referentials in context, searchable entries