Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class variables have class attribute (Fixed version) #215

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Wosi
Copy link
Contributor

@Wosi Wosi commented Sep 2, 2017

My first attempt marked all fields within the same visibility node as class variables. I've fixed it now.

So this code:

  TStatic = class
  public
    FNotStaticButInTheSameSection: Integer; // <-- This was marked as class field in the first attempt
    class var FClassVar, 
      FClassVar2: String; 
      FClassVar3: integer;
    class property ClassProp: String read FClassVar;
  public
    FInstanceVar: String;
    property InstanceProp: String read FInstanceVar;
  end;

Leads to this AST:

      <TYPEDECL begin_line="309" begin_col="3" end_line="319" end_col="6" name="TStatic">
        <TYPE line="309" col="13" type="class" class="true">
          <PUBLIC line="310" col="3" visibility="true">
            <FIELD line="311" col="5">
              <NAME line="311" col="5" value="FNotStaticButInTheSameSection"/>
              <TYPE line="311" col="36" name="Integer"/>
            </FIELD>
            <FIELD line="312" col="15" class="true">
              <NAME line="312" col="15" value="FClassVar"/>
              <TYPE line="313" col="19" name="String"/>
            </FIELD>
            <FIELD line="313" col="7" class="true">
              <NAME line="313" col="7" value="FClassVar2"/>
              <TYPE line="313" col="19" name="String"/>
            </FIELD>
            <FIELD line="314" col="7" class="true">
              <NAME line="314" col="7" value="FClassVar3"/>
              <TYPE line="314" col="19" name="integer"/>
            </FIELD>
            <PROPERTY line="315" col="5" class="true" name="ClassProp">
              <TYPE line="315" col="31" name="String"/>
              <READ line="315" col="38">
                <IDENTIFIER line="315" col="43" name="FClassVar"/>
              </READ>
            </PROPERTY>
          </PUBLIC>
          <PUBLIC line="316" col="3" visibility="true">
            <FIELD line="317" col="5">
              <NAME line="317" col="5" value="FInstanceVar"/>
              <TYPE line="317" col="19" name="String"/>
            </FIELD>
            <PROPERTY line="318" col="5" name="InstanceProp">
              <TYPE line="318" col="28" name="String"/>
              <READ line="318" col="35">
                <IDENTIFIER line="318" col="40" name="FInstanceVar"/>
              </READ>
            </PROPERTY>
          </PUBLIC>
        </TYPE>
      </TYPEDECL>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant