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

Unified Diff: src/full-codegen.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: Comment update 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
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen.h
diff --git a/src/full-codegen.h b/src/full-codegen.h
index 73a6c412ee9021cafc56e48af6fe6e0db28654b9..1439942db8ae33785ce817ba91d3c669e34cddf9 100644
--- a/src/full-codegen.h
+++ b/src/full-codegen.h
@@ -586,6 +586,19 @@ class FullCodeGenerator: public AstVisitor {
// is expected in the accumulator.
void EmitAssignment(Expression* expr);
+ // Shall an error be thrown if assignment with 'op' operation is perfomed
+ // on this variable in given language mode?
+ static bool IsSignallingAssignmentToConst(Variable* var, Token::Value op,
+ StrictMode strict_mode) {
+ if (var->mode() == CONST) return op != Token::INIT_CONST;
+
+ if (var->mode() == CONST_LEGACY) {
+ return strict_mode == STRICT && op != Token::INIT_CONST_LEGACY;
+ }
+
+ return false;
+ }
+
// Complete a variable assignment. The right-hand-side value is expected
// in the accumulator.
void EmitVariableAssignment(Variable* var,
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698