summaryrefslogtreecommitdiff
path: root/typecheck
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-04-10 23:40:25 -0600
committerbd-912 <bdunahu@colostate.edu>2024-04-10 23:40:25 -0600
commit1080b37bbe40fe56b919d22804c159cccdca3c95 (patch)
tree8ddbb9528f575e537f925b266c8f366be6acc8b7 /typecheck
parent61a28b7f8e709d1884ccab15f0dc38ed19dfde70 (diff)
Library rename, created A4 directories
Diffstat (limited to 'typecheck')
-rw-r--r--typecheck/library/TypeCheckSimp.java2
-rw-r--r--typecheck/tests/IsPositive.java18
2 files changed, 16 insertions, 4 deletions
diff --git a/typecheck/library/TypeCheckSimp.java b/typecheck/library/TypeCheckSimp.java
index 1a77477..2eb5bf1 100644
--- a/typecheck/library/TypeCheckSimp.java
+++ b/typecheck/library/TypeCheckSimp.java
@@ -175,7 +175,7 @@ public class TypeCheckSimp extends GJDepthFirst<TypeInstance,SymbolTable> {
n.f8.accept(this, symt);
n.f9.accept(this, symt);
n.f10.accept(this, symt);
- // TypeInstance args = n.f11.accept(this, symt); // FIXME Type in the main class declaration uses an illegal minijava type?
+ // TypeInstance args = n.f11.accept(this, symt);
n.f12.accept(this, symt);
n.f13.accept(this, symt);
TypeInstance var_dec = n.f14.accept(this, symt);
diff --git a/typecheck/tests/IsPositive.java b/typecheck/tests/IsPositive.java
index 087cd3f..09bcf1d 100644
--- a/typecheck/tests/IsPositive.java
+++ b/typecheck/tests/IsPositive.java
@@ -1,12 +1,24 @@
class IsPositive{
public static void main(String[] a){
- System.out.println(new Positive().isPos(10));
+ System.out.println(new Positive().isPositive(10));
}
}
class Positive {
- public bool isPos(int num){
- bool positive ;
+ public boolean isPositive(int num){
+ boolean positive ;
+
+ if (0 < num)
+ positive = true ;
+ else
+ positive = false ;
+ return positive ;
+ }
+}
+
+class Positive2 extends Positive {
+ public boolean isPositive(int num){
+ boolean positive ;
if (0 < num)
positive = true ;