Initial commit of main compiler sources (or should I say ... SAUCES!)
This commit is contained in:
34
slangc/api/CompilerPackage.sauce
Normal file
34
slangc/api/CompilerPackage.sauce
Normal 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");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user