comparison dmd/expression.h @ 1587:def7a1d494fd

Merge DMD 1.051
author Christian Kamm <kamm incasoftware de>
date Fri, 06 Nov 2009 23:58:01 +0100
parents df11cdec45a2
children 207a8a438dea
comparison
equal deleted inserted replaced
1586:7f728c52e63c 1587:def7a1d494fd
79 void expandTuples(Expressions *exps); 79 void expandTuples(Expressions *exps);
80 FuncDeclaration *hasThis(Scope *sc); 80 FuncDeclaration *hasThis(Scope *sc);
81 Expression *fromConstInitializer(int result, Expression *e); 81 Expression *fromConstInitializer(int result, Expression *e);
82 int arrayExpressionCanThrow(Expressions *exps); 82 int arrayExpressionCanThrow(Expressions *exps);
83 83
84 struct IntRange
85 { uinteger_t imin;
86 uinteger_t imax;
87 };
88
84 struct Expression : Object 89 struct Expression : Object
85 { 90 {
86 Loc loc; // file location 91 Loc loc; // file location
87 enum TOK op; // handy to minimize use of dynamic_cast 92 enum TOK op; // handy to minimize use of dynamic_cast
88 Type *type; // !=NULL means that semantic() has been run 93 Type *type; // !=NULL means that semantic() has been run
155 virtual Identifier *opId_r(); 160 virtual Identifier *opId_r();
156 161
157 // For array ops 162 // For array ops
158 virtual void buildArrayIdent(OutBuffer *buf, Expressions *arguments); 163 virtual void buildArrayIdent(OutBuffer *buf, Expressions *arguments);
159 virtual Expression *buildArrayLoop(Arguments *fparams); 164 virtual Expression *buildArrayLoop(Arguments *fparams);
165 int isArrayOperand();
160 166
161 #if IN_DMD 167 #if IN_DMD
162 // Back end 168 // Back end
163 virtual elem *toElem(IRState *irs); 169 virtual elem *toElem(IRState *irs);
164 virtual dt_t **toDt(dt_t **pdt); 170 virtual dt_t **toDt(dt_t **pdt);
289 }; 295 };
290 296
291 struct DsymbolExp : Expression 297 struct DsymbolExp : Expression
292 { 298 {
293 Dsymbol *s; 299 Dsymbol *s;
300 int hasOverloads;
294 301
295 DsymbolExp(Loc loc, Dsymbol *s); 302 DsymbolExp(Loc loc, Dsymbol *s);
296 Expression *semantic(Scope *sc); 303 Expression *semantic(Scope *sc);
297 char *toChars(); 304 char *toChars();
298 void dump(int indent); 305 void dump(int indent);
304 { 311 {
305 Declaration *var; 312 Declaration *var;
306 313
307 ThisExp(Loc loc); 314 ThisExp(Loc loc);
308 Expression *semantic(Scope *sc); 315 Expression *semantic(Scope *sc);
316 Expression *interpret(InterState *istate);
309 int isBool(int result); 317 int isBool(int result);
310 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 318 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
311 Expression *toLvalue(Scope *sc, Expression *e); 319 Expression *toLvalue(Scope *sc, Expression *e);
312 void scanForNestedRef(Scope *sc); 320 void scanForNestedRef(Scope *sc);
313 321
341 unsigned char committed; // !=0 if type is committed 349 unsigned char committed; // !=0 if type is committed
342 350
343 NullExp(Loc loc); 351 NullExp(Loc loc);
344 Expression *semantic(Scope *sc); 352 Expression *semantic(Scope *sc);
345 int isBool(int result); 353 int isBool(int result);
354 int isConst();
346 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 355 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
347 void toMangleBuffer(OutBuffer *buf); 356 void toMangleBuffer(OutBuffer *buf);
348 MATCH implicitConvTo(Type *t); 357 MATCH implicitConvTo(Type *t);
349 Expression *castTo(Scope *sc, Type *t); 358 Expression *castTo(Scope *sc, Type *t);
350 Expression *interpret(InterState *istate); 359 Expression *interpret(InterState *istate);
589 598
590 NewExp(Loc loc, Expression *thisexp, Expressions *newargs, 599 NewExp(Loc loc, Expression *thisexp, Expressions *newargs,
591 Type *newtype, Expressions *arguments); 600 Type *newtype, Expressions *arguments);
592 Expression *syntaxCopy(); 601 Expression *syntaxCopy();
593 Expression *semantic(Scope *sc); 602 Expression *semantic(Scope *sc);
603 Expression *optimize(int result);
594 #if IN_DMD 604 #if IN_DMD
595 elem *toElem(IRState *irs); 605 elem *toElem(IRState *irs);
596 #endif 606 #endif
597 int checkSideEffect(int flag); 607 int checkSideEffect(int flag);
598 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 608 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
840 Expression *semantic(Scope *sc); 850 Expression *semantic(Scope *sc);
841 Expression *semanticp(Scope *sc); 851 Expression *semanticp(Scope *sc);
842 Expression *commonSemanticAssign(Scope *sc); 852 Expression *commonSemanticAssign(Scope *sc);
843 Expression *commonSemanticAssignIntegral(Scope *sc); 853 Expression *commonSemanticAssignIntegral(Scope *sc);
844 int checkSideEffect(int flag); 854 int checkSideEffect(int flag);
855 void checkComplexMulAssign();
856 void checkComplexAddAssign();
845 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 857 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
846 Expression *scaleFactor(Scope *sc); 858 Expression *scaleFactor(Scope *sc);
847 Expression *typeCombine(Scope *sc); 859 Expression *typeCombine(Scope *sc);
848 Expression *optimize(int result); 860 Expression *optimize(int result);
849 int isunsigned(); 861 int isunsigned();
1020 #if IN_DMD 1032 #if IN_DMD
1021 elem *toElem(IRState *irs); 1033 elem *toElem(IRState *irs);
1022 #endif 1034 #endif
1023 void scanForNestedRef(Scope *sc); 1035 void scanForNestedRef(Scope *sc);
1024 Expression *toLvalue(Scope *sc, Expression *e); 1036 Expression *toLvalue(Scope *sc, Expression *e);
1037 Expression *modifiableLvalue(Scope *sc, Expression *e);
1025 1038
1026 int inlineCost(InlineCostState *ics); 1039 int inlineCost(InlineCostState *ics);
1027 Expression *doInline(InlineDoState *ids); 1040 Expression *doInline(InlineDoState *ids);
1028 Expression *inlineScan(InlineScanState *iss); 1041 Expression *inlineScan(InlineScanState *iss);
1029 1042
1180 Expression *optimize(int result); 1193 Expression *optimize(int result);
1181 Expression *interpret(InterState *istate); 1194 Expression *interpret(InterState *istate);
1182 int checkSideEffect(int flag); 1195 int checkSideEffect(int flag);
1183 void checkEscape(); 1196 void checkEscape();
1184 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 1197 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
1198 void buildArrayIdent(OutBuffer *buf, Expressions *arguments);
1199 Expression *buildArrayLoop(Arguments *fparams);
1185 #if IN_DMD 1200 #if IN_DMD
1186 elem *toElem(IRState *irs); 1201 elem *toElem(IRState *irs);
1187 #endif 1202 #endif
1188 1203
1189 // For operator overloading 1204 // For operator overloading