summaryrefslogtreecommitdiff
path: root/src/main/java/com/seaofnodes/simple/Var.java
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2025-06-13 15:42:08 -0700
committerCliff Click <cliffc@acm.org>2025-07-08 20:29:09 -0700
commitfcce1e13814a02d8358eae9a40e33a7e6f2b5400 (patch)
treeb9623369d88e22a0be21dbba472eebfa476d02ab /src/main/java/com/seaofnodes/simple/Var.java
parent664761624f4b0e3d6d1593b99e576854beec5949 (diff)
downloadSimple-linear-chapter24.tar.gz
Simple-linear-chapter24.zip
Unifying Structs and Arrayslinear-chapter24
Diffstat (limited to 'src/main/java/com/seaofnodes/simple/Var.java')
-rw-r--r--src/main/java/com/seaofnodes/simple/Var.java53
1 files changed, 0 insertions, 53 deletions
diff --git a/src/main/java/com/seaofnodes/simple/Var.java b/src/main/java/com/seaofnodes/simple/Var.java
deleted file mode 100644
index cf549cd6..00000000
--- a/src/main/java/com/seaofnodes/simple/Var.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.seaofnodes.simple;
-
-import com.seaofnodes.simple.type.*;
-
-
-/**
- * The tracked fields are now complex enough to deserve a array-of-structs layout
- */
-public class Var {
-
- public final String _name; // Declared name
- // These fields are not final for forward reference late updates or
- // promotions.
- public int _idx; // index in containing scope
- private Type _type; // Declared type
- public boolean _final; // Final field
- public boolean _fref; // Forward ref
- public Parser.Lexer _loc; // Source location
-
- public Var(int idx, String name, Type type, boolean xfinal, Parser.Lexer loc ) {
- this(idx,name,type,xfinal,loc,false);
- }
- public Var(int idx, String name, Type type, boolean xfinal, Parser.Lexer loc, boolean fref) {
- _idx = idx;
- _name = name;
- _type = type;
- _final = xfinal;
- _fref = fref;
- _loc = loc;
- }
- public Type type() {
- if( !_type.isFRef() ) return _type;
- // Update self to no longer use the forward ref type
- Type def = Parser.TYPES.get(((TypeMemPtr)_type)._obj._name);
- return (_type=_type.meet(def));
- }
-
- // Forward reference variables (not types) must be BOTTOM and
- // distinct from inferred variables
- public boolean isFRef() { return _fref; }
-
- public void defFRef( Type type, boolean xfinal, Parser.Lexer loc ) {
- assert isFRef() && xfinal;
- _type = type;
- _final = true;
- _fref = false;
- _loc = loc;
- }
-
- @Override public String toString() {
- return _type.toString()+(_final ? " ": " !")+_name;
- }
-}