-
Notifications
You must be signed in to change notification settings - Fork 395
Reorganize LinkTimeProperties. #5163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just optional nits. LGTM!
@@ -118,7 +120,7 @@ final class Desugarer(config: CommonPhaseConfig, checkIR: Boolean) { | |||
|
|||
private[linker] object Desugarer { | |||
|
|||
private final class DesugarTransformer(coreSpec: CoreSpec) | |||
private final class DesugarTransformer(linkTimeProperties: LinkTimeProperties) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
implicit val pos = tree.pos | ||
val value = linkTimeProperties.get(name).getOrElse { | ||
throw new IllegalArgumentException( | ||
s"link time property not found: 'name' of type ${tree.tpe}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s"link time property not found: 'name' of type ${tree.tpe}") | |
s"link time property not found: '$name' of type ${tree.tpe}") |
def tpe: Type = this match { | ||
case LinkTimeInt(_) => IntType | ||
case LinkTimeBoolean(_) => BooleanType | ||
case LinkTimeString(_) => StringType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Instead of self matching, pass the type as val constructor param to LinkTimeValue
?
* Move it to `frontend`. * Make it public. * Move the logic of `validate` and `transformLinkTimeProperty` to their respective call sites. * Construct them from a CoreSpec, rather than being contained by CoreSpec. These changes better isolate the data (`LinkTimeProperties`) from the transformations we apply to that data (the logic in `Analyzer` and `Desugarer`).
55ff3cf
to
fd90409
Compare
frontend
.validate
andtransformLinkTimeProperty
to their respective call sites.These changes better isolate the data (
LinkTimeProperties
) from the transformations we apply to that data (the logic inAnalyzer
andDesugarer
).