comparison dmd2/expression.h @ 1526:54b3c1394d62

Merged dmdfe 2.031.
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 07 Jul 2009 02:26:11 +0100
parents 638d16625da2
children e4f7b5d9c68a
comparison
equal deleted inserted replaced
1525:d28cd7c45267 1526:54b3c1394d62
83 void expandTuples(Expressions *exps); 83 void expandTuples(Expressions *exps);
84 FuncDeclaration *hasThis(Scope *sc); 84 FuncDeclaration *hasThis(Scope *sc);
85 Expression *fromConstInitializer(int result, Expression *e); 85 Expression *fromConstInitializer(int result, Expression *e);
86 int arrayExpressionCanThrow(Expressions *exps); 86 int arrayExpressionCanThrow(Expressions *exps);
87 87
88 struct IntRange
89 { uinteger_t imin;
90 uinteger_t imax;
91 };
92
88 struct Expression : Object 93 struct Expression : Object
89 { 94 {
90 Loc loc; // file location 95 Loc loc; // file location
91 enum TOK op; // handy to minimize use of dynamic_cast 96 enum TOK op; // handy to minimize use of dynamic_cast
92 Type *type; // !=NULL means that semantic() has been run 97 Type *type; // !=NULL means that semantic() has been run
120 virtual int isLvalue(); 125 virtual int isLvalue();
121 virtual Expression *toLvalue(Scope *sc, Expression *e); 126 virtual Expression *toLvalue(Scope *sc, Expression *e);
122 virtual Expression *modifiableLvalue(Scope *sc, Expression *e); 127 virtual Expression *modifiableLvalue(Scope *sc, Expression *e);
123 virtual Expression *implicitCastTo(Scope *sc, Type *t); 128 virtual Expression *implicitCastTo(Scope *sc, Type *t);
124 virtual MATCH implicitConvTo(Type *t); 129 virtual MATCH implicitConvTo(Type *t);
130 virtual IntRange getIntRange();
125 virtual Expression *castTo(Scope *sc, Type *t); 131 virtual Expression *castTo(Scope *sc, Type *t);
126 virtual void checkEscape(); 132 virtual void checkEscape();
127 void checkScalar(); 133 void checkScalar();
128 void checkNoBool(); 134 void checkNoBool();
129 Expression *checkIntegral(); 135 Expression *checkIntegral();
189 int equals(Object *o); 195 int equals(Object *o);
190 Expression *semantic(Scope *sc); 196 Expression *semantic(Scope *sc);
191 Expression *interpret(InterState *istate); 197 Expression *interpret(InterState *istate);
192 char *toChars(); 198 char *toChars();
193 void dump(int indent); 199 void dump(int indent);
200 IntRange getIntRange();
194 dinteger_t toInteger(); 201 dinteger_t toInteger();
195 real_t toReal(); 202 real_t toReal();
196 real_t toImaginary(); 203 real_t toImaginary();
197 complex_t toComplex(); 204 complex_t toComplex();
198 int isConst(); 205 int isConst();
556 struct TypeExp : Expression 563 struct TypeExp : Expression
557 { 564 {
558 TypeExp(Loc loc, Type *type); 565 TypeExp(Loc loc, Type *type);
559 Expression *syntaxCopy(); 566 Expression *syntaxCopy();
560 Expression *semantic(Scope *sc); 567 Expression *semantic(Scope *sc);
568 void rvalue();
561 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 569 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
562 Expression *optimize(int result); 570 Expression *optimize(int result);
563 #if IN_DMD 571 #if IN_DMD
564 elem *toElem(IRState *irs); 572 elem *toElem(IRState *irs);
565 #endif 573 #endif
1228 1236
1229 CastExp(Loc loc, Expression *e, Type *t); 1237 CastExp(Loc loc, Expression *e, Type *t);
1230 CastExp(Loc loc, Expression *e, unsigned mod); 1238 CastExp(Loc loc, Expression *e, unsigned mod);
1231 Expression *syntaxCopy(); 1239 Expression *syntaxCopy();
1232 Expression *semantic(Scope *sc); 1240 Expression *semantic(Scope *sc);
1241 MATCH implicitConvTo(Type *t);
1242 IntRange getIntRange();
1233 Expression *optimize(int result); 1243 Expression *optimize(int result);
1234 Expression *interpret(InterState *istate); 1244 Expression *interpret(InterState *istate);
1235 int checkSideEffect(int flag); 1245 int checkSideEffect(int flag);
1236 void checkEscape(); 1246 void checkEscape();
1237 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 1247 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
1332 struct CommaExp : BinExp 1342 struct CommaExp : BinExp
1333 { 1343 {
1334 CommaExp(Loc loc, Expression *e1, Expression *e2); 1344 CommaExp(Loc loc, Expression *e1, Expression *e2);
1335 Expression *semantic(Scope *sc); 1345 Expression *semantic(Scope *sc);
1336 void checkEscape(); 1346 void checkEscape();
1347 IntRange getIntRange();
1337 int isLvalue(); 1348 int isLvalue();
1338 Expression *toLvalue(Scope *sc, Expression *e); 1349 Expression *toLvalue(Scope *sc, Expression *e);
1339 Expression *modifiableLvalue(Scope *sc, Expression *e); 1350 Expression *modifiableLvalue(Scope *sc, Expression *e);
1340 int isBool(int result); 1351 int isBool(int result);
1341 int checkSideEffect(int flag); 1352 int checkSideEffect(int flag);
1353 MATCH implicitConvTo(Type *t);
1354 Expression *castTo(Scope *sc, Type *t);
1342 Expression *optimize(int result); 1355 Expression *optimize(int result);
1343 Expression *interpret(InterState *istate); 1356 Expression *interpret(InterState *istate);
1344 #if IN_DMD 1357 #if IN_DMD
1345 elem *toElem(IRState *irs); 1358 elem *toElem(IRState *irs);
1346 #endif 1359 #endif
1550 Expression *semantic(Scope *sc); 1563 Expression *semantic(Scope *sc);
1551 Expression *optimize(int result); 1564 Expression *optimize(int result);
1552 Expression *interpret(InterState *istate); 1565 Expression *interpret(InterState *istate);
1553 void buildArrayIdent(OutBuffer *buf, Expressions *arguments); 1566 void buildArrayIdent(OutBuffer *buf, Expressions *arguments);
1554 Expression *buildArrayLoop(Arguments *fparams); 1567 Expression *buildArrayLoop(Arguments *fparams);
1568 IntRange getIntRange();
1555 1569
1556 // For operator overloading 1570 // For operator overloading
1557 Identifier *opId(); 1571 Identifier *opId();
1558 Identifier *opId_r(); 1572 Identifier *opId_r();
1559 1573
1592 { 1606 {
1593 ShlExp(Loc loc, Expression *e1, Expression *e2); 1607 ShlExp(Loc loc, Expression *e1, Expression *e2);
1594 Expression *semantic(Scope *sc); 1608 Expression *semantic(Scope *sc);
1595 Expression *optimize(int result); 1609 Expression *optimize(int result);
1596 Expression *interpret(InterState *istate); 1610 Expression *interpret(InterState *istate);
1611 IntRange getIntRange();
1597 1612
1598 // For operator overloading 1613 // For operator overloading
1599 Identifier *opId(); 1614 Identifier *opId();
1600 Identifier *opId_r(); 1615 Identifier *opId_r();
1601 1616
1612 { 1627 {
1613 ShrExp(Loc loc, Expression *e1, Expression *e2); 1628 ShrExp(Loc loc, Expression *e1, Expression *e2);
1614 Expression *semantic(Scope *sc); 1629 Expression *semantic(Scope *sc);
1615 Expression *optimize(int result); 1630 Expression *optimize(int result);
1616 Expression *interpret(InterState *istate); 1631 Expression *interpret(InterState *istate);
1632 IntRange getIntRange();
1617 1633
1618 // For operator overloading 1634 // For operator overloading
1619 Identifier *opId(); 1635 Identifier *opId();
1620 Identifier *opId_r(); 1636 Identifier *opId_r();
1621 1637
1632 { 1648 {
1633 UshrExp(Loc loc, Expression *e1, Expression *e2); 1649 UshrExp(Loc loc, Expression *e1, Expression *e2);
1634 Expression *semantic(Scope *sc); 1650 Expression *semantic(Scope *sc);
1635 Expression *optimize(int result); 1651 Expression *optimize(int result);
1636 Expression *interpret(InterState *istate); 1652 Expression *interpret(InterState *istate);
1653 IntRange getIntRange();
1637 1654
1638 // For operator overloading 1655 // For operator overloading
1639 Identifier *opId(); 1656 Identifier *opId();
1640 Identifier *opId_r(); 1657 Identifier *opId_r();
1641 1658
1654 Expression *semantic(Scope *sc); 1671 Expression *semantic(Scope *sc);
1655 Expression *optimize(int result); 1672 Expression *optimize(int result);
1656 Expression *interpret(InterState *istate); 1673 Expression *interpret(InterState *istate);
1657 void buildArrayIdent(OutBuffer *buf, Expressions *arguments); 1674 void buildArrayIdent(OutBuffer *buf, Expressions *arguments);
1658 Expression *buildArrayLoop(Arguments *fparams); 1675 Expression *buildArrayLoop(Arguments *fparams);
1676 IntRange getIntRange();
1659 1677
1660 // For operator overloading 1678 // For operator overloading
1661 int isCommutative(); 1679 int isCommutative();
1662 Identifier *opId(); 1680 Identifier *opId();
1663 Identifier *opId_r(); 1681 Identifier *opId_r();
1677 Expression *semantic(Scope *sc); 1695 Expression *semantic(Scope *sc);
1678 Expression *optimize(int result); 1696 Expression *optimize(int result);
1679 Expression *interpret(InterState *istate); 1697 Expression *interpret(InterState *istate);
1680 void buildArrayIdent(OutBuffer *buf, Expressions *arguments); 1698 void buildArrayIdent(OutBuffer *buf, Expressions *arguments);
1681 Expression *buildArrayLoop(Arguments *fparams); 1699 Expression *buildArrayLoop(Arguments *fparams);
1700 MATCH implicitConvTo(Type *t);
1701 IntRange getIntRange();
1682 1702
1683 // For operator overloading 1703 // For operator overloading
1684 int isCommutative(); 1704 int isCommutative();
1685 Identifier *opId(); 1705 Identifier *opId();
1686 Identifier *opId_r(); 1706 Identifier *opId_r();
1700 Expression *semantic(Scope *sc); 1720 Expression *semantic(Scope *sc);
1701 Expression *optimize(int result); 1721 Expression *optimize(int result);
1702 Expression *interpret(InterState *istate); 1722 Expression *interpret(InterState *istate);
1703 void buildArrayIdent(OutBuffer *buf, Expressions *arguments); 1723 void buildArrayIdent(OutBuffer *buf, Expressions *arguments);
1704 Expression *buildArrayLoop(Arguments *fparams); 1724 Expression *buildArrayLoop(Arguments *fparams);
1725 MATCH implicitConvTo(Type *t);
1726 IntRange getIntRange();
1705 1727
1706 // For operator overloading 1728 // For operator overloading
1707 int isCommutative(); 1729 int isCommutative();
1708 Identifier *opId(); 1730 Identifier *opId();
1709 Identifier *opId_r(); 1731 Identifier *opId_r();