View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0030109 | Lazarus | IDE | public | 2016-05-08 01:03 | 2020-10-10 06:56 |
Reporter | lks | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | confirmed | Resolution | open | ||
Product Version | 1.7 (SVN) | ||||
Summary | 0030109: IDE editor: {$if} doesn't evaluate constants | ||||
Description | Example: const HIGHLIGHTED = 1; {$if HIGHLIGHTED = 1} // this should appear in normal font, but displays in lighter font {$else} // this should appear in lighter font, but displays in normal font {$endif} | ||||
Tags | No tags attached. | ||||
Fixed in Revision | |||||
LazTarget | - | ||||
Widgetset | |||||
Attached Files |
|
has duplicate | 0032950 | resolved | Bart Broersma | Code editor always displayes the code within {$if CONST_NAME = NNN} ... {$endif} as inactive |
has duplicate | 0033715 | closed | Bart Broersma | Incorrect syntax highlighting of $IF directives |
has duplicate | 0036612 | resolved | Bart Broersma | Codetool parses "{$IF ident > n}" wrong / Lazarus editor grayed out wrong section of const conditional compilation |
related to | 0030214 | assigned | Mattias Gaertner | IFDEF + numeric identifier is always TRUE in IDE |
related to | 0029998 | new | Wrong color of conditional-compile code | |
related to | 0034649 | resolved | Bart Broersma | Source Code Editor shows inverted interpretation of $if statements |
|
The same goes for {$if DECLARED(foo_bar_test)} syntax. It will always be shown in normal font (as if evaluated to TRUE). |
|
If somebody can point me to where to look, I am happy to take a shot at fixing this problem. |
|
Any updates on this? Issue still persists on 1.9.0. Moreover this breaks coding process raising an error when one executes code completion ~~~ {$IF DECLARED(TFooBarClass)} TSomeClass = class(TFooBarClass); {$ELSE} TSomeClass = class(TComponent); {$IFEND} ... var ds: TSomeClass; begin ds. <= press Ctrl+Space here - get Error: identifier not found: TFooBarClass |
|
0001-DebugLn-for-issue-30109.patch (1,721 bytes)
From e047221995fc499e89c90ae571e92d8b798565c5 Mon Sep 17 00:00:00 2001 From: juha <juha.manninen62@gmail.com> Date: Fri, 14 Sep 2018 14:26:50 +0300 Subject: [PATCH] DebugLn for issue 30109. --- components/codetools/linkscanner.pas | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/codetools/linkscanner.pas b/components/codetools/linkscanner.pas index 200c7ce23..5a17bcedb 100644 --- a/components/codetools/linkscanner.pas +++ b/components/codetools/linkscanner.pas @@ -3607,6 +3607,7 @@ begin if FSkippingDirectives<>lssdNone then exit(true); ReadSpace; VariableName:=ReadUpperIdentifier; + DebugLn(['TLinkScanner.IfdefDirective: VariableName=', VariableName]); if (VariableName<>'') and (not Values.IsDefined(VariableName)) then SkipTillEndifElse(lssdTillElse); Result:=true; @@ -4651,14 +4652,16 @@ function TLinkScanner.InternalIfDirective: boolean; var ExprResult: Boolean; + Expr: String; begin - //DebugLn(['TLinkScanner.InternalIfDirective FSkippingDirectives=',ord(FSkippingDirectives),' IfLevel=',IfLevel]); + DebugLn(['TLinkScanner.InternalIfDirective FSkippingDirectives=', ord(FSkippingDirectives),', IfLevel=',IfLevel]); inc(SrcPos); if SrcPos>SrcLen then RaiseMissingExpr; ExprResult:=Values.EvalBoolean(@Src[SrcPos],CommentInnerEndPos-SrcPos); Result:=true; - //DebugLn(['TLinkScanner.InternalIfDirective ExprResult=',ExprResult]); + Expr:=Copy(Src,SrcPos,CommentInnerEndPos-SrcPos); + DebugLn(['TLinkScanner.InternalIfDirective: Expr=',Expr,', ExprResult=',ExprResult]); if Values.ErrorPosition>=0 then begin inc(SrcPos,Values.ErrorPosition); RaiseException(20170422130200,Values.ErrorMsg) -- 2.18.0 |
|
> If somebody can point me to where to look, I am happy to take a shot at fixing this problem. Function TLinkScanner.InternalIfDirective. It uses class TExpressionEvaluator. ExprResult:=Values.EvalBoolean(...) seems an essential call. Ask questions in Lazarus mailing list. First study the code well so that you can ask relevant questions. Mattias and maybe Martin know the code best. See also the related issues. I uploaded a patch that adds DebugLn() calls to get you started. DebugLn() is a good and powerful way to debug the IDE. |
|
It seems constants doesn't even added to the list. It's not implemented yet or a bug? I can't find anything about parsing const in codetool. |
Date Modified | Username | Field | Change |
---|---|---|---|
2016-05-08 01:03 | lks | New Issue | |
2016-05-08 23:40 | Bart Broersma | LazTarget | => - |
2016-05-08 23:40 | Bart Broersma | Status | new => confirmed |
2016-05-09 09:12 | Ondrej Pokorny | OS | OSX => |
2016-05-09 09:12 | Ondrej Pokorny | OS Version | 10.11 => |
2016-05-09 09:12 | Ondrej Pokorny | Platform | darwin => |
2016-05-09 09:12 | Ondrej Pokorny | Summary | {$if} displays the wrong way in conditional expressions => IDE editor: {$if} doesn't evaluate constants |
2016-05-22 16:14 | Bart Broersma | Note Added: 0092688 | |
2016-05-31 22:35 | Bart Broersma | Relationship added | related to 0030214 |
2016-08-22 17:11 | Bart Broersma | Relationship added | related to 0029998 |
2018-01-12 15:02 | Bart Broersma | Relationship added | has duplicate 0032950 |
2018-03-30 17:43 | lks | Note Added: 0107467 | |
2018-05-09 19:09 | Bart Broersma | Relationship added | has duplicate 0033715 |
2018-09-14 10:20 | Fr0sT | Note Added: 0110734 | |
2018-09-14 10:20 | Fr0sT | Note Edited: 0110734 | View Revisions |
2018-09-14 13:31 | Juha Manninen | File Added: 0001-DebugLn-for-issue-30109.patch | |
2018-09-14 13:39 | Juha Manninen | Note Added: 0110745 | |
2018-09-14 13:40 | Juha Manninen | Note Edited: 0110745 | View Revisions |
2018-09-14 13:55 | Juha Manninen | Note Edited: 0110745 | View Revisions |
2018-12-05 12:27 | Martin Friebe | Relationship added | related to 0034649 |
2020-01-21 05:28 | Martin Friebe | Relationship added | has duplicate 0036612 |
2020-10-10 06:56 | Nur Cholif Murtadho | Note Added: 0126200 |