Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def attachParents(prog: Program, glob: GlobalScope): Unit = {
- for (c <- prog.classes){
- c.parent match{
- case Some(cc) => {
- if (!(glob.classes contains cc.value)){
- fatal("Class "+ cc.value +" inherited from "+ c.id.value +" does not exists at "+c.posString)
- }
- glob.classes.get(c.id.value).get.parent= glob.classes.get(cc.value)
- }
- case _ => {/*no parent*/}
- }
- }
- }
- def attachParents(prog: Program, glob: GlobalScope): Unit = {
- for (c <- prog.classes) c match {
- case ClassDecl(Identifier(id), Some(Identifier(parent)), _, _) => {
- if ((glob.classes contains parent)){
- glob.classes.get(id).get.parent = glob.classes.get(parent)
- }
- else fatal("Class "+ parent +" inherited from "+ id +" does not exists at " + c.posString)
- }
- case _ =>
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement