feat(Escaped Identifiers): add ability to use any symbol wrapped in back ticks.

This commit is contained in:
Artem Kobzar
2021-10-29 17:55:59 +00:00
committed by Space
parent ea10b4a781
commit 979e9f94ef
59 changed files with 1260 additions and 159 deletions
@@ -0,0 +1,24 @@
// IGNORE_BACKEND: JS
// RUN_PLAIN_BOX_FUNCTION
// INFER_MAIN_MODULE
// !LANGUAGE: +JsAllowInvalidCharsIdentifiersEscaping
// MODULE: export_invalid_name_class
// FILE: lib.kt
@JsExport
class `invalid@class-name `() {
fun foo(): Int = 42
}
// FILE: test.js
function box() {
var InvalidClass = this["export_invalid_name_class"]["invalid@class-name "]
var instance = new InvalidClass()
var value = instance.foo()
if (value !== 42)
return "false: expect exproted class function to return 42 but it equals " + value
return "OK"
}