-
Notifications
You must be signed in to change notification settings - Fork 395
IntroduceLinktimeProperty
and get rid of JSLinkingInfo
#5025
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -342,7 +342,7 @@ class JSGlobalScopeTest extends DirectTest with TestHelpers { | |
"extends", "false", "finally", "for", "function", "if", "implements", | ||
"import", "in", "instanceof", "interface", "let", "new", "null", | ||
"package", "private", "protected", "public", "return", "static", | ||
"super", "switch", "this", "throw", "true", "try", "typeof", "var", | ||
"super", "switch", "throw", "true", "try", "typeof", "var", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change should be integrated in the first commit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or rather: the first commit should not touch this. It's the second commit that allows There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, the first commit shouldn't touch the test 😵💫 thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, no this change (remove Indeed we allow There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah but then I think we should add an explicit rejection of This way we know that the first commit does not change anything user-visible. Only the second commit introduces user-level changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. force pushed the commits to mix this change into the first commit 🙇 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, I commented at a same timing
👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we're going to have the following changes in the first commit diff --git a/compiler/src/main/scala/org/scalajs/nscplugin/GenJSCode.scala b/compiler/src/main/scala/org/scalajs/nscplugin/GenJSCode.scala
index ef5d20f12..c3dff7493 100644
--- a/compiler/src/main/scala/org/scalajs/nscplugin/GenJSCode.scala
+++ b/compiler/src/main/scala/org/scalajs/nscplugin/GenJSCode.scala
@@ -6758,7 +6758,7 @@ abstract class GenJSCode[G <: Global with Singleton](val global: G)
implicit pos: Position): js.JSGlobalRef = {
propName match {
case js.StringLiteral(value) =>
- if (js.JSGlobalRef.isValidJSGlobalRefName(value)) {
+ if (js.JSGlobalRef.isValidJSGlobalRefName(value) && value != js.JSGlobalRef.FileLevelThis) {
if (value == "await") {
global.runReporting.warning(pos,
s"$actionFull of the global scope with the name '$value' is deprecated.\n" + and remove the change + There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done, sorry for making a mess |
||
"void", "while", "with", "yield") | ||
|
||
for (reservedIdentifier <- reservedIdentifiers) { | ||
|
@@ -497,4 +497,34 @@ class JSGlobalScopeTest extends DirectTest with TestHelpers { | |
} | ||
} | ||
|
||
@Test | ||
def rejectAssignmentToGlobalThis(): Unit = { | ||
tanishiking marked this conversation as resolved.
Show resolved
Hide resolved
|
||
""" | ||
import scala.scalajs.js | ||
import scala.scalajs.js.annotation._ | ||
|
||
object Main { | ||
def main(): Unit = { | ||
js.Dynamic.global.`this` = 0 | ||
GlobalScope.globalThis = 0 | ||
} | ||
} | ||
|
||
@js.native | ||
@JSGlobalScope | ||
object GlobalScope extends js.Any { | ||
@JSName("this") | ||
var globalThis: Any = js.native | ||
} | ||
""" hasErrors | ||
s""" | ||
|newSource1.scala:44: error: Illegal assignment to global this. | ||
| js.Dynamic.global.`this` = 0 | ||
| ^ | ||
|newSource1.scala:45: error: Illegal assignment to global this. | ||
| GlobalScope.globalThis = 0 | ||
| ^ | ||
""" | ||
} | ||
|
||
} |
Uh oh!
There was an error while loading. Please reload this page.