Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

suspected unassigned variable in OI10

edited April 2023 in SRP Editor
I am getting a heap of 'suspected unassigned variable' and with the line numbers also out for the reference.
The variables are assigned. e.g:

Day = Field(Dte,'/',1)

first line number is ok and info message is 'suspected unassigned variable : Day'

version 3.4.0.1

Comments

  • here is a screenshot of another compile where it has gone completely weird with line numbers


  • Is OK in OI9
  • Have you tried OI's editor to see if you get the same VNAVs?
  • Just did and no VNAV
  • Hmm, I'll add it to my todo list then. All I do is pass the SYSPROCS key of the source code to OI's BLINT stored procedure. Not sure why it's returning all that nonsense for the SRP Editor and not the OI editor.
  • edited April 2023
    I don't know if this has happened before but I've just noticed in OI9.

    The warning is correct in that both of those are unassigned variables. The first line number is wrong though. Both of those variables exist on the same line, 1155, and that's the only place they exist.

    So where does line number 1516 come from for variable "owner"?
    Perhaps coincidentally but the word "owner" does exist on that line. It's just that it is contained within a string.

    Editor is version 3.3.3.3 and OI 9.4.4 if that makes any difference.
    Here's what the OI editor returned

  • I agree that there is a false positive being recorded on line 1516, but the OI editor is reporting the same false positive...correct?
  • Pretty much.
    It should be like this


  • Right. I agree with your expectations in principle but you do know that the SRP Editor relies upon Blint, which is the routine that the Revelation Editor uses to identify potential VNAVs, correct? We do a little post-analysis to clean up their findings, which is why there are differences. The best resolution is to write our own analyzer.
  • Yeah, one of these days we're gonna write our own BASIC+ linter.
  • Just thought I'd offer another example of differences between yours and OI's editors.
    In case it helped.
  • edited April 2023
    I created an unassigned variable analyser that is better than OI's

    https://github.com/jgschis/BasicPlusParser/blob/master/BasicPlusParser/Analyser/UnassignedVariableAnalyser.cs

    It first builds an abstract syntax tree, then it simulates running the program and keeps track of what's been assigned.
Sign In or Register to comment.