changeset 838:1ecf05e680ba

Changed build configuration. From now on, the executable will be placed in bin/. The postbuild.* scripts for Linux and Windows will place important files in bin/ and bin/data/. Added hasType() to class Expression. Added search() to class Scope. Added DontKnowYet to struct Types.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Wed, 20 Aug 2008 20:39:16 +0200
parents 110f741dab45
children 4063da6f3edd
files dsss.conf scripts/postbuild.bat scripts/postbuild.sh src/dil/ast/Expression.d src/dil/semantic/Pass2.d src/dil/semantic/Scope.d src/dil/semantic/Types.d
diffstat 7 files changed, 38 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dsss.conf	Thu Aug 14 03:14:43 2008 +0200
+++ b/dsss.conf	Wed Aug 20 20:39:16 2008 +0200
@@ -2,7 +2,14 @@
 version = 0.1
 [src/main.d]
 type = binary
-target = dil
+target = bin/dil
+version(Windows) {
+  prebuild = mkdir bin\data
+  postbuild = scripts\postbuild.bat
+} else {
+  prebuild = mkdir -p bin/data
+  postbuild = scripts/postbuild.sh
+}
 version(GNU) {
   buildflags = -Isrc/ -Ldsss_objs/G/cmd.DDoc.o -Ldsss_objs/G/cmd.DDocXML.o
 } else {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/postbuild.bat	Wed Aug 20 20:39:16 2008 +0200
@@ -0,0 +1,2 @@
+copy src\config.d bin\
+copy src\html.css src\html_map.d src\lang_de.d src\lang_en.d src\lang_fi.d src\lang_tr.d src\macros_dil.ddoc src\predefined.ddoc src\predefined_xml.ddoc src\xml.css src\xml_map.d bin\data
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/postbuild.sh	Wed Aug 20 20:39:16 2008 +0200
@@ -0,0 +1,4 @@
+#!/bin/bash
+FILES=`echo -n src/{html.css,html_map.d,lang_de.d,lang_en.d,lang_fi.d,lang_tr.d,macros_dil.ddoc,predefined.ddoc,predefined_xml.ddoc,xml.css,xml_map.d}`
+cp src/config.d bin/
+cp $FILES bin/data/
\ No newline at end of file
--- a/src/dil/ast/Expression.d	Thu Aug 14 03:14:43 2008 +0200
+++ b/src/dil/ast/Expression.d	Wed Aug 20 20:39:16 2008 +0200
@@ -18,5 +18,11 @@
     super(NodeCategory.Expression);
   }
 
+  /// Returns true if the member 'type' is not null.
+  bool hasType()
+  {
+    return type !is null;
+  }
+
   override abstract Expression copy();
 }
--- a/src/dil/semantic/Pass2.d	Thu Aug 14 03:14:43 2008 +0200
+++ b/src/dil/semantic/Pass2.d	Wed Aug 20 20:39:16 2008 +0200
@@ -103,12 +103,7 @@
     Symbol symbol;
 
     if (idScope is null)
-      for (auto sc = scop; sc; sc = sc.parent)
-      {
-        symbol = sc.lookup(id);
-        if (symbol)
-          return symbol;
-      }
+      symbol = scop.search(id);
     else
       symbol = idScope.lookup(id);
 
--- a/src/dil/semantic/Scope.d	Thu Aug 14 03:14:43 2008 +0200
+++ b/src/dil/semantic/Scope.d	Wed Aug 20 20:39:16 2008 +0200
@@ -30,6 +30,21 @@
     return symbol.lookup(name);
   }
 
+  /// Searches for a symbol in this scope and all enclosing scopes.
+  /// Params:
+  ///   name = the name of the symbol.
+  Symbol search(Identifier* name)
+  {
+    Symbol symbol;
+    for (auto sc = this; sc; sc = sc.parent)
+    {
+      symbol = sc.lookup(name);
+      if (symbol !is null)
+        break;
+    }
+    return symbol;
+  }
+
   /// Create a new inner scope and return that.
   Scope enter(ScopeSymbol symbol)
   {
--- a/src/dil/semantic/Types.d	Thu Aug 14 03:14:43 2008 +0200
+++ b/src/dil/semantic/Types.d	Wed Aug 20 20:39:16 2008 +0200
@@ -359,6 +359,7 @@
   TypePointer Void_ptr; /// The void pointer type.
   TypeBasic Error; /// The error type.
   TypeBasic Undefined; /// The undefined type.
+  TypeBasic DontKnowYet; /// The symbol is undefined but might be resolved.
 
   /// Allocates an instance of TypeBasic and assigns it to typeName.
   template newTB(char[] typeName)
@@ -406,5 +407,6 @@
     Void_ptr = Void.ptrTo;
     Error = new TypeBasic(TYP.Error);
     Undefined = new TypeBasic(TYP.Error);
+    DontKnowYet = new TypeBasic(TYP.Error);
   }
 }