summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2014-11-27 16:45:44 +0800
committerIru Cai <mytbk920423@gmail.com>2014-11-27 16:45:44 +0800
commitc8375c2e39e92412dd01fb880062dd2e9c97b41a (patch)
tree5ff766a2f09f32e214c4485d84284dc0d57ab00c
parent54cea0227c88792db9d5cfb13896ecc7408fb564 (diff)
downloadminijava-c8375c2e39e92412dd01fb880062dd2e9c97b41a.tar.xz
check null pointer in SpgExpr...
-rw-r--r--src/spiglet/spiglet2kanga/SpgExpr.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/spiglet/spiglet2kanga/SpgExpr.java b/src/spiglet/spiglet2kanga/SpgExpr.java
index 9f5fef9..a93601d 100644
--- a/src/spiglet/spiglet2kanga/SpgExpr.java
+++ b/src/spiglet/spiglet2kanga/SpgExpr.java
@@ -55,15 +55,22 @@ public class SpgExpr extends SpgSym {
public HashSet<SpgTemp> getTmpUsed() {
HashSet<SpgTemp> s = new HashSet<SpgTemp>();
+ HashSet<SpgTemp> stmp;
switch (type) {
case ALLOC:
return se.getTmpUsed();
case BinOp:
s.add(oprand);
- s.addAll(se.getTmpUsed());
+ stmp = se.getTmpUsed();
+ if (stmp!=null) {
+ s.addAll(se.getTmpUsed());
+ }
return s;
case CALL:
- s.addAll(se.getTmpUsed());
+ stmp = se.getTmpUsed();
+ if (stmp!=null) {
+ s.addAll(se.getTmpUsed());
+ }
s.addAll(callParams);
return s;
case Simple: