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

Side by Side Diff: src/runtime/runtime-scopes.cc

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 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 unified diff | Download patch
« no previous file with comments | « src/runtime/runtime.h ('k') | src/scopes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/frames-inl.h" 9 #include "src/frames-inl.h"
10 #include "src/runtime/runtime-utils.h" 10 #include "src/runtime/runtime-utils.h"
11 #include "src/scopeinfo.h" 11 #include "src/scopeinfo.h"
12 #include "src/scopes.h" 12 #include "src/scopes.h"
13 13
14 namespace v8 { 14 namespace v8 {
15 namespace internal { 15 namespace internal {
16 16
17 static Object* ThrowRedeclarationError(Isolate* isolate, Handle<String> name) { 17 static Object* ThrowRedeclarationError(Isolate* isolate, Handle<String> name) {
18 HandleScope scope(isolate); 18 HandleScope scope(isolate);
19 Handle<Object> args[1] = {name}; 19 Handle<Object> args[1] = {name};
20 THROW_NEW_ERROR_RETURN_FAILURE( 20 THROW_NEW_ERROR_RETURN_FAILURE(
21 isolate, NewTypeError("var_redeclaration", HandleVector(args, 1))); 21 isolate, NewTypeError("var_redeclaration", HandleVector(args, 1)));
22 } 22 }
23 23
24 24
25 RUNTIME_FUNCTION(Runtime_ThrowConstAssignError) {
26 HandleScope scope(isolate);
27 THROW_NEW_ERROR_RETURN_FAILURE(
28 isolate,
29 NewTypeError("harmony_const_assign", HandleVector<Object>(NULL, 0)));
30 }
31
32
25 // May throw a RedeclarationError. 33 // May throw a RedeclarationError.
26 static Object* DeclareGlobals(Isolate* isolate, Handle<GlobalObject> global, 34 static Object* DeclareGlobals(Isolate* isolate, Handle<GlobalObject> global,
27 Handle<String> name, Handle<Object> value, 35 Handle<String> name, Handle<Object> value,
28 PropertyAttributes attr, bool is_var, 36 PropertyAttributes attr, bool is_var,
29 bool is_const, bool is_function) { 37 bool is_const, bool is_function) {
30 Handle<ScriptContextTable> script_contexts( 38 Handle<ScriptContextTable> script_contexts(
31 global->native_context()->script_context_table()); 39 global->native_context()->script_context_table());
32 ScriptContextTable::LookupResult lookup; 40 ScriptContextTable::LookupResult lookup;
33 if (ScriptContextTable::Lookup(script_contexts, name, &lookup) && 41 if (ScriptContextTable::Lookup(script_contexts, name, &lookup) &&
34 IsLexicalVariableMode(lookup.mode)) { 42 IsLexicalVariableMode(lookup.mode)) {
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 return Smi::FromInt(frame->GetArgumentsLength()); 1077 return Smi::FromInt(frame->GetArgumentsLength());
1070 } 1078 }
1071 1079
1072 1080
1073 RUNTIME_FUNCTION(RuntimeReference_Arguments) { 1081 RUNTIME_FUNCTION(RuntimeReference_Arguments) {
1074 SealHandleScope shs(isolate); 1082 SealHandleScope shs(isolate);
1075 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); 1083 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate);
1076 } 1084 }
1077 } 1085 }
1078 } // namespace v8::internal 1086 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698