Bläddra i källkod

fix multiple forward declarations to the same type

Vladislav Folts 11 år sedan
förälder
incheckning
a67134562a
4 ändrade filer med 15 tillägg och 4 borttagningar
  1. 6 0
      test/expected/pointer.js
  2. 0 3
      test/input/cast.ob
  3. 6 0
      test/input/pointer.ob
  4. 3 1
      test/test_unit.js

+ 6 - 0
test/expected/pointer.js

@@ -26,8 +26,13 @@ var T2 = RTL$.extend({
 		this.p = null;
 		this.p = null;
 	}
 	}
 });
 });
+var Forward = RTL$.extend({
+	init: function Forward(){
+	}
+});
 var r = new T();
 var r = new T();
 var r2 = null;
 var r2 = null;
+var pf = null;
 var anonymous$1 = RTL$.extend({
 var anonymous$1 = RTL$.extend({
 	init: function anonymous$1(){
 	init: function anonymous$1(){
 	}
 	}
@@ -38,5 +43,6 @@ r.p.p = new T();
 r.p.i = 123;
 r.p.i = 123;
 r2 = new T2();
 r2 = new T2();
 r2.p = new T();
 r2.p = new T();
+pf = new Forward();
 pAnonymous = new anonymous$1();
 pAnonymous = new anonymous$1();
 }();
 }();

+ 0 - 3
test/input/cast.ob

@@ -9,9 +9,6 @@ TYPE
 
 
     PAnonymousDerived = POINTER TO RECORD(Base) field3: INTEGER END;
     PAnonymousDerived = POINTER TO RECORD(Base) field3: INTEGER END;
 
 
-    (*PForward1 = POINTER TO Forward;
-    PForward2 = POINTER TO Forward;
-    Forward = RECORD END;*)
 VAR
 VAR
 	pb: POINTER TO Base;
 	pb: POINTER TO Base;
 	pd1: POINTER TO Derived1;
 	pd1: POINTER TO Derived1;

+ 6 - 0
test/input/pointer.ob

@@ -2,9 +2,13 @@ MODULE m;
 TYPE
 TYPE
 	T = RECORD p: POINTER TO T; i: INTEGER END;
 	T = RECORD p: POINTER TO T; i: INTEGER END;
 	T2 = POINTER TO RECORD p: POINTER TO T(*2*) END;
 	T2 = POINTER TO RECORD p: POINTER TO T(*2*) END;
+
+    PForward = POINTER TO Forward;
+    Forward = RECORD END;
 VAR
 VAR
 	r: T;
 	r: T;
 	r2: T2;
 	r2: T2;
+	pf: PForward;
 	pAnonymous: POINTER TO RECORD END;
 	pAnonymous: POINTER TO RECORD END;
 
 
 BEGIN
 BEGIN
@@ -16,5 +20,7 @@ BEGIN
 	NEW(r2.p);
 	NEW(r2.p);
 	(*r2.p := r2;*)
 	(*r2.p := r2;*)
 
 
+	NEW(pf);
+
 	NEW(pAnonymous);
 	NEW(pAnonymous);
 END m.
 END m.

+ 3 - 1
test/test_unit.js

@@ -331,7 +331,9 @@ var testSuite = {
     ),
     ),
 "POINTER forward declaration": testWithContext(
 "POINTER forward declaration": testWithContext(
     context(Grammar.module, ""),
     context(Grammar.module, ""),
-    pass("MODULE m; TYPE T = POINTER TO NotDeclaredYet; NotDeclaredYet = RECORD END; END m."),
+    pass("MODULE m; TYPE T = POINTER TO NotDeclaredYet; NotDeclaredYet = RECORD END; END m.",
+         "MODULE m; TYPE T1 = POINTER TO NotDeclaredYet; T2 = POINTER TO NotDeclaredYet; NotDeclaredYet = RECORD END; END m."
+         ),
     fail(["MODULE m; TYPE T = POINTER TO NotDeclaredYet; END m.",
     fail(["MODULE m; TYPE T = POINTER TO NotDeclaredYet; END m.",
           "no declaration found for 'NotDeclaredYet'"],
           "no declaration found for 'NotDeclaredYet'"],
          ["MODULE m; TYPE T1 = POINTER TO NotDeclaredYet1; T2 = POINTER TO NotDeclaredYet2; END m.",
          ["MODULE m; TYPE T1 = POINTER TO NotDeclaredYet1; T2 = POINTER TO NotDeclaredYet2; END m.",