| 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 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2087 // For let/const declarations in harmony mode, we can also immediately | 2087 // For let/const declarations in harmony mode, we can also immediately |
| 2088 // pre-resolve the proxy because it resides in the same scope as the | 2088 // pre-resolve the proxy because it resides in the same scope as the |
| 2089 // declaration. | 2089 // declaration. |
| 2090 Interface* interface = | 2090 Interface* interface = |
| 2091 is_const ? Interface::NewConst() : Interface::NewValue(); | 2091 is_const ? Interface::NewConst() : Interface::NewValue(); |
| 2092 VariableProxy* proxy = NewUnresolved(name, mode, interface); | 2092 VariableProxy* proxy = NewUnresolved(name, mode, interface); |
| 2093 Declaration* declaration = | 2093 Declaration* declaration = |
| 2094 factory()->NewVariableDeclaration(proxy, mode, scope_, pos); | 2094 factory()->NewVariableDeclaration(proxy, mode, scope_, pos); |
| 2095 Declare(declaration, mode != VAR, CHECK_OK); | 2095 Declare(declaration, mode != VAR, CHECK_OK); |
| 2096 nvars++; | 2096 nvars++; |
| 2097 if (declaration_scope->num_var_or_const() > kMaxNumFunctionLocals) { | 2097 // Variable indexes are stored as ints, so we definitely cannot have more |
| 2098 // variables than we have indexes for. |
| 2099 if (declaration_scope->num_var_or_const() == kMaxInt) { |
| 2098 ReportMessageAt(scanner()->location(), "too_many_variables"); | 2100 ReportMessageAt(scanner()->location(), "too_many_variables"); |
| 2099 *ok = false; | 2101 *ok = false; |
| 2100 return NULL; | 2102 return NULL; |
| 2101 } | 2103 } |
| 2102 if (names) names->Add(name, zone()); | 2104 if (names) names->Add(name, zone()); |
| 2103 | 2105 |
| 2104 // Parse initialization expression if present and/or needed. A | 2106 // Parse initialization expression if present and/or needed. A |
| 2105 // declaration of the form: | 2107 // declaration of the form: |
| 2106 // | 2108 // |
| 2107 // var v = x; | 2109 // var v = x; |
| (...skipping 2790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4898 ASSERT(info()->isolate()->has_pending_exception()); | 4900 ASSERT(info()->isolate()->has_pending_exception()); |
| 4899 } else { | 4901 } else { |
| 4900 result = ParseProgram(); | 4902 result = ParseProgram(); |
| 4901 } | 4903 } |
| 4902 } | 4904 } |
| 4903 info()->SetFunction(result); | 4905 info()->SetFunction(result); |
| 4904 return (result != NULL); | 4906 return (result != NULL); |
| 4905 } | 4907 } |
| 4906 | 4908 |
| 4907 } } // namespace v8::internal | 4909 } } // namespace v8::internal |
| OLD | NEW |