Skip to content

Commit

Permalink
Classes are most definitely on fire
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Clive committed Nov 15, 2014
1 parent 2022595 commit a19617d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/decaf/AST/DecafAST.scala
Expand Up @@ -462,7 +462,7 @@ import scala.util.parsing.input.{Position, Positional}
s"\n*** EXTREMELY BAD PROBLEM occurs on line ${loc.line}" +
s"\n*** this should not happen ever, please contact the decaf implementors and I am sorry" +
s"\n*** code:\n${loc.longString}")
case ClassAnnotation(_, _, _, classScope, where) => classScope.get(field.name) match {
case ClassAnnotation(_, _, _, classScope, where) => classScope.table.get(field.name) match {
case Some(thing) => thing match {
case VariableAnnotation(t, _) => t
case MethodAnnotation(_, _, _) => new ErrorType("*** Attempt to field access a method", where)
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/decaf/AST/annotations/ClassAnnotation.scala
@@ -1,6 +1,7 @@
package decaf.AST.annotations

import decaf.AST.{ScopeTable, NamedType}
import decaf.frontend.ScopeNode

import scala.util.parsing.input.Position

Expand All @@ -10,7 +11,7 @@ import scala.util.parsing.input.Position
case class ClassAnnotation(name: NamedType,
ext: Option[NamedType],
implements: List[NamedType],
classScope: ScopeTable,
classScope: ScopeNode,
pos: Position) extends TypeAnnotation(pos) {
override def matches(that: TypeAnnotation): Boolean = that match {
// matches if the that is equal to this
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/decaf/frontend/DecafSemantic.scala
Expand Up @@ -308,7 +308,7 @@ object DecafSemantic {
new ClassAnnotation(new NamedType(c.name),
c.extnds,
c.implements,
cscope.table,
cscope,
c.pos))

}
Expand Down Expand Up @@ -539,11 +539,11 @@ object DecafSemantic {
}).getOrElse(Nil)

if(c.extnds.isDefined && extErr.length == 0) {
val nstate = c.extnds.get.state
val nstate = classState.table.get(c.extnds.get.name.name)
if(nstate.isEmpty) {
throw new Exception("EVERYTHING IS ON FIRE")
} else {
classState.reparent(nstate.get)
classState.reparent(nstate.get.asInstanceOf[ClassAnnotation].classScope)
}
}

Expand Down

0 comments on commit a19617d

Please sign in to comment.