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

Side by Side Diff: src/parser.cc

Issue 10067010: Implement ES5 erratum: global declarations shadow inherited properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/runtime.cc » ('j') | src/runtime.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2236 matching lines...) Expand 10 before | Expand all | Expand 10 after
2247 } 2247 }
2248 2248
2249 // Make sure that 'const x' and 'let x' initialize 'x' to undefined. 2249 // Make sure that 'const x' and 'let x' initialize 'x' to undefined.
2250 if (value == NULL && needs_init) { 2250 if (value == NULL && needs_init) {
2251 value = GetLiteralUndefined(); 2251 value = GetLiteralUndefined();
2252 } 2252 }
2253 2253
2254 // Global variable declarations must be compiled in a specific 2254 // Global variable declarations must be compiled in a specific
2255 // way. When the script containing the global variable declaration 2255 // way. When the script containing the global variable declaration
2256 // is entered, the global variable must be declared, so that if it 2256 // is entered, the global variable must be declared, so that if it
2257 // doesn't exist (not even in a prototype of the global object) it 2257 // doesn't exist (on the global object itself, see ES5 errata) it
2258 // gets created with an initial undefined value. This is handled 2258 // gets created with an initial undefined value. This is handled
2259 // by the declarations part of the function representing the 2259 // by the declarations part of the function representing the
2260 // top-level global code; see Runtime::DeclareGlobalVariable. If 2260 // top-level global code; see Runtime::DeclareGlobalVariable. If
2261 // it already exists (in the object or in a prototype), it is 2261 // it already exists (in the object or in a prototype), it is
2262 // *not* touched until the variable declaration statement is 2262 // *not* touched until the variable declaration statement is
2263 // executed. 2263 // executed.
2264 // 2264 //
2265 // Executing the variable declaration statement will always 2265 // Executing the variable declaration statement will always
2266 // guarantee to give the global object a "local" variable; a 2266 // guarantee to give the global object a "local" variable; a
2267 // variable defined in the global object and not in any 2267 // variable defined in the global object and not in any
(...skipping 3747 matching lines...) Expand 10 before | Expand all | Expand 10 after
6015 ASSERT(info->isolate()->has_pending_exception()); 6015 ASSERT(info->isolate()->has_pending_exception());
6016 } else { 6016 } else {
6017 result = parser.ParseProgram(info); 6017 result = parser.ParseProgram(info);
6018 } 6018 }
6019 } 6019 }
6020 info->SetFunction(result); 6020 info->SetFunction(result);
6021 return (result != NULL); 6021 return (result != NULL);
6022 } 6022 }
6023 6023
6024 } } // namespace v8::internal 6024 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime.cc » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698