diff dmd/Statement.d @ 0:10317f0c89a5

Initial commit
author korDen
date Sat, 24 Oct 2009 08:42:06 +0400
parents
children ecf732dfe11e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dmd/Statement.d	Sat Oct 24 08:42:06 2009 +0400
@@ -0,0 +1,193 @@
+module dmd.Statement;
+
+import dmd.TryCatchStatement;
+import dmd.GotoStatement;
+import dmd.AsmStatement;
+import dmd.ScopeStatement;
+import dmd.DeclarationStatement;
+import dmd.CompoundStatement;
+import dmd.ReturnStatement;
+import dmd.IfStatement;
+import dmd.Scope;
+import dmd.Loc;
+import dmd.OutBuffer;
+import dmd.HdrGenState;
+import dmd.ArrayTypes;
+import dmd.Expression;
+import dmd.InterState;
+import dmd.InlineCostState;
+import dmd.InlineDoState;
+import dmd.InlineScanState;
+import dmd.IRState;
+import dmd.BE;
+import dmd.Global;
+import dmd.Util;
+
+class Statement
+{
+    Loc loc;
+
+    this(Loc loc)
+	{
+		this.loc = loc;
+	}
+
+    Statement syntaxCopy()
+	{
+		assert(false);
+	}
+
+    void print()
+	{
+		assert(false);
+	}
+	
+    string toChars()
+	{
+		assert(false);
+	}
+
+    void error(T...)(string format, T t)
+	{
+		assert(false);
+	}
+	
+    void warning(T...)(string format, T t)
+	{
+		if (global.params.warnings && !global.gag)
+		{
+			writef("warning - ");
+			.error(loc, format, t);
+		}
+	}
+
+	void toCBuffer(OutBuffer buf, HdrGenState* hgs)
+	{
+		assert(false);
+	}
+
+    TryCatchStatement isTryCatchStatement() { return null; }
+
+    GotoStatement isGotoStatement() { return null; }
+
+    AsmStatement isAsmStatement() { return null; }
+
+version (_DH) {
+    int incontract;
+}
+    ScopeStatement isScopeStatement() { return null; }
+
+    Statement semantic(Scope sc)
+	{
+		assert(false);
+	}
+	
+    Statement semanticScope(Scope sc, Statement sbreak, Statement scontinue)
+	{
+		Scope scd;
+		Statement s;
+
+		scd = sc.push();
+		if (sbreak)
+			scd.sbreak = sbreak;
+		if (scontinue)
+			scd.scontinue = scontinue;
+		s = semantic(scd);
+		scd.pop();
+		return s;
+	}
+	
+    bool hasBreak()
+	{
+		assert(false);
+	}
+	
+    bool hasContinue()
+	{
+		assert(false);
+	}
+	
+    bool usesEH()
+	{
+		assert(false);
+	}
+	
+    BE blockExit()
+	{
+		assert(false);
+	}
+	
+	// true if statement 'comes from' somewhere else, like a goto
+    bool comeFrom()
+	{
+		//printf("Statement::comeFrom()\n");
+		return false;
+	}
+	
+	// Return TRUE if statement has no code in it
+    bool isEmpty()
+	{
+		//printf("Statement::isEmpty()\n");
+		return false;
+	}
+	
+	/****************************************
+	 * If this statement has code that needs to run in a finally clause
+	 * at the end of the current scope, return that code in the form of
+	 * a Statement.
+	 * Output:
+	 *	*sentry		code executed upon entry to the scope
+	 *	*sexception	code executed upon exit from the scope via exception
+	 *	*sfinally	code executed in finally block
+	 */
+    void scopeCode(Scope sc, Statement* sentry, Statement* sexception, Statement* sfinally)
+	{
+		//printf("Statement::scopeCode()\n");
+		//print();
+		*sentry = null;
+		*sexception = null;
+		*sfinally = null;
+	}
+	
+	/*********************************
+	 * Flatten out the scope by presenting the statement
+	 * as an array of statements.
+	 * Returns NULL if no flattening necessary.
+	 */
+    Statements flatten(Scope sc)
+	{
+		return null;
+	}
+	
+    Expression interpret(InterState* istate)
+	{
+		assert(false);
+	}
+	
+    int inlineCost(InlineCostState* ics)
+	{
+		return COST_MAX;		// default is we can't inline it
+	}
+	
+    Expression doInline(InlineDoState ids)
+	{
+		assert(false);
+	}
+	
+    Statement inlineScan(InlineScanState* iss)
+	{
+		return this;
+	}
+	
+    // Back end
+    void toIR(IRState* irs)
+	{
+		assert(false);
+	}
+	
+    // Avoid dynamic_cast
+    DeclarationStatement isDeclarationStatement() { return null; }
+    CompoundStatement isCompoundStatement() { return null; }
+    ReturnStatement isReturnStatement() { return null; }
+    IfStatement isIfStatement() { return null; }
+}
\ No newline at end of file