changeset 668:a1f8d8f2db38

Renamed some identifiers.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Thu, 17 Jan 2008 19:27:46 +0100
parents 1ac758cd952a
children 1e3c5967ef12
files trunk/src/cmd/Generate.d trunk/src/dil/ast/Declarations.d trunk/src/dil/ast/DefaultVisitor.d trunk/src/dil/ast/Expressions.d trunk/src/dil/ast/NodesEnum.d trunk/src/dil/ast/Parameters.d trunk/src/dil/ast/Types.d trunk/src/dil/parser/Parser.d
diffstat 8 files changed, 62 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/trunk/src/cmd/Generate.d	Thu Jan 17 00:21:16 2008 +0100
+++ b/trunk/src/cmd/Generate.d	Thu Jan 17 19:27:46 2008 +0100
@@ -128,8 +128,6 @@
     }
     break;
   case NC.Type:
-    if (node.kind == NodeKind.BaseClass)
-      break;
     suffixLength = "Type".length;
     break;
   case NC.Other:
--- a/trunk/src/dil/ast/Declarations.d	Thu Jan 17 00:21:16 2008 +0100
+++ b/trunk/src/dil/ast/Declarations.d	Thu Jan 17 19:27:46 2008 +0100
@@ -205,8 +205,8 @@
 
 class ClassDeclaration : AggregateDeclaration
 {
-  BaseClass[] bases;
-  this(Identifier* name, TemplateParameters tparams, BaseClass[] bases, Declarations decls)
+  BaseClassType[] bases;
+  this(Identifier* name, TemplateParameters tparams, BaseClassType[] bases, Declarations decls)
   {
     super(name, tparams, decls);
     mixin(set_kind);
@@ -222,8 +222,8 @@
 
 class InterfaceDeclaration : AggregateDeclaration
 {
-  BaseClass[] bases;
-  this(Identifier* name, TemplateParameters tparams, BaseClass[] bases, Declarations decls)
+  BaseClassType[] bases;
+  this(Identifier* name, TemplateParameters tparams, BaseClassType[] bases, Declarations decls)
   {
     super(name, tparams, decls);
     mixin(set_kind);
@@ -273,16 +273,16 @@
 
 class ConstructorDeclaration : Declaration
 {
-  Parameters parameters;
+  Parameters params;
   FunctionBody funcBody;
-  this(Parameters parameters, FunctionBody funcBody)
+  this(Parameters params, FunctionBody funcBody)
   {
     super.hasBody = true;
     mixin(set_kind);
-    addChild(parameters);
+    addChild(params);
     addChild(funcBody);
 
-    this.parameters = parameters;
+    this.params = params;
     this.funcBody = funcBody;
   }
 }
@@ -329,12 +329,12 @@
 class FunctionDeclaration : Declaration
 {
   TypeNode returnType;
-  Identifier* funcName;
+  Identifier* name;
   TemplateParameters tparams;
   Parameters params;
   FunctionBody funcBody;
   LinkageType linkageType;
-  this(TypeNode returnType, Identifier* funcName, TemplateParameters tparams,
+  this(TypeNode returnType, Identifier* name, TemplateParameters tparams,
        Parameters params, FunctionBody funcBody)
   {
     super.hasBody = funcBody.funcBody !is null;
@@ -345,7 +345,7 @@
     addChild(funcBody);
 
     this.returnType = returnType;
-    this.funcName = funcName;
+    this.name = name;
     this.tparams = tparams;
     this.params = params;
     this.funcBody = funcBody;
@@ -503,32 +503,32 @@
 
 class NewDeclaration : Declaration
 {
-  Parameters parameters;
+  Parameters params;
   FunctionBody funcBody;
-  this(Parameters parameters, FunctionBody funcBody)
+  this(Parameters params, FunctionBody funcBody)
   {
     super.hasBody = true;
     mixin(set_kind);
-    addChild(parameters);
+    addChild(params);
     addChild(funcBody);
 
-    this.parameters = parameters;
+    this.params = params;
     this.funcBody = funcBody;
   }
 }
 
 class DeleteDeclaration : Declaration
 {
-  Parameters parameters;
+  Parameters params;
   FunctionBody funcBody;
-  this(Parameters parameters, FunctionBody funcBody)
+  this(Parameters params, FunctionBody funcBody)
   {
     super.hasBody = true;
     mixin(set_kind);
-    addChild(parameters);
+    addChild(params);
     addChild(funcBody);
 
-    this.parameters = parameters;
+    this.params = params;
     this.funcBody = funcBody;
   }
 }
--- a/trunk/src/dil/ast/DefaultVisitor.d	Thu Jan 17 00:21:16 2008 +0100
+++ b/trunk/src/dil/ast/DefaultVisitor.d	Thu Jan 17 19:27:46 2008 +0100
@@ -57,8 +57,7 @@
       d.tparams && visitN(d.tparams),
       d.decls && visitD(d.decls);
     static if (is(D == ConstructorDeclaration))
-      visitN(d.parameters),
-      visitS(d.funcBody);
+      visitN(d.params), visitS(d.funcBody);
     static if (is(D == StaticConstructorDeclaration) ||
                is(D == DestructorDeclaration) ||
                is(D == StaticDestructorDeclaration) ||
@@ -90,7 +89,7 @@
       d.tparams && visitN(d.tparams),
       visitD(d.decls);
     static if (is(D == NewDeclaration) || is(D == DeleteDeclaration))
-      visitN(d.parameters),
+      visitN(d.params),
       visitS(d.funcBody);
     static if (is(D == ProtectionDeclaration) ||
                is(D == StorageClassDeclaration) ||
@@ -176,7 +175,7 @@
         e.tparams && visitN(e.tparams);
       static if (is(E == FunctionLiteralExpression))
         e.returnType && visitT(e.returnType),
-        e.parameters && visitN(e.parameters),
+        e.params && visitN(e.params),
         visitS(e.funcBody);
       static if (is(E == ParenExpression))
         visitE(e.next);
@@ -308,11 +307,11 @@
         visitE(t.e), t.e2 && visitE(t.e2);
     }
     static if (is(T == FunctionType) || is(T == DelegateType))
-      visitT(t.returnType), visitN(t.parameters);
+      visitT(t.returnType), visitN(t.params);
     static if (is(T == CFuncPointerType))
       visitT(t.next), t.params && visitN(t.params);
     static if (is(T == ModuleScopeType) ||
-               is(T == BaseClass) ||
+               is(T == BaseClassType) ||
                is(T == ConstType) ||
                is(T == InvariantType))
       visitT(t.next);
@@ -372,5 +371,6 @@
 +/
 class DefaultVisitor : Visitor
 {
+  // Comment out if too many errors are shown.
   mixin(generateDefaultVisitMethods());
 }
--- a/trunk/src/dil/ast/Expressions.d	Thu Jan 17 00:21:16 2008 +0100
+++ b/trunk/src/dil/ast/Expressions.d	Thu Jan 17 19:27:46 2008 +0100
@@ -481,10 +481,10 @@
 class NewAnonClassExpression : /*Unary*/Expression
 {
   Expression[] newArgs;
-  BaseClass[] bases;
+  BaseClassType[] bases;
   Expression[] ctorArgs;
   Declarations decls;
-  this(/*Expression e, */Expression[] newArgs, BaseClass[] bases, Expression[] ctorArgs, Declarations decls)
+  this(/*Expression e, */Expression[] newArgs, BaseClassType[] bases, Expression[] ctorArgs, Declarations decls)
   {
     /*super(e);*/
     mixin(set_kind);
@@ -898,21 +898,21 @@
 class FunctionLiteralExpression : Expression
 {
   TypeNode returnType;
-  Parameters parameters;
+  Parameters params;
   FunctionBody funcBody;
 
   this()
   {
     mixin(set_kind);
     addOptChild(returnType);
-    addOptChild(parameters);
+    addOptChild(params);
     addChild(funcBody);
   }
 
-  this(TypeNode returnType, Parameters parameters, FunctionBody funcBody)
+  this(TypeNode returnType, Parameters params, FunctionBody funcBody)
   {
     this.returnType = returnType;
-    this.parameters = parameters;
+    this.params = params;
     this.funcBody = funcBody;
     this();
   }
--- a/trunk/src/dil/ast/NodesEnum.d	Thu Jan 17 00:21:16 2008 +0100
+++ b/trunk/src/dil/ast/NodesEnum.d	Thu Jan 17 19:27:46 2008 +0100
@@ -194,7 +194,7 @@
   "FunctionType",
   "DelegateType",
   "CFuncPointerType",
-  "BaseClass",
+  "BaseClassType",
   "ConstType", // D2.0
   "InvariantType", // D2.0
 
--- a/trunk/src/dil/ast/Parameters.d	Thu Jan 17 00:21:16 2008 +0100
+++ b/trunk/src/dil/ast/Parameters.d	Thu Jan 17 19:27:46 2008 +0100
@@ -14,10 +14,10 @@
 {
   StorageClass stc;
   TypeNode type;
-  Identifier* ident;
+  Identifier* name;
   Expression defValue;
 
-  this(StorageClass stc, TypeNode type, Identifier* ident, Expression defValue)
+  this(StorageClass stc, TypeNode type, Identifier* name, Expression defValue)
   {
     super(NodeCategory.Other);
     mixin(set_kind);
@@ -27,7 +27,7 @@
 
     this.stc = stc;
     this.type = type;
-    this.ident = ident;
+    this.name = name;
     this.defValue = defValue;
   }
 
@@ -41,7 +41,7 @@
   bool isOnlyVariadic()
   {
     return stc == StorageClass.Variadic &&
-           type is null && ident is null;
+           type is null && name is null;
   }
 }
 
--- a/trunk/src/dil/ast/Types.d	Thu Jan 17 00:21:16 2008 +0100
+++ b/trunk/src/dil/ast/Types.d	Thu Jan 17 19:27:46 2008 +0100
@@ -83,6 +83,7 @@
   }
 }
 
+/// char, int, float etc.
 class IntegralType : TypeNode
 {
   this(TOK tok)
@@ -92,6 +93,7 @@
   }
 }
 
+/// Identifier
 class IdentifierType : TypeNode
 {
   Identifier* ident;
@@ -103,6 +105,7 @@
   }
 }
 
+/// Type "." Type
 class QualifiedType : TypeNode
 {
   alias next left;
@@ -114,6 +117,7 @@
   }
 }
 
+/// "." Type
 class ModuleScopeType : TypeNode
 {
   this(TypeNode next)
@@ -168,20 +172,21 @@
   }
 }
 
+/// Dynamic array: T[] or
+/// Static array: T[E] or
+/// Slice array (for tuples): T[E..E] or
+/// Associative array: T[T]
 class ArrayType : TypeNode
 {
   Expression e, e2;
   TypeNode assocType;
 
-  /// Dynamic array: T[]
   this(TypeNode t)
   {
     super(TID.Array, t);
     mixin(set_kind);
   }
 
-  /// Static array: T[E] or
-  /// Slice array (for tuples): T[E..E]
   this(TypeNode t, Expression e, Expression e2)
   {
     addChild(e);
@@ -191,7 +196,6 @@
     this(t);
   }
 
-  /// Associative array: T[T]
   this(TypeNode t, TypeNode assocType)
   {
     addChild(assocType);
@@ -200,33 +204,35 @@
   }
 }
 
+/// ReturnType "function" "(" Parameters? ")"
 class FunctionType : TypeNode
 {
   TypeNode returnType;
-  Parameters parameters;
-  this(TypeNode returnType, Parameters parameters)
+  Parameters params;
+  this(TypeNode returnType, Parameters params)
   {
     super(TID.Function);
     mixin(set_kind);
     addChild(returnType);
-    addChild(parameters);
+    addChild(params);
     this.returnType = returnType;
-    this.parameters = parameters;
+    this.params = params;
   }
 }
 
+/// ReturnType "delegate" "(" Parameters? ")"
 class DelegateType : TypeNode
 {
   TypeNode returnType;
-  Parameters parameters;
-  this(TypeNode returnType, Parameters parameters)
+  Parameters params;
+  this(TypeNode returnType, Parameters params)
   {
     super(TID.Delegate);
     mixin(set_kind);
     addChild(returnType);
-    addChild(parameters);
+    addChild(params);
     this.returnType = returnType;
-    this.parameters = parameters;
+    this.params = params;
   }
 }
 
@@ -241,7 +247,8 @@
   }
 }
 
-class BaseClass : TypeNode
+/// "class" Identifier : BaseClass
+class BaseClassType : TypeNode
 {
   Protection prot;
   this(Protection prot, TypeNode type)
--- a/trunk/src/dil/parser/Parser.d	Thu Jan 17 00:21:16 2008 +0100
+++ b/trunk/src/dil/parser/Parser.d	Thu Jan 17 19:27:46 2008 +0100
@@ -1040,7 +1040,7 @@
 
     Identifier* className;
     TemplateParameters tparams;
-    BaseClass[] bases;
+    BaseClassType[] bases;
     Declarations decls;
 
     className = requireIdentifier(MSG.ExpectedClassName);
@@ -1061,7 +1061,7 @@
     return new ClassDeclaration(className, tparams, bases, decls);
   }
 
-  BaseClass[] parseBaseClasses(bool colonLeadsOff = true)
+  BaseClassType[] parseBaseClasses(bool colonLeadsOff = true)
   {
     if (colonLeadsOff)
     {
@@ -1069,7 +1069,7 @@
       nT(); // Skip colon
     }
 
-    BaseClass[] bases;
+    BaseClassType[] bases;
 
     do
     {
@@ -1089,7 +1089,7 @@
     LparseBasicType:
       auto begin = token;
       auto type = parseBasicType();
-      bases ~= set(new BaseClass(prot, type), begin);
+      bases ~= set(new BaseClassType(prot, type), begin);
     } while (skipped(T.Comma))
     return bases;
   }
@@ -1101,7 +1101,7 @@
 
     Identifier* name;
     TemplateParameters tparams;
-    BaseClass[] bases;
+    BaseClassType[] bases;
     Declarations decls;
 
     name = requireIdentifier(MSG.ExpectedInterfaceName);
@@ -3426,7 +3426,7 @@
       if (token.type == T.LParen)
         ctorArguments = parseArguments();
 
-      BaseClass[] bases = token.type != T.LBrace ? parseBaseClasses(false) : null ;
+      BaseClassType[] bases = token.type != T.LBrace ? parseBaseClasses(false) : null ;
 
       auto decls = parseDeclarationDefinitionsBody();
       return set(new NewAnonClassExpression(/*e, */newArguments, bases, ctorArguments, decls), begin);