Jump to content

  • Log In with Google      Sign In   
  • Create Account

Jason Goepel

Member Since 15 May 2013
Offline Last Active Yesterday, 06:43 AM

Topics I've Started

Global Variable Redeclaration

12 May 2014 - 01:28 PM

The compiler doesn't seem to prevent declaring two global properties with the same name.  Is this by design or a bug?

Template Specialization Subtypes

30 April 2014 - 12:02 PM


// interface
int asCObjectType::GetSubTypeId(asUINT subtypeIndex) const
    if( flags & asOBJ_TEMPLATE )
        if( subtypeIndex >= templateSubTypes.GetLength() )
            return asINVALID_ARG;

        return engine->GetTypeIdFromDataType(templateSubTypes[subtypeIndex]);

    // Only template types have sub types
    return asERROR;

If the type is a specialization of a template, the asOBJ_TEMPLATE flag is not set



The templateSubTypes array does have elements though.  Should the search through that array really be guarded by asOBJ_TEMPLATE?


GetObjectType for Instances of Templates

30 April 2014 - 08:05 AM

I have registered template specializations for my array class, for example Array<int>, Array<double>.  In prior versions of AngelScript I was able to make the following call to get the corresponding object type.


This function now returns a null pointer.  There doesn't seem to be any way to get the type of a template specialization from the engine.  Am I missing something, or is this an oversight?

Assert When Compiling with "auto"

17 April 2014 - 02:31 PM

The following script asserts on a null asCScriptNode.  The compiler cannot determine the type (not that it should).

auto i;
i = 10;


void asCCompiler::Error(const asCString &msg, asCScriptNode *node)
    asCString str;

    int r = 0, c = 0;
    asASSERT( node );
    if( node ) script->ConvertPosToRowCol(node->tokenPos, &r, &c);

    builder->WriteError(script->name, msg, r, c);

    hasCompileErrors = true;


01 April 2014 - 02:54 PM

The following code checks for a one-line comment.



if( source[1] == '/' )
    // One-line comment

    // Find the length
    size_t n;
    for( n = 2; n < sourceLength; n++ )
        if( source[n] == '\n' )

    tokenType   = ttOnelineComment;
    tokenLength = n+1;

    return true;

Of the last part of "source" is a comment such that the for loop breaks when n == sourceLength (instead of finding a line feed character), tokenLength gets assigned a value one greater than sourceLength.


It seems incorrect that the returned "tokenLength" should exceed the "sourceLength".