comparison dmd/interpret.c @ 1367:8026319762be

Merged DMD 1.045 !!!
author Tomas Lindquist Olsen <tomas.l.olsen gmail com>
date Sat, 16 May 2009 22:21:31 +0200
parents 7c6dcb98ac35
children def7a1d494fd
comparison
equal deleted inserted replaced
1366:81121ac19f61 1367:8026319762be
67 else if (ident == Id::aaKeys) 67 else if (ident == Id::aaKeys)
68 return interpret_aaKeys(istate, arguments); 68 return interpret_aaKeys(istate, arguments);
69 else if (ident == Id::aaValues) 69 else if (ident == Id::aaValues)
70 return interpret_aaValues(istate, arguments); 70 return interpret_aaValues(istate, arguments);
71 71
72 if (cantInterpret || semanticRun == 1) 72 if (cantInterpret || semanticRun == 3)
73 return NULL; 73 return NULL;
74 74
75 if (needThis() || isNested() || !fbody) 75 if (needThis() || isNested() || !fbody)
76 { cantInterpret = 1; 76 { cantInterpret = 1;
77 return NULL; 77 return NULL;
78 } 78 }
79 79
80 if (semanticRun == 0 && scope) 80 if (semanticRun < 3 && scope)
81 { 81 {
82 semantic3(scope); 82 semantic3(scope);
83 if (global.errors) // if errors compiling this function 83 if (global.errors) // if errors compiling this function
84 return NULL; 84 return NULL;
85 } 85 }
86 if (semanticRun < 2) 86 if (semanticRun < 4)
87 return NULL; 87 return NULL;
88 88
89 Type *tb = type->toBasetype(); 89 Type *tb = type->toBasetype();
90 assert(tb->ty == Tfunction); 90 assert(tb->ty == Tfunction);
91 TypeFunction *tf = (TypeFunction *)tb; 91 TypeFunction *tf = (TypeFunction *)tb;
1522 if (v->isDataseg()) 1522 if (v->isDataseg())
1523 return EXP_CANT_INTERPRET; 1523 return EXP_CANT_INTERPRET;
1524 if (fp && !v->value) 1524 if (fp && !v->value)
1525 { error("variable %s is used before initialization", v->toChars()); 1525 { error("variable %s is used before initialization", v->toChars());
1526 return e; 1526 return e;
1527 }
1528 if (v->value == NULL && v->init->isVoidInitializer())
1529 { /* Since a void initializer initializes to undefined
1530 * values, it is valid here to use the default initializer.
1531 * No attempt is made to determine if someone actually relies
1532 * on the void value - to do that we'd need a VoidExp.
1533 * That's probably a good enhancement idea.
1534 */
1535 v->value = v->type->defaultInit();
1527 } 1536 }
1528 Expression *vie = v->value; 1537 Expression *vie = v->value;
1529 if (vie->op == TOKvar) 1538 if (vie->op == TOKvar)
1530 { 1539 {
1531 Declaration *d = ((VarExp *)vie)->var; 1540 Declaration *d = ((VarExp *)vie)->var;