Skip to content

Commit

Permalink
fixes mutable func validation bug (#7)
Browse files Browse the repository at this point in the history
- fixes error where the stateful flags were not being reset appropriately
  • Loading branch information
sarvalabs-sarthak authored Dec 1, 2023
1 parent 2b166a9 commit 5904dcd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/src/modules/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ export const statefulValidation = (text: String, diagnostics: Diagnostic[]) => {
// Check for 'mutate' keyword after the endpoint/func declaration
for (let bodyLineIndex = lineIndex + 1; bodyLineIndex < lines.length; bodyLineIndex++) {
const bodyLine = lines[bodyLineIndex];

if(/^(?!\s*$)[^\t ]/.test(bodyLine)){
break;
}

if (!(/^\s*$/.test(bodyLine))) { // Skip empty lines
if (bodyLine.match(mutatePattern)) {
hasMutateKeyword = true;
Expand Down

0 comments on commit 5904dcd

Please sign in to comment.