File tree Expand file tree Collapse file tree 3 files changed +16
-14
lines changed
Expand file tree Collapse file tree 3 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -2294,15 +2294,15 @@ function TBuildParseTree.RecogniseVarDecl(const inlineVar: boolean): boolean;
22942294 else
22952295 RecogniseIdentList(False);
22962296
2297- // check if we are inside a for loop header
2297+ // fix: check if we are inside a for loop header
22982298 lc := fcTokenList.FirstSolidToken;
22992299 if lc.TokenType = ttIn then
23002300 begin
2301- // Delphi 2005 syntax
2301+ // Delphi 2005 `for var in` syntax
23022302 PopNode;
23032303 Exit;
2304- end ;
2305-
2304+ end ;
2305+
23062306 Recognise(ttColon);
23072307 RecogniseType;
23082308
@@ -2946,12 +2946,7 @@ procedure TBuildParseTree.RecogniseSimpleStmnt;
29462946 else if lc.TokenType = ttSemicolon then
29472947 // empty statement
29482948 // this gets done later in common code Recognise(ttSemicolon);
2949- else if lc.TokenType = ttConst then
2950- begin
2951- Recognise(ttConst);
2952- RecogniseConstantDecl;
2953- end
2954- // fix: inline `var`
2949+ // fix: inline `var` declaration
29552950 else if lc.TokenType = ttVar then
29562951 begin
29572952{ $if false}
@@ -2973,6 +2968,12 @@ procedure TBuildParseTree.RecogniseSimpleStmnt;
29732968{ $if false}
29742969 PopNode;
29752970{ $endif}
2971+ end
2972+ // fix: inline `const` declaration
2973+ else if lc.TokenType = ttConst then
2974+ begin
2975+ Recognise(ttConst);
2976+ RecogniseConstantDecl;
29762977 end else
29772978 raise TEParseError.Create(' expected simple statement' , lc);
29782979end ;
Original file line number Diff line number Diff line change 2020under the License.
2121
2222Alternatively, the contents of this file may be used under the terms of
23- the GNU General Public License Version 2 or later (the "GPL")
23+ the GNU General Public License Version 2 or later (the "GPL")
2424See http://www.gnu.org/licenses/gpl.html
2525------------------------------------------------------------------------------*)
2626{ *)}
@@ -421,6 +421,7 @@ function CalculateIndent(const pt: TSourceToken): integer;
421421 if (pt.TokenType = ttVar) and not pt.HasParentNode(nVarSection) then
422422 Inc(liIndentCount);
423423
424+ // fix: not for inline constant declaration
424425 if (pt.TokenType = ttConst) and not pt.HasParentNode(nConstSection) then
425426 Inc(liIndentCount);
426427 end ;// outdent keywords that start and end the block
Original file line number Diff line number Diff line change @@ -36,11 +36,11 @@ function myFunction(aParam: string
3636var inline_var_decl2_string, inline_var_decl3_string: string := ' this is a string' ;
3737
3838 const inline_const := 999 ;
39-
39+
4040 for var currentField in fieldList do
4141 begin
42- var inline_var_decl4: string = ' a string' ;
43- end ;
42+ var inline_var_decl4: string = ' a string' ;
43+ end ;
4444
4545 for i := 1 to 10 do
4646 if i < 10 then write(i, ' ,' )
You can’t perform that action at this time.
0 commit comments