#include <msp/gl/resources.h>
#include <msp/io/seekable.h>
#include "builtin.h"
-#include "generate.h"
#include "parser.h"
+#include "visitor.h"
using namespace std;
namespace GL {
namespace SL {
+void populate_types(Stage &stage)
+{
+ for(NodeList<Statement>::const_iterator i=stage.content.body.begin(); i!=stage.content.body.end(); ++i)
+ if(TypeDeclaration *type = dynamic_cast<TypeDeclaration *>(i->get()))
+ stage.types[type->name] = type;
+}
+
Module *get_builtins_module()
{
static RefPtr<Module> builtins_module;
type->kind = BasicTypeDeclaration::FLOAT;
shared_body.insert(insert_point, type);
- TypeResolver().apply(module->shared);
+ populate_types(module->shared);
for(list<Stage>::iterator i=module->stages.begin(); i!=module->stages.end(); ++i)
- TypeResolver().apply(*i);
+ populate_types(*i);
builtins_module = module;
}