# HG changeset patch # User Aziz K?ksal # Date 1197577421 -3600 # Node ID aa73f669c2986e96a906fdd93ea1609401547a3d # Parent dd3ce87b35690d06397e0b11cca5b4967587a50a Renamed class Type to TypeNode. diff -r dd3ce87b3569 -r aa73f669c298 trunk/src/dil/Declarations.d --- a/trunk/src/dil/Declarations.d Thu Dec 13 18:45:29 2007 +0100 +++ b/trunk/src/dil/Declarations.d Thu Dec 13 21:23:41 2007 +0100 @@ -210,9 +210,9 @@ class EnumDeclaration : Declaration { Identifier* name; - Type baseType; + TypeNode baseType; EnumMember[] members; - this(Identifier* name, Type baseType, EnumMember[] members, bool hasBody) + this(Identifier* name, TypeNode baseType, EnumMember[] members, bool hasBody) { super.hasBody = hasBody; mixin(set_kind); @@ -381,13 +381,13 @@ class FunctionDeclaration : Declaration { - Type returnType; + TypeNode returnType; Identifier* funcName; TemplateParameters tparams; Parameters params; FunctionBody funcBody; LinkageType linkageType; - this(Type returnType, Identifier* funcName, TemplateParameters tparams, + this(TypeNode returnType, Identifier* funcName, TemplateParameters tparams, Parameters params, FunctionBody funcBody) { super.hasBody = funcBody.funcBody !is null; @@ -412,11 +412,11 @@ class VariableDeclaration : Declaration { - Type type; + TypeNode type; Identifier*[] idents; Expression[] values; LinkageType linkageType; - this(Type type, Identifier*[] idents, Expression[] values) + this(TypeNode type, Identifier*[] idents, Expression[] values) { mixin(set_kind); addOptChild(type); diff -r dd3ce87b3569 -r aa73f669c298 trunk/src/dil/Expressions.d --- a/trunk/src/dil/Expressions.d Thu Dec 13 18:45:29 2007 +0100 +++ b/trunk/src/dil/Expressions.d Thu Dec 13 21:23:41 2007 +0100 @@ -488,9 +488,9 @@ class NewExpression : /*Unary*/Expression { Expression[] newArgs; - Type type; + TypeNode type; Expression[] ctorArgs; - this(/*Expression e, */Expression[] newArgs, Type type, Expression[] ctorArgs) + this(/*Expression e, */Expression[] newArgs, TypeNode type, Expression[] ctorArgs) { /*super(e);*/ mixin(set_kind); @@ -536,8 +536,8 @@ class CastExpression : UnaryExpression { - Type type; - this(Expression e, Type type) + TypeNode type; + this(Expression e, TypeNode type) { addChild(type); // Add type before super(). super(e); @@ -816,8 +816,8 @@ class TypeofExpression : Expression { - Type type; - this(Type type) + TypeNode type; + this(TypeNode type) { mixin(set_kind); addChild(type); @@ -827,9 +827,9 @@ class TypeDotIdExpression : Expression { - Type type; + TypeNode type; Identifier* ident; - this(Type type, Identifier* ident) + this(TypeNode type, Identifier* ident) { mixin(set_kind); addChild(type); @@ -840,8 +840,8 @@ class TypeidExpression : Expression { - Type type; - this(Type type) + TypeNode type; + this(TypeNode type) { mixin(set_kind); addChild(type); @@ -851,13 +851,13 @@ class IsExpression : Expression { - Type type; + TypeNode type; Identifier* ident; Token* opTok, specTok; - Type specType; + TypeNode specType; TemplateParameters tparams; // D 2.0 - this(Type type, Identifier* ident, Token* opTok, Token* specTok, - Type specType, typeof(tparams) tparams) + this(TypeNode type, Identifier* ident, Token* opTok, Token* specTok, + TypeNode specType, typeof(tparams) tparams) { mixin(set_kind); addChild(type); @@ -875,7 +875,7 @@ class FunctionLiteralExpression : Expression { - Type returnType; + TypeNode returnType; Parameters parameters; FunctionBody funcBody; @@ -887,7 +887,7 @@ addChild(funcBody); } - this(Type returnType, Parameters parameters, FunctionBody funcBody) + this(TypeNode returnType, Parameters parameters, FunctionBody funcBody) { this.returnType = returnType; this.parameters = parameters; diff -r dd3ce87b3569 -r aa73f669c298 trunk/src/dil/Parser.d --- a/trunk/src/dil/Parser.d Thu Dec 13 18:45:29 2007 +0100 +++ b/trunk/src/dil/Parser.d Thu Dec 13 21:23:41 2007 +0100 @@ -37,7 +37,14 @@ uint alignSize = DEFAULT_ALIGN_SIZE; private alias TOK T; - + private alias TypeNode Type; + + /++ + Construct a Parser object. + Params: + text = the UTF-8 source code. + filePath = the path to the source code; used for error messages. + +/ this(char[] srcText, string filePath, InformationManager infoMan = null) { lx = new Lexer(srcText, filePath); diff -r dd3ce87b3569 -r aa73f669c298 trunk/src/dil/Types.d --- a/trunk/src/dil/Types.d Thu Dec 13 18:45:29 2007 +0100 +++ b/trunk/src/dil/Types.d Thu Dec 13 21:23:41 2007 +0100 @@ -13,22 +13,22 @@ { StorageClass stc; Token* stcTok; - Type type; + TypeNode type; Identifier* ident; - Expression assignExpr; + Expression defValue; - this(StorageClass stc, Type type, Identifier* ident, Expression assignExpr) + this(StorageClass stc, TypeNode type, Identifier* ident, Expression defValue) { super(NodeCategory.Other); mixin(set_kind); // type can be null when param in foreach statement addOptChild(type); - addOptChild(assignExpr); + addOptChild(defValue); this.stc = stc; this.type = type; this.ident = ident; - this.assignExpr = assignExpr; + this.defValue = defValue; } /// func(...) or func(int[] values ...) @@ -73,8 +73,8 @@ class BaseClass : Node { Protection prot; - Type type; - this(Protection prot, Type type) + TypeNode type; + this(Protection prot, TypeNode type) { super(NodeCategory.Other); mixin(set_kind); @@ -96,8 +96,8 @@ class TemplateAliasParameter : TemplateParameter { - Type specType, defType; - this(Identifier* ident, Type specType, Type defType) + TypeNode specType, defType; + this(Identifier* ident, TypeNode specType, TypeNode defType) { super(ident); mixin(set_kind); @@ -111,8 +111,8 @@ class TemplateTypeParameter : TemplateParameter { - Type specType, defType; - this(Identifier* ident, Type specType, Type defType) + TypeNode specType, defType; + this(Identifier* ident, TypeNode specType, TypeNode defType) { super(ident); mixin(set_kind); @@ -128,8 +128,8 @@ { class TemplateThisParameter : TemplateParameter { - Type specType, defType; - this(Identifier* ident, Type specType, Type defType) + TypeNode specType, defType; + this(Identifier* ident, TypeNode specType, TypeNode defType) { super(ident); mixin(set_kind); @@ -144,9 +144,9 @@ class TemplateValueParameter : TemplateParameter { - Type valueType; + TypeNode valueType; Expression specValue, defValue; - this(Type valueType, Identifier* ident, Expression specValue, Expression defValue) + this(TypeNode valueType, Identifier* ident, Expression specValue, Expression defValue) { super(ident); mixin(set_kind); @@ -227,6 +227,7 @@ Cfloat = TOK.Cfloat, Cdouble = TOK.Cdouble, Creal = TOK.Creal, + Ucent = TOK.Ucent, Undefined, Function, @@ -243,17 +244,17 @@ Invariant, // D2 } -abstract class Type : Node +abstract class TypeNode : Node { TID tid; - Type next; + TypeNode next; this(TID tid) { this(tid, null); } - this(TID tid, Type next) + this(TID tid, TypeNode next) { super(NodeCategory.Type); addOptChild(next); @@ -262,7 +263,7 @@ } } -class IntegralType : Type +class IntegralType : TypeNode { this(TOK tok) { @@ -271,7 +272,7 @@ } } -class UndefinedType : Type +class UndefinedType : TypeNode { this() { @@ -280,10 +281,10 @@ } } -class DotListType : Type +class DotListType : TypeNode { - Type[] dotList; - this(Type[] dotList) + TypeNode[] dotList; + this(TypeNode[] dotList) { super(TID.DotList); mixin(set_kind); @@ -292,7 +293,7 @@ } } -class IdentifierType : Type +class IdentifierType : TypeNode { Identifier* ident; this(Identifier* ident) @@ -303,7 +304,7 @@ } } -class DotType : Type +class DotType : TypeNode { this() { @@ -312,7 +313,7 @@ } } -class TypeofType : Type +class TypeofType : TypeNode { Expression e; this(Expression e) @@ -334,7 +335,7 @@ } } -class TemplateInstanceType : Type +class TemplateInstanceType : TypeNode { Identifier* ident; TemplateArguments targs; @@ -348,27 +349,27 @@ } } -class PointerType : Type +class PointerType : TypeNode { - this(Type t) + this(TypeNode t) { super(TID.Pointer, t); mixin(set_kind); } } -class ArrayType : Type +class ArrayType : TypeNode { Expression e, e2; - Type assocType; + TypeNode assocType; - this(Type t) + this(TypeNode t) { super(TID.Array, t); mixin(set_kind); } - this(Type t, Expression e, Expression e2) + this(TypeNode t, Expression e, Expression e2) { addChild(e); addOptChild(e2); @@ -377,7 +378,7 @@ this(t); } - this(Type t, Type assocType) + this(TypeNode t, TypeNode assocType) { addChild(assocType); this.assocType = assocType; @@ -385,11 +386,11 @@ } } -class FunctionType : Type +class FunctionType : TypeNode { - Type returnType; + TypeNode returnType; Parameters parameters; - this(Type returnType, Parameters parameters) + this(TypeNode returnType, Parameters parameters) { super(TID.Function); mixin(set_kind); @@ -400,11 +401,11 @@ } } -class DelegateType : Type +class DelegateType : TypeNode { - Type returnType; + TypeNode returnType; Parameters parameters; - this(Type returnType, Parameters parameters) + this(TypeNode returnType, Parameters parameters) { super(TID.Delegate); mixin(set_kind); @@ -415,10 +416,10 @@ } } -class CFuncPointerType : Type +class CFuncPointerType : TypeNode { Parameters params; - this(Type type, Parameters params) + this(TypeNode type, Parameters params) { super(TID.CFuncPointer, type); mixin(set_kind); @@ -428,9 +429,9 @@ version(D2) { -class ConstType : Type +class ConstType : TypeNode { - this(Type t) + this(TypeNode t) { // If t is null: cast(const) super(TID.Const, t); @@ -438,9 +439,9 @@ } } -class InvariantType : Type +class InvariantType : TypeNode { - this(Type t) + this(TypeNode t) { // If t is null: cast(invariant) super(TID.Invariant, t);