[Monodevelop-patches-list] r2568 - in trunk/MonoDevelop/Extras/BooBinding: . Parser
Peter Johanson <latexer@gentoo.org>
pjohanson at mono-cvs.ximian.com
Mon May 30 20:49:18 EDT 2005
Author: pjohanson
Date: 2005-05-30 20:49:18 -0400 (Mon, 30 May 2005)
New Revision: 2568
Modified:
trunk/MonoDevelop/Extras/BooBinding/ChangeLog
trunk/MonoDevelop/Extras/BooBinding/Parser/TypeMembers.boo
trunk/MonoDevelop/Extras/BooBinding/Parser/Visitor.boo
Log:
Cleanups, fix get/set for properties, and properly set the FullyQualifiedName entry for things.
Modified: trunk/MonoDevelop/Extras/BooBinding/ChangeLog
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/ChangeLog 2005-05-30 17:19:48 UTC (rev 2567)
+++ trunk/MonoDevelop/Extras/BooBinding/ChangeLog 2005-05-31 00:49:18 UTC (rev 2568)
@@ -1,5 +1,13 @@
2005-05-30 Peter Johanson <latexer at gentoo.org>
+ * Parser/TypeMembers.boo: Cleanup, and add handling
+ of get/set for properties properly.
+ * Parser/Visitor.boo: Handling of get/set for properties,
+ move to using FullName where appropriate for class members,
+ and set enum return types to null.
+
+2005-05-30 Peter Johanson <latexer at gentoo.org>
+
* Parser/Visitor.boo: Only abort parsing on parser
errors. We may have type binding errors that should be
ignored, since we do the resolving of those ourselves.
Modified: trunk/MonoDevelop/Extras/BooBinding/Parser/TypeMembers.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Parser/TypeMembers.boo 2005-05-30 17:19:48 UTC (rev 2567)
+++ trunk/MonoDevelop/Extras/BooBinding/Parser/TypeMembers.boo 2005-05-31 00:49:18 UTC (rev 2568)
@@ -29,9 +29,6 @@
import MonoDevelop.Internal.Parser
import Boo.Lang.Compiler.Ast as AST
-/////////////////////////////////////
-/// Constructor ///
-/////////////////////////////////////
class Constructor(BooAbstractMethod):
def constructor(m as ModifierEnum, region as IRegion, bodyRegion as IRegion):
FullyQualifiedName = 'ctor'
@@ -39,10 +36,6 @@
self.bodyRegion = bodyRegion
modifiers = m
-
-/////////////////////////////////////
-/// Destructor ///
-/////////////////////////////////////
class Destructor(BooAbstractMethod):
def constructor(className as string, m as ModifierEnum, region as IRegion, bodyRegion as IRegion):
FullyQualifiedName = '~' + className
@@ -57,9 +50,6 @@
def AddModifier(m as ModifierEnum):
modifiers = modifiers | m
-/////////////////////////////////////
-/// Event ///
-/////////////////////////////////////
class Event(AbstractEvent):
def AddModifier(m as ModifierEnum):
modifiers = modifiers | m
@@ -71,10 +61,6 @@
self.bodyRegion = bodyRegion
modifiers = m
-
-/////////////////////////////////////
-/// Field ///
-/////////////////////////////////////
class Field(AbstractField):
def AddModifier(m as ModifierEnum):
modifiers = modifiers | m
@@ -88,10 +74,6 @@
def SetModifiers(m as ModifierEnum):
modifiers = m
-
-/////////////////////////////////////
-/// Indexer ///
-/////////////////////////////////////
class Indexer(AbstractIndexer):
def AddModifier(m as ModifierEnum):
modifiers = modifiers | m
@@ -103,10 +85,6 @@
self.bodyRegion = bodyRegion
modifiers = m
-
-/////////////////////////////////////
-/// Method ///
-/////////////////////////////////////
class Method(BooAbstractMethod):
def constructor(name as string, rtype as IReturnType, m as ModifierEnum, region as IRegion, bodyRegion as IRegion):
FullyQualifiedName = name
@@ -115,10 +93,6 @@
self.bodyRegion = bodyRegion
modifiers = m
-
-/////////////////////////////////////
-/// Property ///
-/////////////////////////////////////
class Property(AbstractProperty):
[Property(Node)]
_node as AST.Property
@@ -126,9 +100,13 @@
def AddModifier(m as ModifierEnum):
modifiers = modifiers | m
- def constructor(fullyQualifiedName as string, rtype as IReturnType, m as ModifierEnum, region as IRegion, bodyRegion as IRegion):
+ def constructor(fullyQualifiedName as string, rtype as IReturnType, getter as IMethod, setter as IMethod, getRegion as IRegion, setRegion as IRegion, m as ModifierEnum, region as IRegion, bodyRegion as IRegion):
self.FullyQualifiedName = fullyQualifiedName
self.returnType = rtype
+ self.getterMethod = getter
+ self.setterMethod = setter
+ self.getterRegion = getRegion
+ self.setterRegion = setRegion
self.region = region
self.bodyRegion = bodyRegion
modifiers = m
Modified: trunk/MonoDevelop/Extras/BooBinding/Parser/Visitor.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Parser/Visitor.boo 2005-05-30 17:19:48 UTC (rev 2567)
+++ trunk/MonoDevelop/Extras/BooBinding/Parser/Visitor.boo 2005-05-31 00:49:18 UTC (rev 2568)
@@ -196,20 +196,22 @@
override def OnMethod(node as AST.Method):
try:
- // Since we visit after ProcessMethodBodies, we may have
- // some compiler generated methods (prefixed with ___)
if node.Name.StartsWith("___"):
return
- method = Method(node.Name, ReturnType.CreateReturnType(node), GetModifier(node), GetRegion(node), GetClientRegion(node))
- method.Parameters = GetParameters(node.Parameters)
- method.Node = node
- method.Documentation = node.Documentation
+ method = GetMethod(node)
cast(Class, _currentClass.Peek()).Methods.Add(method)
except ex:
print ex.ToString()
raise
+ private def GetMethod(node as AST.Method):
+ method = Method(node.FullName, ReturnType.CreateReturnType(node), GetModifier(node), GetRegion(node), GetClientRegion(node))
+ method.Parameters = GetParameters(node.Parameters)
+ method.Node = node
+ method.Documentation = node.Documentation
+ return method
+
private def GetParameters(params as AST.ParameterDeclarationCollection):
parameters = ParameterCollection()
return parameters if params == null
@@ -224,11 +226,11 @@
ctor.Node = node
ctor.Documentation = node.Documentation
cast(Class, _currentClass.Peek()).Methods.Add(ctor)
-
+
override def OnEnumMember(node as AST.EnumMember):
try:
c as Class = _currentClass.Peek()
- field = Field(ReturnType(c), node.Name, GetModifier(node), GetRegion(node))
+ field = Field(null, node.Name, GetModifier(node), GetRegion(node))
field.Documentation = node.Documentation
field.SetModifiers(ModifierEnum.Const | ModifierEnum.SpecialName)
c.Fields.Add(field)
@@ -243,7 +245,7 @@
return
c as Class = _currentClass.Peek()
- field = Field(ReturnType.CreateReturnType(node), node.Name, GetModifier(node), GetRegion(node))
+ field = Field(ReturnType.CreateReturnType(node), node.FullName, GetModifier(node), GetRegion(node))
field.Documentation = node.Documentation
c.Fields.Add(field)
except ex:
@@ -252,7 +254,18 @@
override def OnProperty(node as AST.Property):
try:
- property = Property(node.Name, ReturnType.CreateReturnType(node), GetModifier(node), GetRegion(node), GetClientRegion(node))
+ getter as Method
+ setter as Method
+ getRegion as IRegion
+ setRegion as IRegion
+ if node.Getter is not null:
+ getter = GetMethod(node.Getter)
+ getRegion = GetRegion(node.Getter)
+ if node.Setter is not null:
+ setter = GetMethod(node.Setter)
+ setRegion = GetRegion(node.Setter)
+
+ property = Property(node.FullName, ReturnType.CreateReturnType(node), getter, setter, getRegion, setRegion, GetModifier(node), GetRegion(node), GetClientRegion(node))
property.Documentation = node.Documentation
property.Node = node
cast(Class, _currentClass.Peek()).Properties.Add(property)
@@ -262,7 +275,7 @@
override def OnEvent (node as AST.Event):
try:
- ev = Event (node.Name, ReturnType(node.Type), GetModifier(node), GetRegion(node), GetClientRegion(node))
+ ev = Event (node.FullName, ReturnType(node.Type), GetModifier(node), GetRegion(node), GetClientRegion(node))
ev.Documentation = node.Documentation
cast(Class, _currentClass.Peek()).Events.Add(ev)
except ex:
More information about the Monodevelop-patches-list
mailing list