changeset 43:709df3e82bb4

Added methods to support type inference
author Mike Pavone <pavone@retrodev.com>
date Thu, 15 Oct 2009 21:32:43 -0400
parents aabda74c7a88
children a7c79ac22efc
files nworker.rhope
diffstat 1 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/nworker.rhope	Tue Oct 13 00:07:34 2009 -0400
+++ b/nworker.rhope	Thu Oct 15 21:32:43 2009 -0400
@@ -751,6 +751,18 @@
 	out <- [bp]Methods <<[ [[bp]Methods >>]Set[name, Yes] ]
 }
 
+Understands Method@NBlueprint[bp,name:out]
+{
+	out <- [[bp]Methods >>]Index[name] {}
+	{ out <- No }
+}
+
+Get Field Type@NBlueprint[bp,name:out,notfound]
+{
+	,notfound <- [[bp]Fields >>]Index[name]
+	{ out <- [~]Index[1] }
+}
+
 _Compile Blueprint Fields[type,field:out]
 {
 	name <- [field]Index[0]
@@ -983,3 +995,17 @@
 	out,notfound <- [[prog]Worker Refs >>]Index[name]
 }
 
+Find Method@NProgram[prog, name, type:out,notfound]
+{
+	bp,notfound <- [[prog]Blueprints >>]Index[[type]Name >>]
+	,notfound <- If[[bp]Understands Method[name]]
+	{
+		out <- [[prog]Workers >>]Index[[[name]Append["@"]]Append[[type]Name >>]]
+	}
+}
+
+Find Field@NProgram[prog, name, type:fieldtype,notfound]
+{
+	bp,notfound <- [[prog]Blueprints >>]Index[[type]Name >>]
+	fieldtype,notfound <- [bp]Get Field Type[name]
+}