| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |