Difference between revisions of "Random DMD Facts"

From D Wiki
Jump to: navigation, search
 
Line 11: Line 11:
 
   To get the function that is being called you need to look at the member `member`  
 
   To get the function that is being called you need to look at the member `member`  
 
   If that `FuncDeclaration` is null, that is a default initialization.
 
   If that `FuncDeclaration` is null, that is a default initialization.
 +
 +
2)  Null statements stand for empty statements
 +
    Usually in DMD null node represent that something has not been  resolved yet.
 +
    However a new which contains an optional statement (Such as {})
 +
    will represent a missing statement as null.

Latest revision as of 01:20, 14 June 2020

Random DMD Facts.

I've decided to document everything here that I come across. On this page you'll see a truly random assortment of facts about DMD Internals. (Which may be outdated by the time of reading)

1) Detecting a default initialization of a class:

  class C {}; auto c = new C()
  Will be represented as a `NewExp`
  To get the function that is being called you need to look at the member `member` 
  If that `FuncDeclaration` is null, that is a default initialization.

2) Null statements stand for empty statements

   Usually in DMD null node represent that something has not been  resolved yet.
   However a new which contains an optional statement (Such as {})
   will represent a missing statement as null.