Advertisement

Errors produced by classes in namespaces accessing global properties

Started by March 03, 2015 10:08 PM
1 comment, last by WitchLord 9 years, 8 months ago

Using AngelScript 2.30.0, I encountered these two today:

An unjustified compile time error when a method of a class in a namespace calls a function with an argument that defaults to a global variable:


int i;
void f(int a = i) {}
namespace n {
 class c {
  void m() {
   f();
  }
 }
}

script.as (5, 3) : INFO : Compiling void c::m()
default arg (1, 1) : ERR : 'i' is not declared
script.as (6, 4) : ERR : Failed while compiling default arg for parameter 0 in function 'void f(int = i)' 

An unjustified compile time error when a class in a namespace has a property that defaults to a global variable:


int i;
namespace n {
 class c {
  int p = i;
 }
}

script.as (3, 8) : INFO : Compiling c::c()
script.as (4, 11) : ERR : 'i' is not declared

The errors disappear if "::" is added in front of "i" in the appropriate places in the above examples but given the conditions it shouldn't be required (and, in the former case, may be impossible to add from script level if the function in question is registered by the application).

I'll look into it. Thanks for the report.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

I've fixed this in revision 2139.

Regards,

Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement