Browse Source

BLOCKS: Added some extra safety checks in the littlefoot compiler

tags/2021-05-28
jules 7 years ago
parent
commit
f31d7844a4
1 changed files with 9 additions and 7 deletions
  1. +9
    -7
      modules/juce_blocks_basics/littlefoot/juce_LittleFootCompiler.h

+ 9
- 7
modules/juce_blocks_basics/littlefoot/juce_LittleFootCompiler.h View File

@@ -1307,9 +1307,10 @@ private:
if (! isMainBlockOfFunction)
return parentBlock->getVariableDepth (name, locationForError);
for (int i = function->arguments.size(); --i >= 0;)
if (function->arguments.getReference(i).name == name)
return i + 1 + function->getNumLocals();
if (function != nullptr)
for (int i = function->arguments.size(); --i >= 0;)
if (function->arguments.getReference(i).name == name)
return i + 1 + function->getNumLocals();
index = indexOf (getGlobalVariables(), name);
if (index >= 0)
@@ -1338,12 +1339,13 @@ private:
if (v.name == name)
return v;
if (! isMainBlockOfFunction)
if (! isMainBlockOfFunction && parentBlock != nullptr)
return parentBlock->getVariable (name, locationForError);
for (auto& v : function->arguments)
if (v.name == name)
return v;
if (function != nullptr)
for (auto& v : function->arguments)
if (v.name == name)
return v;
for (auto& v : getGlobalConstants())
if (v.name == name)


Loading…
Cancel
Save