comparison dmd/Argument.d @ 56:51605de93870

TupleExp.optimize UnrolledLoopStatement.ctor UnrolledLoopStatement.semantic UnrolledLoopStatement.blockExit OrOrExp.checkSideEffect FuncExp.syntaxCopy FuncLiteralDeclaration.syntaxCopy WhileStatement.hasBreak StructInitializer.toExpression StructLiteralExp.ctor StructLiteralExp.optimize BinExp.commonSemanticAssign ModAssignExp.opId Argument.isLazyArray CommaExp.implicitConvTo CommaExp.castTo TypeClass.isBaseOf createTypeInfoArray TypeTuple.getTypeInfoDeclaration TypeInfoTupleDeclaration.ctor TypeNext.constConv XorExp.implicitConvTo TemplateParameter.isTemplateValueParameter
author korDen
date Sat, 21 Aug 2010 14:16:53 +0400
parents 5c9b78899f5d
children e28b18c23469
comparison
equal deleted inserted replaced
55:8c2c7b7579f8 56:51605de93870
1 module dmd.Argument; 1 module dmd.Argument;
2 2
3 import dmd.Type; 3 import dmd.Type;
4 import dmd.Identifier; 4 import dmd.Identifier;
5 import dmd.TypeArray;
6 import dmd.TypeFunction;
7 import dmd.TypeDelegate;
5 import dmd.TypeTuple; 8 import dmd.TypeTuple;
6 import dmd.TY; 9 import dmd.TY;
7 import dmd.Expression; 10 import dmd.Expression;
8 import dmd.OutBuffer; 11 import dmd.OutBuffer;
9 import dmd.HdrGenState; 12 import dmd.HdrGenState;
38 Argument syntaxCopy() 41 Argument syntaxCopy()
39 { 42 {
40 return new Argument(storageClass, type ? type.syntaxCopy() : null, ident, defaultArg ? defaultArg.syntaxCopy() : null); 43 return new Argument(storageClass, type ? type.syntaxCopy() : null, ident, defaultArg ? defaultArg.syntaxCopy() : null);
41 } 44 }
42 45
46 /****************************************************
47 * Determine if parameter is a lazy array of delegates.
48 * If so, return the return type of those delegates.
49 * If not, return null.
50 */
43 Type isLazyArray() 51 Type isLazyArray()
44 { 52 {
45 assert(false); 53 // if (inout == Lazy)
54 {
55 Type tb = type.toBasetype();
56 if (tb.ty == Tsarray || tb.ty == Tarray)
57 {
58 Type tel = (cast(TypeArray)tb).next.toBasetype();
59 if (tel.ty == Tdelegate)
60 {
61 TypeDelegate td = cast(TypeDelegate)tel;
62 TypeFunction tf = cast(TypeFunction)td.next;
63
64 if (!tf.varargs && Argument.dim(tf.parameters) == 0)
65 {
66 return tf.next; // return type of delegate
67 }
68 }
69 }
70 }
71 return null;
46 } 72 }
47 73
48 void toDecoBuffer(OutBuffer buf) 74 void toDecoBuffer(OutBuffer buf)
49 { 75 {
50 if (storageClass & STC.STCscope) 76 if (storageClass & STC.STCscope)