[Monodevelop-patches-list] r2725 - in trunk/MonoDevelop/Extras/BooBinding: . Gui Gui/OptionPanels Parser

Lluis Sanchez <lluis@ximian.com> lluis at mono-cvs.ximian.com
Tue Aug 9 19:48:36 EDT 2005


Author: lluis
Date: 2005-08-09 19:48:35 -0400 (Tue, 09 Aug 2005)
New Revision: 2725

Modified:
   trunk/MonoDevelop/Extras/BooBinding/ChangeLog
   trunk/MonoDevelop/Extras/BooBinding/Gui/OptionPanels/CodeCompilationPanel.boo
   trunk/MonoDevelop/Extras/BooBinding/Gui/ShellTextView.boo
   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/ReturnType.boo
Log:
2005-08-09  Lluis Sanchez Gual  <lluis at novell.com>

	* Parser/ReturnType.boo:
	* Parser/ExpressionTypeVisitor.boo:
	* Parser/Resolver.boo:
	* Parser/BooParser.boo:
	* Gui/ShellTextView.boo: Use the new IParserContext API.



Modified: trunk/MonoDevelop/Extras/BooBinding/ChangeLog
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/ChangeLog	2005-08-09 23:48:21 UTC (rev 2724)
+++ trunk/MonoDevelop/Extras/BooBinding/ChangeLog	2005-08-09 23:48:35 UTC (rev 2725)
@@ -1,3 +1,11 @@
+2005-08-09  Lluis Sanchez Gual  <lluis at novell.com>
+
+	* Parser/ReturnType.boo:
+	* Parser/ExpressionTypeVisitor.boo:
+	* Parser/Resolver.boo:
+	* Parser/BooParser.boo:
+	* Gui/ShellTextView.boo: Use the new IParserContext API.
+
 2005-07-20  Lluis Sanchez Gual  <lluis at novell.com>
 
 	* Gui/OptionPanels/GeneralShellPanel.boo:

Modified: trunk/MonoDevelop/Extras/BooBinding/Gui/OptionPanels/CodeCompilationPanel.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Gui/OptionPanels/CodeCompilationPanel.boo	2005-08-09 23:48:21 UTC (rev 2724)
+++ trunk/MonoDevelop/Extras/BooBinding/Gui/OptionPanels/CodeCompilationPanel.boo	2005-08-09 23:48:35 UTC (rev 2725)
@@ -104,7 +104,7 @@
 		labelCompileTarget.Markup = String.Format ("{0} :", GettextCatalog.GetString ("Output Assembly"))
 		
 
-		store = ListStore ((typeof(string),))
+		store = ListStore (string)
 
 		stringArray = array(System.String, 1)
 		stringArray[0] = GettextCatalog.GetString ("Executable")

Modified: trunk/MonoDevelop/Extras/BooBinding/Gui/ShellTextView.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Gui/ShellTextView.boo	2005-08-09 23:48:21 UTC (rev 2724)
+++ trunk/MonoDevelop/Extras/BooBinding/Gui/ShellTextView.boo	2005-08-09 23:48:35 UTC (rev 2725)
@@ -69,12 +69,14 @@
 	private _assembliesLoaded as bool
 
 	private _fakeProject as DotNetProject
-	private _parserService as DefaultParserService
+	private _parserService as IParserDatabase
 	private _fakeFileName as string
 	private _fileInfo as FileStream
+	private _parserContext as IParserContext;
 	
 	def constructor(model as IShellModel):
-		_parserService = cast(IParserService, ServiceManager.GetService (typeof (DefaultParserService)))
+		_projService = ServiceManager.GetService(typeof(ProjectService))
+		_parserService = _projService.ParserDatabase
 
 		manager = SourceLanguagesManager()
 		buf = SourceBuffer(manager.GetLanguageFromMimeType(model.MimeType))
@@ -95,7 +97,8 @@
 		_fileInfo  = System.IO.File.Create (_fakeFileName)
 		_fakeProject = DotNetProject(Model.LanguageName, Name: "___ShellProject", FileName: shellProjectFile)
 
-		_parserService.LoadProjectDatabase(_fakeProject)
+		_parserService.Load(_fakeProject)
+		_parserContext = _parserService.GetProjectParserContext (_fakeProject)
 
 		Model.Properties.InternalProperties.PropertyChanged += OnPropertyChanged
 		Model.RegisterOutputHandler (HandleOutput)
@@ -113,7 +116,6 @@
 		Buffer.TagTable.Add (tag)
 		prompt (false)
 
-		_projService = ServiceManager.GetService(typeof(ProjectService))
 		_projService.EndBuild += ProjectCompiled
 		_projService.CurrentProjectChanged += ProjectChanged
 
@@ -173,7 +175,7 @@
 		for assembly in Model.References:
 			_fakeProject.AddReference(assembly)
 
-		GLib.Idle.Add( { _parserService.ParseFile (_fakeFileName, _scriptLines) } )
+		GLib.Idle.Add( { _parserContext.ParseFile (_fakeFileName, _scriptLines) } )
 		return false
 			
 	override def Dispose():
@@ -325,7 +327,7 @@
 		elif ev.Key == Gdk.Key.period:
 			ret = super.OnKeyPressEvent(ev)
 			prepareCompletionDetails (Buffer.GetIterAtMark (Buffer.InsertMark))
-			CompletionListWindow.ShowWindow(char('.'), CodeCompletionDataProvider (true), self, _fakeProject, _fakeFileName)
+			CompletionListWindow.ShowWindow(char('.'), CodeCompletionDataProvider (_parserContext, _fakeFileName, true), self)
 			return ret
 
 		// Short circuit to avoid getting moved back to the input line
@@ -368,7 +370,7 @@
 		triggerIter.ForwardChar ()
 		
 		prepareCompletionDetails (triggerIter)
-		CompletionListWindow.ShowWindow (triggerChar, CodeCompletionDataProvider (true), self, _fakeProject, _fakeFileName)
+		CompletionListWindow.ShowWindow (triggerChar, CodeCompletionDataProvider (_parserContext, _fakeFileName, true), self)
 
 	// Mark to find the beginning of our next input line
 	private _endOfLastProcessing as TextMark

Modified: trunk/MonoDevelop/Extras/BooBinding/Parser/BooParser.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Parser/BooParser.boo	2005-08-09 23:48:21 UTC (rev 2724)
+++ trunk/MonoDevelop/Extras/BooBinding/Parser/BooParser.boo	2005-08-09 23:48:35 UTC (rev 2725)
@@ -147,29 +147,29 @@
 		cuCache[fileName] = visitor.Cu
 		return visitor.Cu
 	
-	def CtrlSpace(parserService as IParserService, project as Project, caretLine as int, caretColumn as int, fileName as string) as ArrayList:
+	def CtrlSpace(parserContext as IParserContext, caretLine as int, caretColumn as int, fileName as string) as ArrayList:
 		//print "Ctrl-Space (${caretLine}/${caretColumn})"
 		try:
-			return Resolver(project).CtrlSpace(parserService, caretLine, caretColumn, fileName)
+			return Resolver(parserContext).CtrlSpace(caretLine, caretColumn, fileName)
 		except e:
 			//ShowException(e)
 			return null
 	
-	def IsAsResolve (parserService as IParserService , project as Project , expression as string , caretLineNumber as int , caretColumn as int , fileName as string , fileContent as string ) as ArrayList:
-		return Resolver (project).IsAsResolve (parserService, expression, caretLineNumber, caretColumn, fileName, fileContent)
+	def IsAsResolve (parserContext as IParserContext, expression as string , caretLineNumber as int , caretColumn as int , fileName as string , fileContent as string ) as ArrayList:
+		return Resolver (parserContext).IsAsResolve (expression, caretLineNumber, caretColumn, fileName, fileContent)
 
-	def Resolve(parserService as IParserService, project as Project, expression as string, caretLineNumber as int, caretColumn as int, fileName as string, fileContent as string) as ResolveResult:
+	def Resolve(parserContext as IParserContext, expression as string, caretLineNumber as int, caretColumn as int, fileName as string, fileContent as string) as ResolveResult:
 		//print "Resolve ${expression} (${caretLineNumber}/${caretColumn})"
 		try:
-			return Resolver(project).Resolve(parserService, expression, caretLineNumber, caretColumn, fileName, fileContent)
+			return Resolver(parserContext).Resolve(expression, caretLineNumber, caretColumn, fileName, fileContent)
 		except e:
 			//ShowException(e)
 			return null
 
-	def MonodocResolver(parserService as IParserService, project as Project, expression as string, caretLineNumber as int, caretColumn as int, fileName as string, fileContent as string) as string:
+	def MonodocResolver(parserContext as IParserContext, expression as string, caretLineNumber as int, caretColumn as int, fileName as string, fileContent as string) as string:
 		//print "MonodocResolver ${expression} (${caretLineNumber}/${caretColumn})"
 		try:
-			return Resolver(project).MonodocResolver(parserService, expression, caretLineNumber, caretColumn, fileName, fileContent)
+			return Resolver(parserContext).MonodocResolver(expression, caretLineNumber, caretColumn, fileName, fileContent)
 		except e:
 			//ShowException(e)
 			return null

Modified: trunk/MonoDevelop/Extras/BooBinding/Parser/ExpressionTypeVisitor.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Parser/ExpressionTypeVisitor.boo	2005-08-09 23:48:21 UTC (rev 2724)
+++ trunk/MonoDevelop/Extras/BooBinding/Parser/ExpressionTypeVisitor.boo	2005-08-09 23:48:35 UTC (rev 2725)
@@ -122,7 +122,7 @@
 	private def FindMethods(c as IClass, name as string, arguments as int):
 		possibleOverloads = ArrayList()
 		//for cl as IClass in c.ClassInheritanceTree:
-		for cl as IClass in _resolver.ParserService.GetClassInheritanceTree(_resolver.Project, c):
+		for cl as IClass in _resolver.ParserContext.GetClassInheritanceTree(c):
 			for m as IMethod in cl.Methods:
 				if m.Parameters.Count == arguments and name == m.Name:
 					possibleOverloads.Add(m)
@@ -150,7 +150,7 @@
 	private def FindIndexer(c as IClass, arguments as int):
 		possibleOverloads = ArrayList()
 		//for cl as IClass in c.ClassInheritanceTree:
-		for cl as IClass in _resolver.ParserService.GetClassInheritanceTree(_resolver.Project, c):
+		for cl as IClass in _resolver.ParserContext.GetClassInheritanceTree(c):
 			for m as IIndexer in cl.Indexer:
 				if m.Parameters.Count == arguments:
 					possibleOverloads.Add(m)
@@ -202,7 +202,7 @@
 	
 	private def ProcessMember(name as string, parentClass as IClass):
 		return false if parentClass == null
-		for cl as IClass in _resolver.ParserService.GetClassInheritanceTree(_resolver.Project, parentClass):
+		for cl as IClass in _resolver.ParserContext.GetClassInheritanceTree(parentClass):
 			for c as IClass in cl.InnerClasses:
 				if c.Name == name:
 					CreateReturnType(c)

Modified: trunk/MonoDevelop/Extras/BooBinding/Parser/Resolver.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Parser/Resolver.boo	2005-08-09 23:48:21 UTC (rev 2724)
+++ trunk/MonoDevelop/Extras/BooBinding/Parser/Resolver.boo	2005-08-09 23:48:35 UTC (rev 2725)
@@ -32,22 +32,18 @@
 import System.IO
 import MonoDevelop.Services
 import MonoDevelop.Internal.Parser
-import MonoDevelop.Internal.Project
 import Boo.Lang.Compiler
 import Boo.Lang.Compiler.Ast as AST
 import Boo.Lang.Compiler.IO
 import Boo.Lang.Compiler.Steps
 
 class Resolver:
-	[Getter(ParserService)]
-	_parserService as IParserService
+	[Getter(ParserContext)]
+	_parserContext as IParserContext
 
 	_caretLine as int
 	_caretColumn as int
 
-	[Getter(Project)]
-	_project as Project
-	
 	[Getter(CallingClass)]
 	_callingClass as IClass
 	_compilationUnit as ICompilationUnit
@@ -75,8 +71,8 @@
 	def constructor ():
 		pass
 
-	def constructor (project as Project):
-		_project = project
+	def constructor (parserContext as IParserContext):
+		_parserContext = parserContext
 
 	#region Helper methods
 	private def ResolveCurrentMember() as IMember:
@@ -148,25 +144,24 @@
 	
 	def SearchType(name as string) as IClass:
 		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, _compilationUnit)
+		return _parserContext.GetClass(expandedName) if expandedName != null
+		//return _parserContext.SearchType(name, _callingClass, _caretLine, _caretColumn)
+		return _parserContext.SearchType(name, _callingClass, _compilationUnit)
 	
 	builtinClass as IClass
 	
 	BuiltinClass as IClass:
 		get:
-			builtinClass = _parserService.GetClass(_project, "Boo.Lang.Builtins") if builtinClass == null
+			builtinClass = _parserContext.GetClass("Boo.Lang.Builtins") if builtinClass == null
 			return builtinClass
 	
 	def IsNamespace(name as string) as bool:
-		return _parserService.NamespaceExists(_project, name)
+		return _parserContext.NamespaceExists(name)
 	
 	#endregion
 	
 	#region CtrlSpace-Completion
-	def CtrlSpace(parserService as IParserService, caretLine as int, caretColumn as int, fileName as string) as ArrayList:
-		_parserService = parserService
+	def CtrlSpace(caretLine as int, caretColumn as int, fileName as string) as ArrayList:
 		_caretLine = caretLine
 		_caretColumn = caretColumn
 		result = ArrayList(BooAmbience.TypeConversionTable.Values)
@@ -177,7 +172,7 @@
 			for method as IMethod in builtinClass.Methods:
 				result.Add(method)
 		
-		parseInfo = parserService.GetParseInformation(fileName)
+		parseInfo = _parserContext.GetParseInformation(fileName)
 		cu = parseInfo.MostRecentCompilationUnit as CompilationUnit
 		_compilationUnit = cu
 		if cu != null:
@@ -185,11 +180,11 @@
 			_callingClass = curClass
 			if curClass != null:
 				result = AddCurrentClassMembers(result, curClass)
-				result.AddRange(parserService.GetNamespaceContents(_project, curClass.Namespace, true, true))
+				result.AddRange(_parserContext.GetNamespaceContents(curClass.Namespace, true, true))
 			for u as IUsing in cu.Usings:
 				if u != null and (u.Region == null or u.Region.IsInside(caretLine, caretColumn)):
 					for name as string in u.Usings:
-						result.AddRange(parserService.GetNamespaceContents(_project, name, true, true))
+						result.AddRange(_parserContext.GetNamespaceContents(name, true, true))
 					for alias as string in u.Aliases.Keys:
 						result.Add(alias)
 			member = self.CurrentMember
@@ -215,7 +210,7 @@
 				if varList != null:
 					for e as DictionaryEntry in varList:
 						result.Add(Field(e.Value, e.Key, ModifierEnum.Private, null))
-		result.AddRange(parserService.GetNamespaceContents(_project, "", true, true))
+		result.AddRange(_parserContext.GetNamespaceContents("", true, true))
 		return result
 	
 	def AddCurrentClassMembers(result as ArrayList, curClass as IClass) as ArrayList:
@@ -236,19 +231,19 @@
 	
 	#region IsAsResolve
 
-	def IsAsResolve(parserService as IParserService, expression as string, caretLine as int, caretColumn as int, fileName as string, fileContent as string) as ArrayList: 
+	def IsAsResolve(expression as string, caretLine as int, caretColumn as int, fileName as string, fileContent as string) as ArrayList: 
 		return null
 
-	def MonodocResolver(parserService as IParserService, expression as string, caretLine as int, caretColumn as int, fileName as string, fileContent as string) as string: 
+	def MonodocResolver(expression as string, caretLine as int, caretColumn as int, fileName as string, fileContent as string) as string: 
 		return null
 
 	#region Resolve CC
-	def Initialize(parserService as IParserService, caretLine as int, caretColumn as int, fileName as string):
-		_parserService = parserService
+	def Initialize(parserService as IParserContext, caretLine as int, caretColumn as int, fileName as string):
+		_parserContext = parserService
 		_caretLine = caretLine
 		_caretColumn = caretColumn
 		
-		parseInfo = parserService.GetParseInformation(fileName)
+		parseInfo = _parserContext.GetParseInformation(fileName)
 		cu = parseInfo.MostRecentCompilationUnit as CompilationUnit
 		_compilationUnit = cu
 		if _compilationUnit == null:
@@ -260,24 +255,25 @@
 			if _callingClass != null and _callingClass.Region != null:
 				return false if _callingClass.Region.BeginLine > caretLine
 
-		if _project == null:
+/*		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:
+	def Resolve(expression as string, caretLine as int, caretColumn as int, fileName as string, fileContent as string) as ResolveResult:
 		if expression == null or expression == '':
 			return null
 		
 		if expression.StartsWith("import "):
 			expression = expression.Substring(7).Trim()
-			if parserService.NamespaceExists(_project, expression):
-				return ResolveResult(parserService.GetNamespaceList(_project, expression, true, true))
+			if _parserContext.NamespaceExists(expression):
+				return ResolveResult(_parserContext.GetNamespaceList(expression, true, true))
 			return null
 		
-		if not Initialize(parserService, caretLine, caretColumn, fileName):
+		if not Initialize(_parserContext, caretLine, caretColumn, fileName):
 			return null
 		callingClass = _callingClass
 		returnClass as IClass = null
@@ -293,8 +289,8 @@
 				return ResolveResult(expressionClass, ListMembers(ArrayList(), expressionClass, true))
 			
 			// try if it is the name of a namespace
-			if parserService.NamespaceExists(_project, expression):
-				return ResolveResult(array(string, 0), parserService.GetNamespaceContents(_project, expression, true, true))
+			if _parserContext.NamespaceExists(expression):
+				return ResolveResult(array(string, 0), _parserContext.GetNamespaceContents(expression, true, true))
 			
 			expr = Boo.Lang.Parser.BooParser.ParseExpression("expression", expression)
 			return null if expr isa AST.IntegerLiteralExpression
@@ -360,7 +356,7 @@
 			return true
 
 		for baseClass as string in c.BaseTypes:
-			bc = _parserService.GetClass (_project, baseClass, true, true)
+			bc = _parserContext.GetClass (baseClass, true, true)
 			if (IsClassInInheritanceTree(possibleBaseClass, bc)):
 				return true
 
@@ -368,7 +364,7 @@
 
 	def BaseClass(curClass as IClass) as IClass:
 		for s as string in curClass.BaseTypes:
-			baseClass = _parserService.GetClass (_project, s, true, true)
+			baseClass = _parserContext.GetClass (s, true, true)
 			if ((baseClass != null) and (baseClass.ClassType != ClassType.Interface)):
 				return baseClass
 		return null
@@ -421,7 +417,7 @@
 //		print("ClassType = " + curType.ClassType)
 		if (curType.ClassType == ClassType.Interface and not _showStatic):
 			for s as string in curType.BaseTypes:
-				baseClass = _parserService.GetClass (_project, s, true, true)
+				baseClass = _parserContext.GetClass (s, true, true)
 				if (baseClass != null and baseClass.ClassType == ClassType.Interface):
 					ListMembers(members, baseClass)
 		else:
@@ -435,7 +431,7 @@
 
 	def GetResolvedClass (cls as IClass) as IClass:
 		// Returns an IClass in which all type names have been properly resolved
-		return _parserService.GetClass (_project, cls.FullyQualifiedName)
+		return _parserContext.GetClass (cls.FullyQualifiedName)
 
 	def GetInnermostClass(cu as ICompilationUnit) as IClass:
 		if (cu != null):

Modified: trunk/MonoDevelop/Extras/BooBinding/Parser/ReturnType.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Parser/ReturnType.boo	2005-08-09 23:48:21 UTC (rev 2724)
+++ trunk/MonoDevelop/Extras/BooBinding/Parser/ReturnType.boo	2005-08-09 23:48:35 UTC (rev 2725)
@@ -29,6 +29,7 @@
 import System.Collections
 import System.Diagnostics
 import MonoDevelop.Internal.Parser
+import MonoDevelop.Core.Services
 import MonoDevelop.Services
 import Boo.Lang.Compiler.Ast as AST
 
@@ -189,8 +190,8 @@
 	
 	def Resolve() as IReturnType:
 		resolver = Resolver()
-		parserService = MonoDevelop.Core.Services.ServiceManager.GetService(typeof(IParserService))
-		if resolver.Initialize(parserService, _caretLine, _caretColumn, _filename):
+		projService = ServiceManager.GetService(typeof(ProjectService)) as ProjectService
+		if resolver.Initialize(projService.ParserDatabase.GetFileParserContext (_filename), _caretLine, _caretColumn, _filename):
 			visitor = ExpressionTypeVisitor(Resolver : resolver)
 			visitor.Visit(_expression)
 			return visitor.ReturnType




More information about the Monodevelop-patches-list mailing list