Initial commit of main compiler sources (or should I say ... SAUCES!)

This commit is contained in:
2025-06-08 23:58:21 +10:00
parent 60c566025c
commit 06f2613083
214 changed files with 22210 additions and 0 deletions

View File

@ -0,0 +1,34 @@
package slangc.api;
import slangc.codegraph.DynamicPackage;
public class CompilerPackage extends DynamicPackage {
private Unit[] units = new Unit[0];
public CompilerPackage() {
// TODO Auto-generated constructor stub
}
@Override
public CompilerSet getEnclosingContainer() {
// TODO Auto-generated method stub
return (CompilerSet) super.getEnclosingContainer();
}
public int countUnits() {
return units.length;
}
public void addUnit(Unit u) {
if (u.getPackageName().equals(getSimpleName())) {
Unit[] nunits = new Unit[units.length + 1];
for (int i = 0; i < units.length; i++) {
nunits[i] = units[i];
}
nunits[nunits.length - 1] = u;
units = nunits;
} else {
throw new Error("Package name mismatch");
}
}
}