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

Method typeAry

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

Source from the content-addressed store, hash-verified

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