ghkweon / dwscript

Automatically exported from code.google.com/p/dwscript
0 stars 0 forks source link

Access violation in TExprBase.ReferencesVariable #354

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

type
   TMoveDir = (mvNorth, mvEast, mvSouth, mvWest);
   TMoveSet = {set} array of TMoveDir;

procedure Exclude(var moves: TMoveSet; move: TMoveDir);
var
  i: integer;
begin
  i := moves.IndexOf(move);
  if i >= 0 then
    moves.Delete(i);
end;

var
   ms: TMoveSet;
begin
   Exclude(ms, mvNorth);
end.

----------

Expected: This should compile.
Observed: Access violation in TExprBase.ReferencesVariable when compiling:

      for i:=0 to SubExprCount-1 do
         if SubExpr[i].ReferencesVariable(varSymbol) then
            Exit(True)

SubExprCount = 3, but self.SubExpr[2] = nil, with predictable results.

Original issue reported on code.google.com by masonwhe...@gmail.com on 21 Mar 2013 at 5:49

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r1870.

Original comment by zar...@gmail.com on 21 Mar 2013 at 7:26