File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ let addMethodsToMethodTable className methodTable cmethod =
91
91
Hashtbl. add methodTable nameMethod cmethod
92
92
end
93
93
else begin
94
- print_endline( " function " ^ cmethod.mname ^ " already in the method table " )
94
+ raise( SameFunctionAlreadyDefined (nameMethod ^ " already defined in method Table " ) )
95
95
end
96
96
97
97
@@ -111,7 +111,7 @@ let addMethodsToClassDesciptor className methods cmethod =
111
111
Hashtbl. add methods nameKey nameMethod
112
112
end
113
113
else begin
114
- print_endline( " function " ^ cmethod.mname ^ " already defined" )
114
+ raise( SameFunctionAlreadyDefined (nameKey ^ " already defined in ClassDesciptor " ^ className ) )
115
115
end
116
116
117
117
let addConstructorsToClassDesciptor constructorsClass constructor =
@@ -180,6 +180,7 @@ let rec compileClass methodTable classTable ast asttype =
180
180
addToClassTable classTable asttype.id c;
181
181
addToMethodTable methodTable asttype.id c;
182
182
with
183
+ | SameFunctionAlreadyDefined str -> raise(SameFunctionAlreadyDefined (str))
183
184
| _ -> raise(ParentClassNotDefined (c.cparent.tid))
184
185
end
185
186
end
Original file line number Diff line number Diff line change
1
+ class B extends A {
2
+ public void f1 (){
3
+ }
4
+ }
5
+
6
+ class A {
7
+
8
+ int a = 5 ;
9
+ String b ="abc" ;
10
+ public void f1 (){
11
+ }
12
+
13
+ public void f1 (int b ){
14
+ }
15
+
16
+ public void f1 (int d ){
17
+ }
18
+
19
+ public A (int num )
20
+ {
21
+ int a = num ;
22
+ }
23
+
24
+
25
+ }
26
+
27
+
28
+ class C {
29
+
30
+ }
You can’t perform that action at this time.
0 commit comments