comparison sema/AstAction.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 ee202c72cd30
children 01c2c49775ef
comparison
equal deleted inserted replaced
157:bb01c1dc452a 158:57b0b4464a0b
285 Exp target = cast(Exp)exp; 285 Exp target = cast(Exp)exp;
286 Identifier target_type = identifierFromTok(id.tok); 286 Identifier target_type = identifierFromTok(id.tok);
287 return new CastExp(_cast.location, target_type, target); 287 return new CastExp(_cast.location, target_type, target);
288 } 288 }
289 289
290 ExprT 290 ExprT actOnIndexExpr(ExprT arr, ref Token lb, ExprT index, ref Token rb)
291 actOnIndexEpr(ExprT arr, ref Token lb, ExprT index, ref Token rb)
292 { 291 {
293 Exp target = cast(Exp)arr; 292 Exp target = cast(Exp)arr;
294 Exp idx = cast(Exp)index; 293 Exp idx = cast(Exp)index;
295 return new IndexExp(target, lb.location, idx, rb.location); 294 return new IndexExp(target, lb.location, idx, rb.location);
296 } 295 }
296
297 ExprT actOnNewExpr(ref Id type, ExprT[] a_args, ExprT[] c_args)
298 {
299 auto id = identifierFromTok(type.tok);
300 Exp[] _a_args = cast(Exp[])a_args;
301 Exp[] _c_args = cast(Exp[])c_args;
302 return new NewExp(id, _a_args, _c_args);
303 }
297 } 304 }
298 } 305 }
299 306