comparison dmd2/mtype.h @ 1577:e4f7b5d9c68a

DMD 2.032 Merge.
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 08 Sep 2009 10:07:56 +0100
parents 54b3c1394d62
children
comparison
equal deleted inserted replaced
1576:4551475bc6b6 1577:e4f7b5d9c68a
58 #endif 58 #endif
59 59
60 60
61 enum ENUMTY 61 enum ENUMTY
62 { 62 {
63 Tarray, // dynamic array 63 Tarray, // slice array, aka T[]
64 Tsarray, // static array 64 Tsarray, // static array, aka T[dimension]
65 Taarray, // associative array 65 Tnarray, // resizable array, aka T[new]
66 Taarray, // associative array, aka T[type]
66 Tpointer, 67 Tpointer,
67 Treference, 68 Treference,
68 Tfunction, 69 Tfunction,
69 Tident, 70 Tident,
70 Tclass, 71 Tclass,
126 #define MODconst 1 // type is const 127 #define MODconst 1 // type is const
127 #define MODinvariant 4 // type is invariant 128 #define MODinvariant 4 // type is invariant
128 #define MODshared 2 // type is shared 129 #define MODshared 2 // type is shared
129 char *deco; 130 char *deco;
130 131
131 /* Note that there is no "shared immutable", because that is just immutable 132 /* These are cached values that are lazily evaluated by constOf(), invariantOf(), etc.
133 * They should not be referenced by anybody but mtype.c.
134 * They can be NULL if not lazily evaluated yet.
135 * Note that there is no "shared immutable", because that is just immutable
132 */ 136 */
133 137
134 Type *cto; // MODconst ? mutable version of this type : const version 138 Type *cto; // MODconst ? mutable version of this type : const version
135 Type *ito; // MODinvariant ? mutable version of this type : invariant version 139 Type *ito; // MODinvariant ? mutable version of this type : invariant version
136 Type *sto; // MODshared ? mutable version of this type : shared mutable version 140 Type *sto; // MODshared ? mutable version of this type : shared mutable version
240 Type *merge(); 244 Type *merge();
241 Type *merge2(); 245 Type *merge2();
242 virtual void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); 246 virtual void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
243 virtual void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); 247 virtual void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod);
244 void toCBuffer3(OutBuffer *buf, HdrGenState *hgs, int mod); 248 void toCBuffer3(OutBuffer *buf, HdrGenState *hgs, int mod);
245 #if POSIX 249 void modToBuffer(OutBuffer *buf);
250 #if CPP_MANGLE
246 virtual void toCppMangle(OutBuffer *buf, CppMangleState *cms); 251 virtual void toCppMangle(OutBuffer *buf, CppMangleState *cms);
247 #endif 252 #endif
248 virtual int isintegral(); 253 virtual int isintegral();
249 virtual int isfloating(); // real, imaginary, or complex 254 virtual int isfloating(); // real, imaginary, or complex
250 virtual int isreal(); 255 virtual int isreal();
357 unsigned alignsize(); 362 unsigned alignsize();
358 Expression *getProperty(Loc loc, Identifier *ident); 363 Expression *getProperty(Loc loc, Identifier *ident);
359 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); 364 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
360 char *toChars(); 365 char *toChars();
361 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); 366 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod);
362 #if POSIX 367 #if CPP_MANGLE
363 void toCppMangle(OutBuffer *buf, CppMangleState *cms); 368 void toCppMangle(OutBuffer *buf, CppMangleState *cms);
364 #endif 369 #endif
365 int isintegral(); 370 int isintegral();
366 int isbit(); 371 int isbit();
367 int isfloating(); 372 int isfloating();
411 #endif 416 #endif
412 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); 417 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
413 TypeInfoDeclaration *getTypeInfoDeclaration(); 418 TypeInfoDeclaration *getTypeInfoDeclaration();
414 Expression *toExpression(); 419 Expression *toExpression();
415 int hasPointers(); 420 int hasPointers();
416 #if POSIX 421 #if CPP_MANGLE
417 void toCppMangle(OutBuffer *buf, CppMangleState *cms); 422 void toCppMangle(OutBuffer *buf, CppMangleState *cms);
418 #endif 423 #endif
419 424
420 #if IN_DMD 425 #if IN_DMD
421 type *toCtype(); 426 type *toCtype();
441 Expression *defaultInit(Loc loc); 446 Expression *defaultInit(Loc loc);
442 int builtinTypeInfo(); 447 int builtinTypeInfo();
443 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); 448 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
444 TypeInfoDeclaration *getTypeInfoDeclaration(); 449 TypeInfoDeclaration *getTypeInfoDeclaration();
445 int hasPointers(); 450 int hasPointers();
446 #if POSIX 451 #if CPP_MANGLE
447 void toCppMangle(OutBuffer *buf, CppMangleState *cms); 452 void toCppMangle(OutBuffer *buf, CppMangleState *cms);
448 #endif 453 #endif
449 454
450 #if IN_DMD 455 #if IN_DMD
451 type *toCtype(); 456 type *toCtype();
470 int checkBoolean(); 475 int checkBoolean();
471 TypeInfoDeclaration *getTypeInfoDeclaration(); 476 TypeInfoDeclaration *getTypeInfoDeclaration();
472 int hasPointers(); 477 int hasPointers();
473 MATCH implicitConvTo(Type *to); 478 MATCH implicitConvTo(Type *to);
474 MATCH constConv(Type *to); 479 MATCH constConv(Type *to);
475 #if POSIX 480 #if CPP_MANGLE
476 void toCppMangle(OutBuffer *buf, CppMangleState *cms); 481 void toCppMangle(OutBuffer *buf, CppMangleState *cms);
477 #endif 482 #endif
478 483
479 #if IN_DMD 484 #if IN_DMD
480 // Back end 485 // Back end
498 Expression *defaultInit(Loc loc); 503 Expression *defaultInit(Loc loc);
499 int isZeroInit(Loc loc); 504 int isZeroInit(Loc loc);
500 TypeInfoDeclaration *getTypeInfoDeclaration(); 505 TypeInfoDeclaration *getTypeInfoDeclaration();
501 int hasPointers(); 506 int hasPointers();
502 507
503 #if POSIX 508 #if CPP_MANGLE
504 void toCppMangle(OutBuffer *buf, CppMangleState *cms); 509 void toCppMangle(OutBuffer *buf, CppMangleState *cms);
505 #endif 510 #endif
506 511
507 #if IN_DMD 512 #if IN_DMD
508 type *toCtype(); 513 type *toCtype();
517 d_uns64 size(Loc loc); 522 d_uns64 size(Loc loc);
518 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); 523 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod);
519 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); 524 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
520 Expression *defaultInit(Loc loc); 525 Expression *defaultInit(Loc loc);
521 int isZeroInit(Loc loc); 526 int isZeroInit(Loc loc);
522 #if POSIX 527 #if CPP_MANGLE
523 void toCppMangle(OutBuffer *buf, CppMangleState *cms); 528 void toCppMangle(OutBuffer *buf, CppMangleState *cms);
524 #endif 529 #endif
525 }; 530 };
526 531
527 enum RET 532 enum RET
537 Arguments *parameters; // function parameters 542 Arguments *parameters; // function parameters
538 int varargs; // 1: T t, ...) style for variable number of arguments 543 int varargs; // 1: T t, ...) style for variable number of arguments
539 // 2: T t ...) style for variable number of arguments 544 // 2: T t ...) style for variable number of arguments
540 bool isnothrow; // true: nothrow 545 bool isnothrow; // true: nothrow
541 bool ispure; // true: pure 546 bool ispure; // true: pure
547 bool isproperty; // can be called without parentheses
542 bool isref; // true: returns a reference 548 bool isref; // true: returns a reference
543 enum LINK linkage; // calling convention 549 enum LINK linkage; // calling convention
544 550
545 int inuse; 551 int inuse;
546 552
551 void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); 557 void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
552 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); 558 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod);
553 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); 559 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
554 TypeInfoDeclaration *getTypeInfoDeclaration(); 560 TypeInfoDeclaration *getTypeInfoDeclaration();
555 Type *reliesOnTident(); 561 Type *reliesOnTident();
556 #if POSIX 562 #if CPP_MANGLE
557 void toCppMangle(OutBuffer *buf, CppMangleState *cms); 563 void toCppMangle(OutBuffer *buf, CppMangleState *cms);
558 #endif 564 #endif
559 bool parameterEscapes(Argument *p); 565 bool parameterEscapes(Argument *p);
560 566
561 int callMatch(Expression *ethis, Expressions *toargs); 567 int callMatch(Expression *ethis, Expressions *toargs);
589 int isZeroInit(Loc loc); 595 int isZeroInit(Loc loc);
590 int checkBoolean(); 596 int checkBoolean();
591 TypeInfoDeclaration *getTypeInfoDeclaration(); 597 TypeInfoDeclaration *getTypeInfoDeclaration();
592 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); 598 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
593 int hasPointers(); 599 int hasPointers();
594 #if POSIX 600 #if CPP_MANGLE
595 void toCppMangle(OutBuffer *buf, CppMangleState *cms); 601 void toCppMangle(OutBuffer *buf, CppMangleState *cms);
596 #endif 602 #endif
597 603
598 #if IN_DMD 604 #if IN_DMD
599 type *toCtype(); 605 type *toCtype();
695 TypeInfoDeclaration *getTypeInfoDeclaration(); 701 TypeInfoDeclaration *getTypeInfoDeclaration();
696 int hasPointers(); 702 int hasPointers();
697 MATCH implicitConvTo(Type *to); 703 MATCH implicitConvTo(Type *to);
698 MATCH constConv(Type *to); 704 MATCH constConv(Type *to);
699 Type *toHeadMutable(); 705 Type *toHeadMutable();
700 #if POSIX 706 #if CPP_MANGLE
701 void toCppMangle(OutBuffer *buf, CppMangleState *cms); 707 void toCppMangle(OutBuffer *buf, CppMangleState *cms);
702 #endif 708 #endif
703 709
704 #if IN_DMD 710 #if IN_DMD
705 type *toCtype(); 711 type *toCtype();
736 Expression *defaultInit(Loc loc); 742 Expression *defaultInit(Loc loc);
737 int isZeroInit(Loc loc); 743 int isZeroInit(Loc loc);
738 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); 744 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
739 TypeInfoDeclaration *getTypeInfoDeclaration(); 745 TypeInfoDeclaration *getTypeInfoDeclaration();
740 int hasPointers(); 746 int hasPointers();
741 #if POSIX 747 #if CPP_MANGLE
742 void toCppMangle(OutBuffer *buf, CppMangleState *cms); 748 void toCppMangle(OutBuffer *buf, CppMangleState *cms);
743 #endif 749 #endif
744 750
745 #if IN_DMD 751 #if IN_DMD
746 type *toCtype(); 752 type *toCtype();
782 #endif 788 #endif
783 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); 789 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
784 TypeInfoDeclaration *getTypeInfoDeclaration(); 790 TypeInfoDeclaration *getTypeInfoDeclaration();
785 int hasPointers(); 791 int hasPointers();
786 Type *toHeadMutable(); 792 Type *toHeadMutable();
787 #if POSIX 793 #if CPP_MANGLE
788 void toCppMangle(OutBuffer *buf, CppMangleState *cms); 794 void toCppMangle(OutBuffer *buf, CppMangleState *cms);
789 #endif 795 #endif
790 796
791 #if IN_DMD 797 #if IN_DMD
792 type *toCtype(); 798 type *toCtype();
819 int hasPointers(); 825 int hasPointers();
820 int builtinTypeInfo(); 826 int builtinTypeInfo();
821 #if DMDV2 827 #if DMDV2
822 Type *toHeadMutable(); 828 Type *toHeadMutable();
823 MATCH constConv(Type *to); 829 MATCH constConv(Type *to);
824 #if POSIX 830 #if CPP_MANGLE
825 void toCppMangle(OutBuffer *buf, CppMangleState *cms); 831 void toCppMangle(OutBuffer *buf, CppMangleState *cms);
826 #endif 832 #endif
827 #endif 833 #endif
828 834
829 #if IN_DMD 835 #if IN_DMD