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

Unified Diff: src/variables.h

Issue 749633002: harmony-scoping: make assignment to 'const' a late error. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: one more Created 6 years, 1 month 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: src/variables.h
diff --git a/src/variables.h b/src/variables.h
index 93bfb4a1816aeb3fb9f370c847ace86da6f2d6b3..d150e0fa30d4a6f6632d3493a17de3c96fc41ff8 100644
--- a/src/variables.h
+++ b/src/variables.h
@@ -135,6 +135,19 @@ class Variable: public ZoneObject {
static int CompareIndex(Variable* const* v, Variable* const* w);
+ // Shall an error be thrown if assignment with 'op' operation is perfomed
+ // on this variable in given language mode?
+ bool IsSignallingAssignmentToConst(Token::Value op,
rossberg 2014/11/26 08:31:46 Can you also move this to full-codegen.h? This is
Dmitry Lomov (no reviews) 2014/11/26 10:30:56 Done.
+ StrictMode strict_mode) const {
+ if (strict_mode == SLOPPY) return false;
+
+ if (mode() == CONST) return op != Token::INIT_CONST;
+
+ if (mode() == CONST_LEGACY) return op != Token::INIT_CONST_LEGACY;
+
+ return false;
+ }
+
private:
Scope* scope_;
const AstRawString* name_;

Powered by Google App Engine
This is Rietveld 408576698