Permalink
Browse files

Simplify ObjectFactory. Move it from container to core. Add in a .win…

…xed version so we can still compile using that toolchain
  • Loading branch information...
1 parent 79d24da commit c8f8bcd9c7e3f9816ad15e2afb51c65987025fba @Whiteknight committed Feb 28, 2011
Showing with 22 additions and 16 deletions.
  1. +3 −3 setup.winxed
  2. +1 −1 src/container/Container.nqp
  3. +0 −12 src/container/ObjectFactory.nqp
  4. +7 −0 src/core/ObjectFactory.nqp
  5. +11 −0 src/core/ObjectFactory.winxed
View
@@ -36,7 +36,8 @@ function main[main](argv) {
// required by other libraries in the sequence
var core_files = [
"core/Rosella",
- "core/Error"
+ "core/Error",
+ "core/ObjectFactory"
];
//setup_nqp_lib(rosella, "rosella/core.pbc", core_files);
setup_winxed_lib(rosella, "rosella/core.pbc", core_files);
@@ -56,8 +57,7 @@ function main[main](argv) {
"include/Core",
"include/Action",
"container/Container",
- "container/ItemBuilder",
- "container/ObjectFactory"
+ "container/ItemBuilder"
];
setup_nqp_lib(rosella, "rosella/container.pbc", container_files);
@@ -11,7 +11,7 @@ class Rosella::Container {
if pir::defined($factory) {
$!default_factory := $factory;
} else {
- $!default_factory := Rosella::ObjectFactory::Default.new;
+ $!default_factory := Rosella::ObjectFactory.new;
}
}
@@ -1,12 +0,0 @@
-class Rosella::ObjectFactory {
- method create($type, *@pos, *%named) {
- Rosella::Error::must_subclass(Rosella::ItemCreator, "create");
- }
-}
-
-class Rosella::ObjectFactory::Default {
- method create($type, *@pos, *%named) {
- return Rosella::build($type, |@pos, |%named);
- }
-}
-
@@ -0,0 +1,7 @@
+class Rosella::ObjectFactory {
+ method create($type, *@pos, *%named) {
+ return Rosella::build($type, |@pos, |%named);
+ }
+}
+
+
@@ -0,0 +1,11 @@
+namespace Rosella
+{
+ class ObjectFactory
+ {
+ function create(var type, var pos [slurpy], var named [slurpy,named])
+ {
+ using Rosella.build;
+ return build(type, pos:[flat], named:[flat,named]);
+ }
+ }
+}

0 comments on commit c8f8bcd

Please sign in to comment.