Permalink
Browse files

Add a new function get_winxed_compiler, because a basic compreg call …

…will fail if we haven't loaded the language yet. Use that in a few places to standardize access
  • Loading branch information...
1 parent d61a7a2 commit dff8cbaacb90312af4b2489f451945425da45b28 @Whiteknight committed Nov 17, 2011
View
@@ -10,6 +10,18 @@
*/
namespace Rosella
{
+ function get_winxed_compiler()
+ {
+ var c = compreg("winxed");
+ if (c != null)
+ return c;
+ load_language("winxed");
+ c = compreg("winxed");
+ if (c != null)
+ return c;
+ Rosella.Error.invalid(__FUNCTION__, "Cannot get Winxed compiler object");
+ }
+
/* Allocation / Construction Functions
These functions allocate a new object using some kind of proto-
or meta-object. This meta-object can be a Class PMC, a PMC which can
@@ -9,7 +9,7 @@ namespace Rosella { namespace Harness { namespace TestFile
function compile_test()
{
- var winxed = compreg("winxed");
+ var winxed = Rosella.get_winxed_compiler();
return winxed.compile_file(string(self));
}
View
@@ -1,5 +1,6 @@
namespace Rosella {
// src/core/Rosella.winxed
+ extern function get_winxed_compiler;
extern function alloc;
extern function build;
extern function construct;
@@ -36,7 +36,7 @@ namespace Rosella { namespace Template { namespace Node
function compile_func(string code)
{
string code_s = Rosella.String.sprintf("function __%s__EVAL[anon](var engine, var output, var context) { %s; }", EVAL_BASE_NAME, code);
- var winxed = compreg("winxed");
+ var winxed = Rosella.get_winxed_compiler();
return winxed.compile(code_s);
}
}
@@ -7,7 +7,7 @@ namespace Rosella { namespace Winxed { namespace Repl
function Compiler()
{
- self.compiler = load_language("winxed");
+ self.compiler = Rosella.get_winxed_compiler();
self.count = 0;
}

0 comments on commit dff8cba

Please sign in to comment.