+ resolve(stage, RESOLVE_VARIABLES|RESOLVE_FUNCTIONS);
+ }
+}
+
+template<typename T>
+bool Compiler::resolve(Stage &stage, unsigned &flags, unsigned bit)
+{
+ if(!(flags&bit))
+ return false;
+
+ flags &= ~bit;
+ return T().apply(stage);
+}
+
+void Compiler::resolve(Stage &stage, unsigned flags)
+{
+ while(flags)
+ {
+ if(resolve<BlockHierarchyResolver>(stage, flags, RESOLVE_BLOCKS))
+ ;
+ else if(resolve<TypeResolver>(stage, flags, RESOLVE_TYPES))
+ flags |= RESOLVE_VARIABLES|RESOLVE_EXPRESSIONS;
+ else if(resolve<VariableResolver>(stage, flags, RESOLVE_VARIABLES))
+ flags |= RESOLVE_EXPRESSIONS;
+ else if(resolve<FunctionResolver>(stage, flags, RESOLVE_FUNCTIONS))
+ flags |= RESOLVE_EXPRESSIONS;
+ else if(resolve<ExpressionResolver>(stage, flags, RESOLVE_EXPRESSIONS))
+ flags |= RESOLVE_VARIABLES;
+ }