MCPcopy Create free account
hub / github.com/SeaOfNodes/Simple / typeAry

Method typeAry

chapter23/src/main/java/com/seaofnodes/simple/Parser.java:961–973  ·  view source on GitHub ↗
( Type t, boolean efinal )

Source from the content-addressed store, hash-verified

959
960 // Make an array type of t
961 private TypeMemPtr typeAry( Type t, boolean efinal ) {
962 if( t instanceof TypeMemPtr tmp && tmp.notNull() )
963 throw error("Arrays of reference types must always be nullable");
964 String tname = "[]"+t.str();
965 TypeMemPtr ta = (TypeMemPtr)TYPES.get(tname);
966 if( ta==null )
967 // Remember final version
968 TYPES.put(tname, ta = TypeMemPtr.make( TypeStruct.makeAry(tname,TypeInteger.U32,_code.getALIAS(),t,_code.getALIAS(),true) ));
969 Field elem = ta._obj.field("[]");
970 if( elem._final == efinal )
971 return ta;
972 return TypeMemPtr.make( ta._obj.replace(elem.makeFrom(efinal)));
973 }
974
975 // A function type is `{ type... -> type }` or `{ type }`.
976 private Type typeFunPtr() {

Callers 3

typeMethod · 0.95
allocMethod · 0.95
newStringMethod · 0.95

Calls 11

errorMethod · 0.95
makeMethod · 0.95
makeAryMethod · 0.95
makeFromMethod · 0.95
notNullMethod · 0.45
strMethod · 0.45
getMethod · 0.45
putMethod · 0.45
getALIASMethod · 0.45
fieldMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected