comparison dmd/StructLiteralExp.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 10317f0c89a5
children cab4c37afb89
comparison
equal deleted inserted replaced
55:8c2c7b7579f8 56:51605de93870
3 import dmd.Expression; 3 import dmd.Expression;
4 import dmd.StructDeclaration; 4 import dmd.StructDeclaration;
5 import dmd.backend.elem; 5 import dmd.backend.elem;
6 import dmd.InterState; 6 import dmd.InterState;
7 import dmd.MATCH; 7 import dmd.MATCH;
8 import dmd.WANT;
8 import dmd.Type; 9 import dmd.Type;
9 import dmd.OutBuffer; 10 import dmd.OutBuffer;
10 import dmd.Loc; 11 import dmd.Loc;
11 import dmd.Scope; 12 import dmd.Scope;
12 import dmd.InlineCostState; 13 import dmd.InlineCostState;
30 size_t soffset; // offset from start of s 31 size_t soffset; // offset from start of s
31 int fillHoles; // fill alignment 'holes' with zero 32 int fillHoles; // fill alignment 'holes' with zero
32 33
33 this(Loc loc, StructDeclaration sd, Expressions elements) 34 this(Loc loc, StructDeclaration sd, Expressions elements)
34 { 35 {
35 assert(false); 36 super(loc, TOKstructliteral, StructLiteralExp.sizeof);
36 super(loc, TOK.init, 0); 37 this.sd = sd;
38 this.elements = elements;
39 this.sym = null;
40 this.soffset = 0;
41 this.fillHoles = 1;
37 } 42 }
38 43
39 Expression syntaxCopy() 44 Expression syntaxCopy()
40 { 45 {
41 assert(false); 46 assert(false);
81 assert(false); 86 assert(false);
82 } 87 }
83 88
84 Expression optimize(int result) 89 Expression optimize(int result)
85 { 90 {
86 assert(false); 91 if (elements)
92 {
93 for (size_t i = 0; i < elements.dim; i++)
94 {
95 Expression e = cast(Expression)elements.data[i];
96 if (!e)
97 continue;
98 e = e.optimize(WANTvalue | (result & WANTinterpret));
99 elements.data[i] = cast(void*)e;
100 }
101 }
102 return this;
87 } 103 }
88 104
89 Expression interpret(InterState* istate) 105 Expression interpret(InterState* istate)
90 { 106 {
91 assert(false); 107 assert(false);