Fixes issue where type def would read too much.
This commit is contained in:
parent
a4cbc16545
commit
25e02057ae
|
@ -68,7 +68,11 @@ namespace ASTypeDefParser {
|
|||
std::vector<std::tuple<int, std::string>> behaviours;
|
||||
if (end == '{') {
|
||||
index++;
|
||||
while (index <= data.size()) {
|
||||
while (index < data.size()) {
|
||||
if (std::string(" \r\n\t").find(data.at(index)) != std::string::npos){
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
if (data.at(index) == '}') {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -416,3 +416,26 @@ type fooClass {
|
|||
|
||||
engine->Release();
|
||||
}
|
||||
|
||||
TEST_CASE("Register Type and func") {
|
||||
asIScriptEngine* engine = asCreateScriptEngine();
|
||||
engine->SetMessageCallback(asFUNCTION(MessageCallback), 0, asCALL_CDECL);
|
||||
|
||||
ASTypeDefParser::TypeDefResult res;
|
||||
ASTypeDefParser::Parser::ParseAndRegister(res, R"(
|
||||
type fooClass {
|
||||
void Foo();
|
||||
}
|
||||
|
||||
func fooClass@ CreateFoo();
|
||||
|
||||
)");
|
||||
res.RegisterTypes(engine);
|
||||
res.RegisterImplementation(engine);
|
||||
auto type = engine->GetTypeInfoByName("fooClass");
|
||||
REQUIRE(type != nullptr);
|
||||
auto func = engine->GetGlobalFunctionByDecl("fooClass@ CreateFoo()");
|
||||
REQUIRE(func != nullptr);
|
||||
|
||||
engine->Release();
|
||||
}
|
Loading…
Reference in New Issue