diff --git a/delphi-frontend/src/main/antlr3/au/com/integradev/delphi/antlr/Delphi.g b/delphi-frontend/src/main/antlr3/au/com/integradev/delphi/antlr/Delphi.g index b86bfea13..8cff11310 100644 --- a/delphi-frontend/src/main/antlr3/au/com/integradev/delphi/antlr/Delphi.g +++ b/delphi-frontend/src/main/antlr3/au/com/integradev/delphi/antlr/Delphi.g @@ -333,11 +333,12 @@ import org.apache.commons.lang3.StringUtils; private Token combineLastNTokens(int type, int count) { CommonToken firstToken = (CommonToken) input.LT(-count); CommonToken lastToken = (CommonToken) input.LT(-1); - lastToken.setType(type); - lastToken.setStartIndex(firstToken.getStartIndex()); - lastToken.setLine(firstToken.getLine()); - lastToken.setCharPositionInLine(firstToken.getCharPositionInLine()); - return lastToken; + CommonToken result = new CommonToken(lastToken); + result.setType(type); + result.setStartIndex(firstToken.getStartIndex()); + result.setLine(firstToken.getLine()); + result.setCharPositionInLine(firstToken.getCharPositionInLine()); + return result; } private BinaryExpressionNodeImpl createBinaryExpression(Object operator) { diff --git a/its/src/projects/cpd-simple/src/CpdTest.pas b/its/src/projects/cpd-simple/src/CpdTest.pas index aad2bf11a..7d3b13a98 100644 --- a/its/src/projects/cpd-simple/src/CpdTest.pas +++ b/its/src/projects/cpd-simple/src/CpdTest.pas @@ -15,7 +15,7 @@ TfDemo = class(TForm) public {testDefinitionsIncludes} end; - + type TfDemoSecond = class (TForm) bShowTracker: TButton; @@ -25,7 +25,7 @@ TfDemoSecond = class (TForm) public end; - + var fDemo: TfDemo; @@ -37,7 +37,7 @@ procedure TfDemo.bShowTrackerClick(Sender: TObject); multiline comment *) - + for i:=0 to 100 do begin a := b; @@ -46,7 +46,7 @@ procedure TfDemo.bShowTrackerClick(Sender: TObject); end; c := d; a := b; - if a < b then begin + if a >= b then begin c := b; end; end; @@ -59,11 +59,11 @@ procedure TfDemo.bShowTrackerClick(Sender: TObject); end; c := d; a := b; - if a < b then begin + if a >= b then begin c := b; end; end; - + end; end. \ No newline at end of file