Failure to escape JavaScript keywords like "true", "false", and "null" in module names #39595
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
P3
A lower priority bug or feature request
web-dev-compiler
Dart version:
Dart VM version: 2.6.1 (Mon Nov 11 13:12:24 2019 +0100) on "macos_x64"
I have dart files named
true.dart
,false.dart
, andif.dart
, etc. and import them in my another file, say,abc.dart
.I am writing a web application which use
abc.dart
and I test it using"pub run build_runner serve test:8081 -c myweb"
And it complains in chrome developer console when visit my web application
http://localhost:8081/myweb/index.html
In the generated
abc.ddc.js
file, I saw following generated codes, and it complains :Uncaught SyntaxError: Unexpected token 'true'
It seems Dart codegen tool fail to escape keywords
true
andfalse
but does escape the keywordif
with a prefix$
sign and generateconst $if
. I am not sure if there are still other keywords that are not escaped when doing codegen.I can workaround this issue by rename my
true.dart
file to another name, saymytrue.dart
.The text was updated successfully, but these errors were encountered: