changeset 563:c838ed7f2ac9

Added 'override' to some methods.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Fri, 28 Dec 2007 20:11:58 +0100
parents b0533550d64c
children 3c867a683258
files trunk/src/dil/Declarations.d trunk/src/dil/Expressions.d trunk/src/dil/Module.d trunk/src/dil/Statements.d trunk/src/dil/Symbol.d
diffstat 5 files changed, 30 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/trunk/src/dil/Declarations.d	Fri Dec 28 17:48:47 2007 +0100
+++ b/trunk/src/dil/Declarations.d	Fri Dec 28 20:11:58 2007 +0100
@@ -30,9 +30,9 @@
 
   void semantic(Scope sc)
   {
-//     foreach (node; this.children)
-//       if (node.category == NodeCategory.Declaration)
-//         (cast(Declaration)cast(void*)node).semantic(sc);
+    foreach (node; this.children)
+      if (node.category == NodeCategory.Declaration)
+        (cast(Declaration)cast(void*)node).semantic(sc);
   }
 
   final bool isStatic()
@@ -75,7 +75,7 @@
     addChildren(ds.children);
   }
 
-  void semantic(Scope scop)
+  override void semantic(Scope scop)
   {
     foreach (node; this.children)
     {
@@ -85,6 +85,7 @@
   }
 }
 
+/// Single semicolon.
 class EmptyDeclaration : Declaration
 {
   this()
@@ -92,14 +93,14 @@
     mixin(set_kind);
   }
 
-  void semantic(Scope)
+  override void semantic(Scope)
   {}
 }
 
 /++
   Illegal declarations encompass all tokens that don't
   start a DeclarationDefinition.
-  See_Also: dil.Parser.isDeclDefStartToken()
+  See_Also: dil.Token.isDeclDefStartToken()
 +/
 class IllegalDeclaration : Declaration
 {
@@ -108,7 +109,7 @@
     mixin(set_kind);
   }
 
-  void semantic(Scope)
+  override void semantic(Scope)
   {}
 }
 
@@ -443,7 +444,7 @@
 
   Variable[] variables;
 
-  void semantic(Scope scop)
+  override void semantic(Scope scop)
   {
     Type type;
 
@@ -693,7 +694,7 @@
     this.args = args;
   }
 
-  void semantic(Scope scop)
+  override void semantic(Scope scop)
   {
     pragmaSemantic(scop, begin, ident, args);
     decls.semantic(scop);
--- a/trunk/src/dil/Expressions.d	Fri Dec 28 17:48:47 2007 +0100
+++ b/trunk/src/dil/Expressions.d	Fri Dec 28 20:11:58 2007 +0100
@@ -68,7 +68,7 @@
     this.tok = tok;
   }
 
-  Expression semantic(Scope scop)
+  override Expression semantic(Scope scop)
   {
     left = left.semantic(scop);
     right = right.semantic(scop);
@@ -627,7 +627,7 @@
 
   Expression e; /// The expression created in the semantic phase.
 
-  Expression semantic(Scope)
+  override Expression semantic(Scope)
   {
     if (type)
       return e;
@@ -719,7 +719,7 @@
     this.type = type;
   }
 
-  Expression semantic(Scope)
+  override Expression semantic(Scope)
   {
     if (!type)
       type = Types.Void_ptr;
@@ -734,7 +734,7 @@
     mixin(set_kind);
   }
 
-  Expression semantic(Scope scop)
+  override Expression semantic(Scope scop)
   {
     if (type)
       return this;
@@ -753,7 +753,7 @@
   }
 
   Expression e;
-  Expression semantic(Scope scop)
+  override Expression semantic(Scope scop)
   {
     if (type)
       return this;
@@ -795,7 +795,7 @@
     this(token.ulong_, type);
   }
 
-  Expression semantic(Scope)
+  override Expression semantic(Scope)
   {
     if (type)
       return this;
@@ -846,7 +846,7 @@
     this(token.real_, type);
   }
 
-  Expression semantic(Scope)
+  override Expression semantic(Scope)
   {
     if (type)
       return this;
@@ -870,7 +870,7 @@
     this.type = type;
   }
 
-  Expression semantic(Scope)
+  override Expression semantic(Scope)
   {
     if (type)
       return this;
@@ -888,7 +888,7 @@
     this.character = character;
   }
 
-  Expression semantic(Scope scop)
+  override Expression semantic(Scope scop)
   {
     if (type)
       return this;
@@ -939,7 +939,7 @@
     this(cast(ubyte[])str, Types.Dchar);
   }
 
-  Expression semantic()
+  override Expression semantic(Scope scop)
   {
     if (type)
       return this;
@@ -1003,7 +1003,7 @@
   }
 
   // import dil.Parser;
-  Expression semantic(Scope scop)
+  override Expression semantic(Scope scop)
   {
     // TODO:
     /+
--- a/trunk/src/dil/Module.d	Fri Dec 28 17:48:47 2007 +0100
+++ b/trunk/src/dil/Module.d	Fri Dec 28 20:11:58 2007 +0100
@@ -85,12 +85,16 @@
     }
   }
 
+  /// Starts the semantic analysis of this module.
   void semantic()
   {
+    // Create module scope.
     auto scop = new Scope();
+    scop.symbol = this; // Set this module as the scope's symbol.
     this.root.semantic(scop);
   }
 
+  /// Returns true if there are errors in the source file.
   bool hasErrors()
   {
     return parser.errors.length || parser.lx.errors.length;
--- a/trunk/src/dil/Statements.d	Fri Dec 28 17:48:47 2007 +0100
+++ b/trunk/src/dil/Statements.d	Fri Dec 28 20:11:58 2007 +0100
@@ -488,7 +488,7 @@
     this.pragmaBody = pragmaBody;
   }
 
-  void semantic(Scope scop)
+  override void semantic(Scope scop)
   {
     pragmaSemantic(scop, begin, ident, args);
     pragmaBody.semantic(scop);
--- a/trunk/src/dil/Symbol.d	Fri Dec 28 17:48:47 2007 +0100
+++ b/trunk/src/dil/Symbol.d	Fri Dec 28 20:11:58 2007 +0100
@@ -6,6 +6,7 @@
 
 import common;
 
+/// Symbol IDs.
 enum SYM
 {
   Module,
@@ -18,6 +19,9 @@
   Type,
 }
 
+/++
+  A symbol represents an object with semantic code information.
++/
 class Symbol
 {
   SYM sid;