view 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
line wrap: on
line source

module dmd.StructLiteralExp;

import dmd.Expression;
import dmd.StructDeclaration;
import dmd.backend.elem;
import dmd.InterState;
import dmd.MATCH;
import dmd.WANT;
import dmd.Type;
import dmd.OutBuffer;
import dmd.Loc;
import dmd.Scope;
import dmd.InlineCostState;
import dmd.IRState;
import dmd.InlineDoState;
import dmd.backend.Symbol;
import dmd.HdrGenState;
import dmd.backend.dt_t;
import dmd.InlineScanState;
import dmd.ArrayTypes;
import dmd.TOK;


class StructLiteralExp : Expression
{
	StructDeclaration sd;		// which aggregate this is for
    Expressions elements;	// parallels sd->fields[] with
				// NULL entries for fields to skip

    Symbol* sym;		// back end symbol to initialize with literal
    size_t soffset;		// offset from start of s
    int fillHoles;		// fill alignment 'holes' with zero

	this(Loc loc, StructDeclaration sd, Expressions elements)
	{
		super(loc, TOKstructliteral, StructLiteralExp.sizeof);
		this.sd = sd;
		this.elements = elements;
		this.sym = null;
		this.soffset = 0;
		this.fillHoles = 1;
	}

	Expression syntaxCopy()
	{
		assert(false);
	}

	Expression semantic(Scope sc)
	{
		assert(false);
	}

	Expression getField(Type type, uint offset)
	{
		assert(false);
	}

	int getFieldIndex(Type type, uint offset)
	{
		assert(false);
	}

	elem* toElem(IRState* irs)
	{
		assert(false);
	}

	bool checkSideEffect(int flag)
	{
		assert(false);
	}

	void toCBuffer(OutBuffer buf, HdrGenState* hgs)
	{
		assert(false);
	}

	void toMangleBuffer(OutBuffer buf)
	{
		assert(false);
	}

	void scanForNestedRef(Scope sc)
	{
		assert(false);
	}

	Expression optimize(int result)
	{
		if (elements)
		{
			for (size_t i = 0; i < elements.dim; i++)
			{   
				Expression e = cast(Expression)elements.data[i];
				if (!e)
					continue;
				e = e.optimize(WANTvalue | (result & WANTinterpret));
				elements.data[i] = cast(void*)e;
			}
		}
		return this;
	}

	Expression interpret(InterState* istate)
	{
		assert(false);
	}

	dt_t** toDt(dt_t** pdt)
	{
		assert(false);
	}

	int isLvalue()
	{
		assert(false);
	}

	Expression toLvalue(Scope sc, Expression e)
	{
		assert(false);
	}

	bool canThrow()
	{
		assert(false);
	}

	MATCH implicitConvTo(Type t)
	{
		assert(false);
	}

	int inlineCost(InlineCostState* ics)
	{
		assert(false);
	}

	Expression doInline(InlineDoState ids)
	{
		assert(false);
	}

	Expression inlineScan(InlineScanState* iss)
	{
		assert(false);
	}
}