-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add some checks, flatten stack trace a bit
- Loading branch information
1 parent
4b0ae51
commit 5c2b0d2
Showing
21 changed files
with
136 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
src/col/vct/col/ast/declaration/category/ApplicableImpl.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
package vct.col.ast.declaration.category | ||
|
||
import vct.col.ast.declaration.DeclarationImpl | ||
import vct.col.ast.util.Declarator | ||
import vct.col.ast.{Applicable, Declaration, Node, Type, Variable} | ||
import vct.col.check.CheckContext | ||
|
||
trait ApplicableImpl[G] extends Declarator[G] { this: Applicable[G] => | ||
trait ApplicableImpl[G] extends DeclarationImpl[G] with Declarator[G] { this: Applicable[G] => | ||
def args: Seq[Variable[G]] | ||
def returnType: Type[G] | ||
def body: Option[Node[G]] | ||
|
||
override def declarations: Seq[Declaration[G]] = args | ||
|
||
override def enterCheckContext(context: CheckContext[G]): CheckContext[G] = | ||
super.enterCheckContext(context).withApplicable(this) | ||
override def enterCheckContextCurrentApplicable(context: CheckContext[G]): Option[Applicable[G]] = Some(this) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/col/vct/col/ast/expr/context/ThisDeclarationImpl.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package vct.col.ast.expr.context | ||
|
||
import vct.col.ast.{Declaration, ThisDeclaration} | ||
import vct.col.ast.expr.ExprImpl | ||
import vct.col.check.{CheckContext, CheckError, ThisOutsideScopeError} | ||
import vct.col.ref.Ref | ||
|
||
trait ThisDeclarationImpl[G] extends ExprImpl[G] { this: ThisDeclaration[G] => | ||
def cls: Ref[G, _ <: Declaration[G]] | ||
|
||
override def check(context: CheckContext[G]): Seq[CheckError] = | ||
if(!context.declarationStack.contains(cls.decl)) super.check(context) ++ Seq(ThisOutsideScopeError(this)) | ||
else super.check(context) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
package vct.col.ast.family.location | ||
|
||
import vct.col.ast.FieldLocation | ||
import vct.col.ast.{FieldLocation, Final} | ||
import vct.col.print._ | ||
import vct.col.ast.ops.FieldLocationOps | ||
import vct.col.check.{CheckContext, CheckError, FinalPermission} | ||
|
||
trait FieldLocationImpl[G] extends FieldLocationOps[G] with LocationImpl[G] { this: FieldLocation[G] => | ||
override def check(context: CheckContext[G]): Seq[CheckError] = | ||
if(field.decl.flags.collectFirst { case Final() => () }.nonEmpty) Seq(FinalPermission(this)) ++ super.check(context) | ||
else super.check(context) | ||
|
||
trait FieldLocationImpl[G] extends FieldLocationOps[G] { this: FieldLocation[G] => | ||
override def layout(implicit ctx: Ctx): Doc = | ||
obj.bind(Precedence.POSTFIX) <> "." <> ctx.name(field) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.