-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -108,7 +108,7 @@ class Repl(driver: Driver) extends REPL[Tree, EffektConfig, EffektError] { | |||||||||||
runFrontend(StringSource(""), module.make(UnitLit()), config) { cu => | ||||||||||||
module.definitions.foreach { | ||||||||||||
case u: Def => | ||||||||||||
outputCode(DeclPrinter(context.symbolsOf(u)), config) | ||||||||||||
outputCode(DeclPrinter(List(context.symbolOf(u.id))), config) | ||||||||||||
This comment has been minimized.
Sorry, something went wrong. |
||||||||||||
} | ||||||||||||
} | ||||||||||||
} | ||||||||||||
|
@@ -221,16 +221,16 @@ class Repl(driver: Driver) extends REPL[Tree, EffektConfig, EffektError] { | |||||||||||
module = extendedDefs | ||||||||||||
|
||||||||||||
// try to find the symbol for the def to print the type | ||||||||||||
d.ids.foreach(id => (context.symbolOption(id) match { | ||||||||||||
context.symbolOption(d.id) match { | ||||||||||||
case Some(v: ValueSymbol) => | ||||||||||||
Some(context.valueTypeOf(v)) | ||||||||||||
Some(v, context.valueTypeOf(v)) | ||||||||||||
case Some(b: BlockSymbol) => | ||||||||||||
Some(context.blockTypeOf(b)) | ||||||||||||
Some(b, context.blockTypeOf(b)) | ||||||||||||
case t => | ||||||||||||
None | ||||||||||||
This comment has been minimized.
Sorry, something went wrong.
b-studios
Collaborator
|
||||||||||||
}) map { tpe => | ||||||||||||
} map { case (id, tpe) => | ||||||||||||
outputCode(pp"${id}: ${tpe}", config) | ||||||||||||
}) | ||||||||||||
} | ||||||||||||
} | ||||||||||||
|
||||||||||||
case _ => () | ||||||||||||
|
@@ -297,7 +297,7 @@ class Repl(driver: Driver) extends REPL[Tree, EffektConfig, EffektError] { | |||||||||||
) { | ||||||||||||
def +(d: Def) = { | ||||||||||||
// drop all equally named definitions for now. | ||||||||||||
val otherDefs = definitions.filterNot { other => d.ids.map{_.name}.forall(other.ids.map{_.name}.contains) } | ||||||||||||
val otherDefs = definitions.filterNot { other => d.id == other.id } | ||||||||||||
This comment has been minimized.
Sorry, something went wrong.
b-studios
Collaborator
|
def +(d: Def) = { | |
// drop all equally named definitions for now. | |
val otherDefs = definitions.filterNot { other => other.id.name == d.id.name } | |
copy(definitions = otherDefs :+ d) | |
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -298,14 +298,11 @@ class EffektParsers(positions: Positions) extends EffektLexers(positions) { | |||||
|
||||||
lazy val valDefs: P[Def] = | ||||||
`val` ~> someSep(valDef, `,`) ~ (`=` ~/> stmt) ^^ { | ||||||
case defs ~ binding => | ||||||
val ids = defs.map(_._1) | ||||||
val tpes = defs.map(_._2) | ||||||
ValDef(ids, tpes, binding) | ||||||
case defs ~ binding => ValDef(defs.asInstanceOf, binding) | ||||||
} | ||||||
|
||||||
lazy val valDef: P[(IdDef, Option[ValueType])] = | ||||||
idDef ~ (`:` ~/> valueType).? ^^ { case id ~ tpe => (id, tpe)} | ||||||
lazy val valDef: P[Param] = | ||||||
This comment has been minimized.
Sorry, something went wrong.
b-studios
Collaborator
|
||||||
idDef ~ (`:` ~/> valueType).? ^^ { case id ~ tpe => ValueParam(id, tpe)} | ||||||
This comment has been minimized.
Sorry, something went wrong.
b-studios
Collaborator
|
lazy val valDef: P[Def] = | |
`val` ~> idDef ~ (`:` ~/> valueType).? ~ (`=` ~/> stmt) ^^ ValDef.apply |
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -504,15 +504,6 @@ trait AnnotationsDB { self: Context => | |||||||||||||
sym | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
/** | ||||||||||||||
* Searching the symbol for a definition | ||||||||||||||
* | ||||||||||||||
* These lookups should not fail (except there is a bug in the compiler) | ||||||||||||||
*/ | ||||||||||||||
|
||||||||||||||
def symbolsOf(tree: source.Definition): List[Symbol] = | ||||||||||||||
tree.ids.map(symbolOf) | ||||||||||||||
|
||||||||||||||
This comment has been minimized.
Sorry, something went wrong.
b-studios
Collaborator
|
* Searching the symbol for a definition | |
* | |
* These lookups should not fail (except there is a bug in the compiler) | |
*/ | |
def symbolOf(tree: source.Definition): Symbol = | |
symbolOf(tree.id) |
Maybe check where it was used to see whether we forgot something.
Why not just call
u.symbol
?