changeset 590:641041912670

Moved dil.Symbols to dil.semantic.Symbols.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sat, 05 Jan 2008 23:44:26 +0100
parents de365ddcfbd4
children 26addda6365b
files trunk/src/dil/Module.d trunk/src/dil/Scope.d trunk/src/dil/Symbols.d trunk/src/dil/ast/Declarations.d trunk/src/dil/semantic/Symbols.d
diffstat 5 files changed, 136 insertions(+), 136 deletions(-) [+]
line wrap: on
line diff
--- a/trunk/src/dil/Module.d	Sat Jan 05 23:40:54 2008 +0100
+++ b/trunk/src/dil/Module.d	Sat Jan 05 23:44:26 2008 +0100
@@ -12,7 +12,7 @@
 import dil.File;
 import dil.Scope;
 import dil.semantic.Symbol;
-import dil.Symbols;
+import dil.semantic.Symbols;
 import dil.Information;
 import tango.io.FilePath;
 import tango.io.FileConst;
--- a/trunk/src/dil/Scope.d	Sat Jan 05 23:40:54 2008 +0100
+++ b/trunk/src/dil/Scope.d	Sat Jan 05 23:44:26 2008 +0100
@@ -5,7 +5,7 @@
 module dil.Scope;
 
 import dil.semantic.Symbol;
-import dil.Symbols;
+import dil.semantic.Symbols;
 import dil.Information;
 import dil.Messages;
 import dil.Token;
--- a/trunk/src/dil/Symbols.d	Sat Jan 05 23:40:54 2008 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/++
-  Author: Aziz Köksal
-  License: GPL3
-+/
-module dil.Symbols;
-
-import dil.semantic.Symbol;
-import dil.SymbolTable;
-import dil.ast.Node;
-import dil.Enums;
-import dil.semantic.Types;
-import dil.Identifier;
-import common;
-
-/// A symbol that has its own scope with a symbol table.
-class ScopeSymbol : Symbol
-{
-  protected SymbolTable symbolTable; /// The symbol table.
-
-  this()
-  {
-  }
-
-  /// Look up ident in the table.
-  Symbol lookup(Identifier* ident)
-  {
-    return symbolTable.lookup(ident);
-  }
-
-  /// Insert a symbol into the table.
-  void insert(Symbol s, Identifier* ident)
-  {
-    symbolTable.insert(s, ident);
-  }
-}
-
-/// Aggregates have function and field members.
-class Aggregate : ScopeSymbol
-{
-  Identifier* ident; /// The name of this aggregate.
-  Function[] funcs;
-  Variable[] fields;
-
-  override void insert(Symbol s, Identifier* ident)
-  {
-    if (s.isVariable)
-      // Append variable to fields.
-      fields ~= cast(Variable)cast(void*)s;
-    else if (s.isFunction)
-      // Append function to funcs.
-      funcs ~= cast(Function)cast(void*)s;
-    super.insert(s, ident);
-  }
-}
-
-class Class : Aggregate
-{
-  this(Identifier* ident, Node classNode)
-  {
-    this.sid = SYM.Class;
-    this.ident = ident;
-    this.node = classNode;
-  }
-}
-
-class Interface : Aggregate
-{
-  this(Identifier* ident, Node interfaceNode)
-  {
-    this.sid = SYM.Interface;
-    this.ident = ident;
-    this.node = interfaceNode;
-  }
-}
-
-class Union : Aggregate
-{
-  this(Identifier* ident, Node unionNode)
-  {
-    this.sid = SYM.Union;
-    this.ident = ident;
-    this.node = unionNode;
-  }
-}
-
-class Struct : Aggregate
-{
-  this(Identifier* ident, Node structNode)
-  {
-    this.sid = SYM.Struct;
-    this.ident = ident;
-    this.node = structNode;
-  }
-}
-
-class Function : ScopeSymbol
-{
-  StorageClass stc;
-  LinkageType linkType;
-
-  Type returnType;
-  Identifier* ident;
-  Variable[] params;
-
-  this()
-  {
-    this.sid = SYM.Function;
-  }
-}
-
-class Variable : Symbol
-{
-  StorageClass stc;
-  LinkageType linkType;
-
-  Type type;
-  Identifier* ident;
-
-  this(StorageClass stc, LinkageType linkType,
-       Type type, Identifier* ident, Node varDecl)
-  {
-    this.sid = SYM.Variable;
-
-    this.stc = stc;
-    this.linkType = linkType;
-    this.type = type;
-    this.ident = ident;
-    this.node = varDecl;
-  }
-}
--- a/trunk/src/dil/ast/Declarations.d	Sat Jan 05 23:40:54 2008 +0100
+++ b/trunk/src/dil/ast/Declarations.d	Sat Jan 05 23:44:26 2008 +0100
@@ -13,7 +13,7 @@
 import dil.Scope;
 import dil.IdTable;
 import dil.semantic.Analysis;
-import dil.Symbols;
+import dil.semantic.Symbols;
 import dil.semantic.Types;
 import dil.Messages;
 import common;
@@ -307,15 +307,15 @@
     this.bases = bases;
   }
 
-  alias dil.Symbols.Interface InterfaceSymbol;
+  alias dil.semantic.Symbols.Interface Interface;
 
-  InterfaceSymbol interface_; /// The interface symbol for this declaration.
+  Interface interface_; /// The interface symbol for this declaration.
 
   override void semantic(Scope scop)
   {
     if (interface_)
       return;
-    interface_ = new InterfaceSymbol(name, this);
+    interface_ = new Interface(name, this);
     // Create a new scope.
     scop = scop.push(interface_);
     // Continue semantic analysis.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/dil/semantic/Symbols.d	Sat Jan 05 23:44:26 2008 +0100
@@ -0,0 +1,130 @@
+/++
+  Author: Aziz Köksal
+  License: GPL3
++/
+module dil.semantic.Symbols;
+
+import dil.semantic.Symbol;
+import dil.SymbolTable;
+import dil.ast.Node;
+import dil.Enums;
+import dil.semantic.Types;
+import dil.Identifier;
+import common;
+
+/// A symbol that has its own scope with a symbol table.
+class ScopeSymbol : Symbol
+{
+  protected SymbolTable symbolTable; /// The symbol table.
+
+  this()
+  {
+  }
+
+  /// Look up ident in the table.
+  Symbol lookup(Identifier* ident)
+  {
+    return symbolTable.lookup(ident);
+  }
+
+  /// Insert a symbol into the table.
+  void insert(Symbol s, Identifier* ident)
+  {
+    symbolTable.insert(s, ident);
+  }
+}
+
+/// Aggregates have function and field members.
+class Aggregate : ScopeSymbol
+{
+  Identifier* ident; /// The name of this aggregate.
+  Function[] funcs;
+  Variable[] fields;
+
+  override void insert(Symbol s, Identifier* ident)
+  {
+    if (s.isVariable)
+      // Append variable to fields.
+      fields ~= cast(Variable)cast(void*)s;
+    else if (s.isFunction)
+      // Append function to funcs.
+      funcs ~= cast(Function)cast(void*)s;
+    super.insert(s, ident);
+  }
+}
+
+class Class : Aggregate
+{
+  this(Identifier* ident, Node classNode)
+  {
+    this.sid = SYM.Class;
+    this.ident = ident;
+    this.node = classNode;
+  }
+}
+
+class Interface : Aggregate
+{
+  this(Identifier* ident, Node interfaceNode)
+  {
+    this.sid = SYM.Interface;
+    this.ident = ident;
+    this.node = interfaceNode;
+  }
+}
+
+class Union : Aggregate
+{
+  this(Identifier* ident, Node unionNode)
+  {
+    this.sid = SYM.Union;
+    this.ident = ident;
+    this.node = unionNode;
+  }
+}
+
+class Struct : Aggregate
+{
+  this(Identifier* ident, Node structNode)
+  {
+    this.sid = SYM.Struct;
+    this.ident = ident;
+    this.node = structNode;
+  }
+}
+
+class Function : ScopeSymbol
+{
+  StorageClass stc;
+  LinkageType linkType;
+
+  Type returnType;
+  Identifier* ident;
+  Variable[] params;
+
+  this()
+  {
+    this.sid = SYM.Function;
+  }
+}
+
+class Variable : Symbol
+{
+  StorageClass stc;
+  LinkageType linkType;
+
+  Type type;
+  Identifier* ident;
+
+  this(StorageClass stc, LinkageType linkType,
+       Type type, Identifier* ident, Node varDecl)
+  {
+    this.sid = SYM.Variable;
+
+    this.stc = stc;
+    this.linkType = linkType;
+    this.type = type;
+    this.ident = ident;
+    this.node = varDecl;
+  }
+}