Mercurial > projects > dang
diff ast/Exp.d @ 158:57b0b4464a0b
Parsing "new", putting it in AST and performs some tests on it. Eg. if the contructor exists and the params matches.
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Tue, 22 Jul 2008 00:33:58 +0200 |
parents | a14ac9e5c858 |
children | 6cb2f4201e2a |
line wrap: on
line diff
--- a/ast/Exp.d Mon Jul 21 22:14:06 2008 +0200 +++ b/ast/Exp.d Tue Jul 22 00:33:58 2008 +0200 @@ -31,6 +31,7 @@ CallExp, CastExp, StringExp, + NewExp, } abstract class Exp @@ -371,7 +372,7 @@ { auto s = target.getSymbol(); if (s !is null) - return s.findMember(child.get); + return s.findMembers(child.get)[0]; return null; } @@ -489,6 +490,25 @@ char[] str; } +class NewExp : Exp +{ + this(Identifier newType, Exp[] a_args, Exp[] c_args) + { + super(ExpType.NewExp, newType.loc); + this.newType = newType; + this.a_args = a_args; + this.c_args = c_args; + } + + override DType type() + { + return env.findType(this.newType.get); + } + + Exp[] a_args, c_args; + Identifier newType; +} + class PointerIdentifier : Identifier { this(Identifier pointerOf)