Hi,

On Sunday 05 June 2011 17:51:32 Victor Fusco wrote:
> I am receiving a segfault when trying to generate code for a
> valuetype. I think it has something to do with the valuetype
> supporting an interface that is an alias.

I hit another case of the valuetype alias problem, but this time I got 
an error instead of a segmentation fault. It happens when a valuetype 
extends a valuetype that is an alias.

I've attached the new testcase and a patch that fixes the problem.

Thanks,

Victor Fusco



"The future is here. It's just not widely distributed yet."
  William Gibson
Index: idlparser.cc
===================================================================
--- idlparser.cc	(revision 118683)
+++ idlparser.cc	(working copy)
@@ -2241,8 +2241,13 @@
     while (sins != NULL) {
       assert (sins->getType() == scoped_names);
       ParseNode * sin = sins->getBranch (1);
-      CORBA::IDLType_var t = collectType (con, sin);
-      CORBA::InterfaceDef_ptr sif = CORBA::InterfaceDef::_narrow (t);
+      CORBA::IDLType_var resolv_type = collectType (con, sin);
+      while( resolv_type->def_kind() == CORBA::dk_Alias ) {
+        CORBA::AliasDef_var a = CORBA::AliasDef::_narrow( resolv_type );
+        assert( !CORBA::is_nil( a ) );
+        resolv_type = a->original_type_def();
+      }
+      CORBA::InterfaceDef_ptr sif = CORBA::InterfaceDef::_narrow (resolv_type);
 
       if (sif->def_kind() == CORBA::dk_Interface) {
 	if (have_concrete_if) {
@@ -2300,8 +2305,13 @@
 	      cvt->getType() == t_valuebase);
     
       if (cvt->getType() == scoped_name) {
-	CORBA::IDLType_var t = collectType (con, cvt);
-	base_value = CORBA::ValueDef::_narrow (t);
+	CORBA::IDLType_var resolv_type = collectType (con, cvt);
+	while( resolv_type->def_kind() == CORBA::dk_Alias ) {
+		CORBA::AliasDef_var a = CORBA::AliasDef::_narrow( resolv_type );
+		assert( !CORBA::is_nil( a ) );
+		resolv_type = a->original_type_def();
+	}
+	base_value = CORBA::ValueDef::_narrow (resolv_type);
 	if (CORBA::is_nil (base_value)) {
 	  cerr << IDLError (8, cvt, cvt->getIdent()) << endl;
 	  exit (1);
module scope1 {

module scope2 {

abstract interface MyAbstractInterface {
    string getName();
};

valuetype MyValueType supports MyAbstractInterface {
    public boolean value;
};

};

module scope3 {

typedef scope1::scope2::MyValueType MyValueType;

valuetype MyExtendedValueType : MyValueType {
    public boolean valid;
};

};
};
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Mico-devel mailing list
Mico-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mico-devel

Reply via email to