From 1080b37bbe40fe56b919d22804c159cccdca3c95 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Wed, 10 Apr 2024 23:40:25 -0600 Subject: Library rename, created A4 directories --- typecheck/library/TypeCheckSimp.java | 2 +- typecheck/tests/IsPositive.java | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'typecheck') 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 { 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 ; -- cgit v1.2.3