Jump to content

  • Log In with Google      Sign In   
  • Create Account


Jason Goepel

Member Since 15 May 2013
Offline Last Active Yesterday, 09:00 AM
-----

Posts I've Made

In Topic: Template Specialization Subtypes

19 May 2014 - 06:06 AM

Is there a reason you did change asCObjectType::GetSubType as well?


In Topic: Global Variable Redeclaration

12 May 2014 - 02:50 PM

I'm sorry, I mean global variables declared from the script.  I find that in any script two global variable declarations compile with no errors.

double x;
double x;
void test() {

}

It doesn't look like there is any test for duplicate names in asCCompiler::CompileGlobalVariable.

 

as_compiler.cpp(1196):

asSExprContext compiledCtx(engine);
bool preCompiled = false;
if( gvar->datatype.IsAuto() )
	preCompiled = CompileAutoType(gvar->datatype, compiledCtx, node, gvar->declaredAtNode);
if( gvar->property == 0 )
{
	gvar->property = builder->module->AllocateGlobalProperty(gvar->name.AddressOf(), gvar->datatype, gvar->ns);
	gvar->index = gvar->property->id;
}

as_module.cpp(1175):

asCGlobalProperty *asCModule::AllocateGlobalProperty(const char *name, const asCDataType &dt, asSNameSpace *ns)
{
	asCGlobalProperty *prop = engine->AllocateGlobalProperty();
	prop->name = name;
	prop->nameSpace = ns;

	// Allocate the memory for this property based on its type
	prop->type = dt;
	prop->AllocateMemory();

	// Make an entry in the address to variable map
	engine->varAddressMap.Insert(prop->GetAddressOfValue(), prop);

	// Store the variable in the module scope (the reference count is already set to 1)
	scriptGlobals.Put(prop);

	return prop;
}

In Topic: GetObjectType for Instances of Templates

30 April 2014 - 11:38 AM

You are correct.  I didn't have the latest WIP version.  I should have been more careful about checking for that.  Thanks!


In Topic: GetObjectType for Instances of Templates

30 April 2014 - 08:35 AM

GetObjectTypeByDecl is not exposed... but it does look like I can get it with a combination of GetObjectTypeById and GetTypeIdByDecl.

 

:-)


In Topic: asCTokenizer::IsComment

02 April 2014 - 07:21 AM

I had written some preprocessing/intellisense code.  One of my functions "SkipCommentsAndWhitespace" sometimes would crash when the source ended in a single-line comment.  The pointer to the source was increased passed the end of the source (as a result of adding a length returned from the asIScriptEngine::ParseToken function).  I'll admit, it took me a little while to track it down smile.png


PARTNERS