comparison dmd/ReturnStatement.d @ 63:cab4c37afb89

A bunch of implementations
author korDen
date Mon, 23 Aug 2010 16:52:24 +0400
parents 10317f0c89a5
children f708f0452e81
comparison
equal deleted inserted replaced
62:6557375aff35 63:cab4c37afb89
30 import dmd.IRState; 30 import dmd.IRState;
31 import dmd.TY; 31 import dmd.TY;
32 import dmd.WANT; 32 import dmd.WANT;
33 import dmd.VarExp; 33 import dmd.VarExp;
34 import dmd.VarDeclaration; 34 import dmd.VarDeclaration;
35 import dmd.GlobalExpressions;
35 import dmd.BE; 36 import dmd.BE;
36 import dmd.codegen.Util; 37 import dmd.codegen.Util;
37 38
38 import dmd.backend.Blockx; 39 import dmd.backend.Blockx;
39 import dmd.backend.elem; 40 import dmd.backend.elem;
349 result |= BE.BEthrow; 350 result |= BE.BEthrow;
350 351
351 return result; 352 return result;
352 } 353 }
353 354
354 Expression interpret(InterState* istate) 355 Expression interpret(InterState istate)
355 { 356 {
356 assert(false); 357 version (LOG) {
358 printf("ReturnStatement.interpret(%s)\n", exp ? exp.toChars() : "");
359 }
360 mixin(START!());
361 if (!exp)
362 return EXP_VOID_INTERPRET;
363 version (LOG) {
364 Expression e = exp.interpret(istate);
365 printf("e = %p\n", e);
366 return e;
367 } else {
368 return exp.interpret(istate);
369 }
357 } 370 }
358 371
359 int inlineCost(InlineCostState* ics) 372 int inlineCost(InlineCostState* ics)
360 { 373 {
361 // Can't handle return statements nested in if's 374 // Can't handle return statements nested in if's