[Monodevelop-patches-list] r2563 - in trunk/MonoDevelop/Extras/BooBinding: . Parser

Peter Johanson <latexer@gentoo.org> pjohanson at mono-cvs.ximian.com
Thu May 26 23:31:55 EDT 2005


Author: pjohanson
Date: 2005-05-26 23:31:55 -0400 (Thu, 26 May 2005)
New Revision: 2563

Modified:
   trunk/MonoDevelop/Extras/BooBinding/ChangeLog
   trunk/MonoDevelop/Extras/BooBinding/Parser/BooParser.boo
   trunk/MonoDevelop/Extras/BooBinding/Parser/ExpressionTypeVisitor.boo
   trunk/MonoDevelop/Extras/BooBinding/Parser/Resolver.boo
   trunk/MonoDevelop/Extras/BooBinding/Parser/Visitor.boo
Log:
Various cleanups and bug fixes on the parser/resolver.


Modified: trunk/MonoDevelop/Extras/BooBinding/ChangeLog
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/ChangeLog	2005-05-27 02:02:16 UTC (rev 2562)
+++ trunk/MonoDevelop/Extras/BooBinding/ChangeLog	2005-05-27 03:31:55 UTC (rev 2563)
@@ -1,3 +1,9 @@
+2005-05-27  Peter Johanson <latexer at gentoo.org>
+
+	* Parser/*: Various cleanups of print statements,
+	as well as various fixes to improve resolution of
+	fields and local variables.
+
 2005-05-24  Peter Johanson <latexer at gentoo.org>
 
 	* Parser/BooParser.boo: One small fix to return

Modified: trunk/MonoDevelop/Extras/BooBinding/Parser/BooParser.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Parser/BooParser.boo	2005-05-27 02:02:16 UTC (rev 2562)
+++ trunk/MonoDevelop/Extras/BooBinding/Parser/BooParser.boo	2005-05-27 03:31:55 UTC (rev 2563)
@@ -86,21 +86,24 @@
 		
 		compiler = BooCompiler()
 		compiler.Parameters.Input.Add(StringInput(fileName, fileContent))
-		return Parse(fileName, lineLength, compiler)
+		project as Project
+		for entry as Project in MonoDevelop.Services.Runtime.ProjectService.CurrentOpenCombine.GetAllProjects():
+			if entry.IsFileInProject(fileName):
+				project = entry
+				
+		return Parse(fileName, lineLength, compiler, project)
 	
-	private def Parse(fileName as string, lineLength as (int), compiler as BooCompiler):
+	private def Parse(fileName as string, lineLength as (int), compiler as BooCompiler, project as Project):
 		compiler.Parameters.OutputWriter = StringWriter()
 		compiler.Parameters.TraceSwitch.Level = TraceLevel.Warning;
 		
 		compilePipe = Compile()
 		parsingStep as Boo.Lang.Parser.BooParsingStep = compilePipe[0]
 		parsingStep.TabSize = 1
-		num = compilePipe.Find(typeof(StricterErrorChecking))
-		// Original cut out from this place onward, but this caused
-		// problems with [Property(A)]\na\n type properties
-		// and trying to figure out the types.
-		// What did we break by doing this extra Step?
-		//num = compilePipe.Find(typeof(ProcessMethodBodiesWithDuckTyping))
+		num = compilePipe.Find(typeof(ProcessMethodBodiesWithDuckTyping))
+		// The following resolved issues with '[Property(foo] foo', but breaks other things
+		// reverting for now, as [Property] bug is less common than others cause by this.
+		//num = compilePipe.Find(typeof(StricterErrorChecking))
 		visitor = Visitor(LineLength:lineLength)
 		compilePipe[num] = visitor
 		// Remove unneccessary compiler steps
@@ -114,6 +117,8 @@
 		
 		compilePipe.BreakOnErrors = false
 		compiler.Parameters.Pipeline = compilePipe
+		for projectRef as ProjectReference in project.ProjectReferences:
+			compiler.Parameters.References.Add(System.Reflection.Assembly.LoadFile(projectRef.GetReferencedFileName()))
 		
 		try:
 			compiler.Run()

Modified: trunk/MonoDevelop/Extras/BooBinding/Parser/ExpressionTypeVisitor.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Parser/ExpressionTypeVisitor.boo	2005-05-27 02:02:16 UTC (rev 2562)
+++ trunk/MonoDevelop/Extras/BooBinding/Parser/ExpressionTypeVisitor.boo	2005-05-27 03:31:55 UTC (rev 2563)
@@ -49,7 +49,6 @@
 		if fullClassName == null:
 			_returnType = null
 		else:
-			print "CreateReturnType: type set to ${fullClassName}"
 			_returnType = BooBinding.Parser.ReturnType(fullClassName)
 	
 	private def CreateReturnType(reference as TypeReference):
@@ -107,7 +106,7 @@
 	private def ProcessMethod(node as MethodInvocationExpression, name as string, c as IClass) as bool:
 		return false if c == null
 		possibleOverloads = FindMethods(c, name, node.Arguments.Count)
-		print "found ${possibleOverloads.Count} overloads (multiple overloads not supported yet)"
+		//print "found ${possibleOverloads.Count} overloads (multiple overloads not supported yet)"
 		if possibleOverloads.Count >= 1:
 			SetReturnType(cast(IMethod, possibleOverloads[0]).ReturnType)
 			return true
@@ -173,6 +172,7 @@
 		rt = _resolver.GetTypeFromLocal(node.Name)
 		if rt != null:
 			SetReturnType(rt)
+			return
 
 		return if ProcessMember(node.Name, _resolver.CallingClass)
 		if _resolver.IsNamespace(node.Name):
@@ -213,7 +213,6 @@
 					return true
 			for p as IProperty in cl.Properties:
 				if p.Name == name:
-					print "ProcessMember: Set property return type to ${p.ReturnType}"
 					SetReturnType(p.ReturnType)
 					return true
 			for m as IMethod in cl.Methods:

Modified: trunk/MonoDevelop/Extras/BooBinding/Parser/Resolver.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Parser/Resolver.boo	2005-05-27 02:02:16 UTC (rev 2562)
+++ trunk/MonoDevelop/Extras/BooBinding/Parser/Resolver.boo	2005-05-27 03:31:55 UTC (rev 2563)
@@ -105,7 +105,6 @@
 	
 	def GetTypeFromLocal(name as string) as IReturnType:
 		// gets the type of a local variable or method parameter
-		print "Trying to get local variable ${name}..."
 		return _localTypes[name] if _localTypes.ContainsKey(name)
 		_localTypes[name] = null // prevent stack overflow by caching null first
 		rt = InnerGetTypeFromLocal(name)
@@ -126,7 +125,6 @@
 				print "Finished visiting method body!"
 				return varLookup.ReturnType
 		elif member isa Property:
-			print "name: ${name}"
 			property as Property = member
 
 			return property.ReturnType if name == "value"
@@ -152,7 +150,7 @@
 		expandedName = BooAmbience.ReverseTypeConversionTable[name]
 		return _parserService.GetClass(_project, expandedName) if expandedName != null
 		//return _parserService.SearchType(_project, name, _callingClass, _caretLine, _caretColumn)
-		return _parserService.SearchType(_project, name, _callingClass, null)
+		return _parserService.SearchType(_project, name, _callingClass, _compilationUnit)
 	
 	builtinClass as IClass
 	
@@ -262,6 +260,12 @@
 			_callingClass = cu.Classes[cu.Classes.Count - 1]
 			if _callingClass.Region != null:
 				return false if _callingClass.Region.BeginLine > caretLine
+
+		if _project == null:
+			for project as Project in MonoDevelop.Services.Runtime.ProjectService.CurrentOpenCombine.GetAllProjects():
+				if project.IsFileInProject(fileName):
+					_project = project
+					break
 		return true
 	
 	def Resolve(parserService as IParserService, expression as string, caretLine as int, caretColumn as int, fileName as string, fileContent as string) as ResolveResult:
@@ -280,10 +284,6 @@
 		returnClass as IClass = null
 		if expression == "self":
 			returnClass = callingClass
-		elif expression == "this":
-			// SharpDevelop uses "this" as expression when requesting method insight information
-			// for a method on the current class
-			returnClass = callingClass
 		elif expression == "super":
 			returnClass = self.ParentClass
 		else:
@@ -311,7 +311,6 @@
 					returnClass = self.SearchType(retType.FullyQualifiedName)
 		
 		return null if returnClass == null
-		//return ResolveResult(returnClass, ListMembers(ArrayList(), returnClass, callingClass, false))
 		return ResolveResult(returnClass, ListMembers(ArrayList(), returnClass))
 	
 	private def Print(name as string, obj):

Modified: trunk/MonoDevelop/Extras/BooBinding/Parser/Visitor.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Parser/Visitor.boo	2005-05-27 02:02:16 UTC (rev 2562)
+++ trunk/MonoDevelop/Extras/BooBinding/Parser/Visitor.boo	2005-05-27 03:31:55 UTC (rev 2563)
@@ -51,6 +51,8 @@
 		// If we've had errors up to this point, note it and return
 		// immediately.
 		if Errors is not null and Errors.Count > 0:
+			//for error in Errors:
+			//	print "Error ${error}"
 			_hadErrors = true
 			return
 




More information about the Monodevelop-patches-list mailing list