Skip to content

Commit 5023105

Browse files
committed
Fixed issue with some type declaration kinds being private instead of protected by default
1 parent b7d6aba commit 5023105

7 files changed

+11
-7
lines changed

Diff for: src/parser/parse_enum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ impl<'a, I: Inflow<Token>> Parser<'a, I> {
1313
let source = self.source_here();
1414
assert!(self.input.advance().is_enum_keyword());
1515

16-
let mut privacy = Privacy::Private;
16+
let mut privacy = Privacy::Protected;
1717
let name = self.parse_identifier(Some("for enum name after 'enum' keyword"))?;
1818
self.ignore_newlines();
1919

Diff for: src/parser/parse_global_variable.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ impl<'a, I: Inflow<Token>> Parser<'a, I> {
1919

2020
let mut is_foreign = false;
2121
let mut is_thread_local = false;
22-
let mut privacy = Privacy::Private;
22+
let mut privacy = Privacy::Protected;
2323

2424
for annotation in annotations {
2525
match annotation.kind {
2626
AnnotationKind::Foreign => is_foreign = true,
2727
AnnotationKind::ThreadLocal => is_thread_local = true,
2828
AnnotationKind::Public => privacy = Privacy::Public,
29+
AnnotationKind::Private => privacy = Privacy::Private,
2930
_ => {
3031
return Err(self.unexpected_annotation(&annotation, Some("for global variable")))
3132
}

Diff for: src/parser/parse_helper_expr.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl<'a, I: Inflow<Token>> Parser<'a, I> {
1717
let source = self.source_here();
1818
self.input.advance();
1919

20-
let mut privacy = Privacy::Private;
20+
let mut privacy = Privacy::Protected;
2121
let name = self.parse_identifier(Some("for define name after 'define' keyword"))?;
2222
self.ignore_newlines();
2323

@@ -27,6 +27,7 @@ impl<'a, I: Inflow<Token>> Parser<'a, I> {
2727
for annotation in annotations {
2828
match annotation.kind {
2929
AnnotationKind::Public => privacy = Privacy::Public,
30+
AnnotationKind::Private => privacy = Privacy::Private,
3031
_ => return Err(self.unexpected_annotation(&annotation, Some("for define"))),
3132
}
3233
}

Diff for: src/parser/parse_impl.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ impl<'a, I: Inflow<Token>> Parser<'a, I> {
1414
let source = self.input.peek().source;
1515
self.input.advance().kind.unwrap_impl_keyword();
1616

17-
let mut privacy = Privacy::Private;
17+
let mut privacy = Privacy::Protected;
1818

1919
for annotation in annotations {
2020
match annotation.kind {
2121
AnnotationKind::Public => privacy = Privacy::Public,
22+
AnnotationKind::Private => privacy = Privacy::Private,
2223
_ => {
2324
return Err(self.unexpected_annotation(&annotation, Some("for implementation")))
2425
}

Diff for: src/parser/parse_structure.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl<'a, I: Inflow<Token>> Parser<'a, I> {
1919
self.ignore_newlines();
2020

2121
let mut is_packed = false;
22-
let mut privacy = Privacy::Private;
22+
let mut privacy = Privacy::Protected;
2323

2424
for annotation in annotations {
2525
match annotation.kind {

Diff for: src/parser/parse_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl<'a, I: Inflow<Token>> Parser<'a, I> {
1717
let name = self.parse_identifier(Some("for trait name after 'trait' keyword"))?;
1818
self.ignore_newlines();
1919

20-
let mut privacy = Privacy::Private;
20+
let mut privacy = Privacy::Protected;
2121

2222
for annotation in annotations {
2323
match annotation.kind {

Diff for: src/parser/parse_type_alias.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl<'a, I: Inflow<Token>> Parser<'a, I> {
1414
let source = self.source_here();
1515
assert!(self.input.advance().is_type_alias_keyword());
1616

17-
let mut privacy = Privacy::Private;
17+
let mut privacy = Privacy::Protected;
1818
let name = self.parse_identifier(Some("for alias name after 'typealias' keyword"))?;
1919
self.ignore_newlines();
2020

@@ -23,6 +23,7 @@ impl<'a, I: Inflow<Token>> Parser<'a, I> {
2323
for annotation in annotations {
2424
match annotation.kind {
2525
AnnotationKind::Public => privacy = Privacy::Public,
26+
AnnotationKind::Private => privacy = Privacy::Private,
2627
_ => return Err(self.unexpected_annotation(&annotation, Some("for type alias"))),
2728
}
2829
}

0 commit comments

Comments
 (0)