void test_semantic() { /* Mini object.d source. Module::parse will add internal members also. */ const char *buf = "module object;\n" "class Object { }\n" "class Throwable { }\n" "class Error : Throwable { this(immutable(char)[]); }"; FileBuffer *srcBuffer = FileBuffer::create(); // free'd in Module::parse() srcBuffer->data.ptr = (unsigned char *)mem.xstrdup(buf); srcBuffer->data.length = strlen(buf); Module *m = Module::create("object.d", Identifier::idPool("object"), 0, 0); unsigned errors = global.startGagging(); m->srcBuffer = srcBuffer; m->parse(); m->importedFrom = m; m->importAll(NULL); dsymbolSemantic(m, NULL); semantic2(m, NULL); semantic3(m, NULL); assert(!global.endGagging(errors)); }
void test_semantic() { /* Mini object.d source. Module::parse will add internal members also. */ const char *buf = "module object;\n" "class Object { }\n" "class Throwable { }\n" "class Error : Throwable { this(immutable(char)[]); }"; Module *m = Module::create("object.d", Identifier::idPool("object"), 0, 0); unsigned errors = global.startGagging(); m->srcfile->setbuffer((void*)buf, strlen(buf)); m->srcfile->ref = 1; m->parse(); m->importedFrom = m; m->importAll(NULL); dsymbolSemantic(m, NULL); semantic2(m, NULL); semantic3(m, NULL); assert(!global.endGagging(errors)); }