Exemplo n.º 1
0
TypedPointer TypedCompoundPointer::GetCompoundMember(const String& inMemberName) const
{
	gAssert(mType.IsNakedCompound());
	for (const ClassMember& m : mType.mCompoundInfo->mMembers)
	{
		if (m.mName == inMemberName)
		{
			return TypedPointer(m.mType, gOffsetPointer<void>(mPointer, m.mOffset));
		}
	}
	return TypedPointer(TypeDecl(etNullptr), nullptr);
}
Exemplo n.º 2
0
void DeclSeq()
{
  /*
    DeclSeq -> { CONST { ConstDecl ; }
                 | TYPE { TypeDecl ; } 
                 | VAR { VarDecl ; } }
                 { ProcDecl ; | ForwardDecl ; }
  */

  if ( debugMode) printf( "In DeclSeq\n");

  while ( sym == CONST_SYM || sym == TYPE_SYM || sym == VAR_SYM)
  {
    writesym();
    switch( sym)
    {
      case CONST_SYM:
        nextsym();
        // start of ConstDecl is an ident
        while ( sym == ident)
        {
          ConstDecl();
          accept( semic, 151);
        }
        break;
      case TYPE_SYM:
        nextsym();
        while ( sym == ident)
        {
          TypeDecl();
          accept( semic, 151);
        }
        break;
      case VAR_SYM:
        nextsym();
        while ( sym == ident)
        {
          VarDecl();
          accept( semic, 151);
        }
    }
  }  

  while ( sym == PROCEDURE_SYM)
  {
    writesym();
    nextsym();
    if ( sym == carat) 
    {
      // then it's ForwardDecl
      writesym();
      nextsym();
      if ( sym != ident)
      {
        Receiver();
      }
      identdef();
      if ( sym == lparen)
      {
        FormParams();
      }
    }
    else
    {
      // it's ProcDecl
      if ( sym != ident)
      {
        Receiver();
      }
      identdef();
      if ( sym == lparen)
      {
        FormParams();
      }
      accept( semic, 151);
      ProcBody();
      accept( ident, 124);
    }
    accept( semic, 151);
  }

  if ( debugMode) printf( "Out DeclSeq\n");
}
Exemplo n.º 3
0
TypedPointer TypedCompoundPointer::DynamicCast() const
{
	const type_info& info = mType.mCompoundInfo->mInfoFunction(mPointer);
	const CompoundReflectionInfo* refl_info = ReflectionHost::sGetReflectionHost().FindClassInfo(ClassName(info));
	return TypedCompoundPointer(TypeDecl(refl_info), mPointer);
}