Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1049)

Unified Diff: sdk/lib/_internal/compiler/implementation/js/nodes.dart

Issue 255843005: Avoid generating VariableUse nodes with non-identifier names (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/js/nodes.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js/nodes.dart b/sdk/lib/_internal/compiler/implementation/js/nodes.dart
index 93d1f5ecb735a5b3e47353ce0c14eb03b132bb11..17c7867a4a812779481facb209c02210f8b13d0f 100644
--- a/sdk/lib/_internal/compiler/implementation/js/nodes.dart
+++ b/sdk/lib/_internal/compiler/implementation/js/nodes.dart
@@ -700,7 +700,11 @@ abstract class VariableReference extends Expression {
// We treat operators as if they were special functions. They can thus be
// referenced like other variables.
- VariableReference(this.name);
+ VariableReference(this.name) {
+ assert(_identiferOrOperatorRE.hasMatch(name));
+ }
+ static RegExp _identiferOrOperatorRE =
floitsch 2014/04/28 14:17:51 identifierOrOperatorRE (missing "i")
sra1 2014/04/28 23:00:41 Done.
+ new RegExp(r'^([A-Za-z_$][A-Za-z_$0-9]*|[-<=>+\*\/%^!|&~,]*)$');
floitsch 2014/04/28 14:17:51 you don't need to escape '*' inside a character gr
sra1 2014/04/28 23:00:41 'Done'. After the operators cl, the test is just
accept(NodeVisitor visitor);
int get precedenceLevel => PRIMARY;

Powered by Google App Engine
This is Rietveld 408576698