Mercurial > projects > dil
diff trunk/src/dil/ast/Expressions.d @ 618:07946b379006
Refactored the way dot expressions are parsed.
DotExpression is a binary expression now.
Added ModuleScopeExpression.
Removed some obsolete expression classes.
Added QualifiedType and ModuleScopeType.
Removed some obsolete type node classes.
Added genAnonymousID() to IdTable.
Removed obsolete parser functions.
Improved Node.getDocComments().
Added semantic() methods to some declaration classes.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Fri, 11 Jan 2008 00:42:35 +0100 |
parents | fac9e8b258fc |
children | 2ac14bb6b84e |
line wrap: on
line diff
--- a/trunk/src/dil/ast/Expressions.d Thu Jan 10 19:47:34 2008 +0100 +++ b/trunk/src/dil/ast/Expressions.d Fri Jan 11 00:42:35 2008 +0100 @@ -374,6 +374,20 @@ } } +/// DotExpression := Expression '.' Expression +class DotExpression : BinaryExpression +{ + this(Expression left, Expression right) + { + super(left, right, null); + mixin(set_kind); + } +} + +/*++++++++++++++++++++ ++ Unary Expressions: + +++++++++++++++++++++*/ + abstract class UnaryExpression : Expression { Expression e; @@ -464,41 +478,6 @@ mixin(set_kind); } } -/+ -class DotIdExpression : UnaryExpression -{ - string ident; - this(Expression e, string ident) - { - super(e); - this.ident = ident; - } -} -+/ -/+ -class DotTemplateInstanceExpression : UnaryExpression -{ - string ident; - TemplateArguments targs; - this(Expression e, string ident, TemplateArguments targs) - { - super(e); - this.ident = ident; - this.targs = targs; - } -} -+/ -class PostDotListExpression : UnaryExpression -{ - DotListExpression dotList; - this(Expression e, DotListExpression dotList) - { - super(e); - mixin(set_kind); - addChild(dotList); - this.dotList = dotList; - } -} class CallExpression : UnaryExpression { @@ -601,12 +580,22 @@ } } -/* -class PrimaryExpression +/// Module scope operator: '.' (IdentifierExpression|TemplateInstanceExpression) +class ModuleScopeExpression : UnaryExpression { - + this(Expression e) + { + super(e); + assert(e.kind == NodeKind.IdentifierExpression || + e.kind == NodeKind.TemplateInstanceExpression + ); + mixin(set_kind); + } } -*/ + +/*++++++++++++++++++++++ ++ Primary Expressions: + +++++++++++++++++++++++*/ class IdentifierExpression : Expression { @@ -649,36 +638,6 @@ } } -/* -class IdentifierListExpression : Expression -{ - Expression[] identList; - this(Expression[] identList) - { - this.identList = identList; - } -} -*/ - -class DotExpression : Expression -{ - this() - { - mixin(set_kind); - } -} - -class DotListExpression : Expression -{ - Expression[] items; - this(Expression[] items) - { - mixin(set_kind); - addChildren(items); - this.items = items; - } -} - class TemplateInstanceExpression : Expression { Identifier* ident;