view dmd/SymbolDeclaration.d @ 32:81796b717a39

A few bad cast fixed. TODO: either get rid of dyncast(), or derive all objects from intermediate supertype.
author korDen
date Tue, 18 May 2010 17:51:46 +0400
parents 10317f0c89a5
children 2e2a5c3f943a
line wrap: on
line source

module dmd.SymbolDeclaration;

import dmd.Declaration;
import dmd.StructDeclaration;
import dmd.Loc;
import dmd.TOK;
import dmd.STC;
import dmd.Identifier;

import dmd.backend.Symbol;

import core.stdc.string;
import std.stdio;

// This is a shell around a back end symbol

class SymbolDeclaration : Declaration
{
    Symbol* sym;
    StructDeclaration dsym;

    this(Loc loc, Symbol* s, StructDeclaration dsym)
	{
		int len = strlen(s.Sident.ptr);
		string name = s.Sident.ptr[0..len].idup;

		super(new Identifier(name, TOK.TOKidentifier));
		
		this.loc = loc;
		sym = s;
		this.dsym = dsym;
		storage_class |= STCconst;
	}

    Symbol* toSymbol()
	{
		return sym;
	}

    // Eliminate need for dynamic_cast
    SymbolDeclaration isSymbolDeclaration() { return this; }
}