diff options
| author | Cliff Click <cliffc@acm.org> | 2025-04-21 14:18:23 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2025-07-03 09:50:14 -0700 |
| commit | 018379b0cf4e286ceacb1e39f34dd80f770e381e (patch) | |
| tree | d88eae2d5e2d9609f271ec78fb60aaf08c5aaee5 /src/main/java/com/seaofnodes/simple/Var.java | |
| parent | 49534ffa88fedb3a4ebc42094e9edb27d456e6d6 (diff) | |
| download | Simple-linear-chapter22.tar.gz Simple-linear-chapter22.zip | |
Chapter 22: A Hello, World!linear-chapter22
Co-authored-by: godalming123 <68993177+godalming123@users.noreply.github.com>
Co-authored-by: Tamás Hadházy <85063808+Hels15@users.noreply.github.com>
Diffstat (limited to 'src/main/java/com/seaofnodes/simple/Var.java')
| -rw-r--r-- | src/main/java/com/seaofnodes/simple/Var.java | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main/java/com/seaofnodes/simple/Var.java b/src/main/java/com/seaofnodes/simple/Var.java index e71d7ef2..cf549cd6 100644 --- a/src/main/java/com/seaofnodes/simple/Var.java +++ b/src/main/java/com/seaofnodes/simple/Var.java @@ -9,11 +9,13 @@ import com.seaofnodes.simple.type.*; 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 Parser.Lexer _loc; // Source location 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); @@ -23,8 +25,8 @@ public class Var { _name = name; _type = type; _final = xfinal; - _loc = loc; _fref = fref; + _loc = loc; } public Type type() { if( !_type.isFRef() ) return _type; @@ -32,10 +34,6 @@ public class Var { Type def = Parser.TYPES.get(((TypeMemPtr)_type)._obj._name); return (_type=_type.meet(def)); } - public Type lazyGLB() { - Type t = type(); - return t instanceof TypeMemPtr ? t : t.glb(); - } // Forward reference variables (not types) must be BOTTOM and // distinct from inferred variables @@ -45,8 +43,8 @@ public class Var { assert isFRef() && xfinal; _type = type; _final = true; - _loc = loc; _fref = false; + _loc = loc; } @Override public String toString() { |
