Skip to content

Commit

Permalink
added const for statics
Browse files Browse the repository at this point in the history
  • Loading branch information
Enn3Developer committed Jun 26, 2024
1 parent f4636ba commit 0797cfc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion core/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1961,6 +1961,7 @@ impl<'a> ParserInfo<'a> {
}

fn parse_token_static(&mut self, t: &BorrowedToken) -> Result<(), String> {
let r#const = t.kind() == CONST || self.advance_if(CONST);
match self.peek(0).kind() {
FN => {
let function = vec_deque![self.build_function(true)?];
Expand All @@ -1971,7 +1972,7 @@ impl<'a> ParserInfo<'a> {
self.compile_static(enums)?;
}
_ => {
let vars = vec_deque![self.build_variables(true, false, t.line(), false)?];
let vars = vec_deque![self.build_variables(true, r#const, t.line(), false)?];
self.compile_static(vars)?;
}
}
Expand Down
4 changes: 3 additions & 1 deletion examples/const.clue
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const test1 = "test1"
local const test2 = "test2"
static const test3 = "test3"

print(test1)
print(test2)
print(test2)
print(test3)

0 comments on commit 0797cfc

Please sign in to comment.