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 1807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1818 SmartArrayPointer<char> c_string = name->ToCString(DISALLOW_NULLS); | 1818 SmartArrayPointer<char> c_string = name->ToCString(DISALLOW_NULLS); |
1819 const char* elms[2] = { "Variable", *c_string }; | 1819 const char* elms[2] = { "Variable", *c_string }; |
1820 Vector<const char*> args(elms, 2); | 1820 Vector<const char*> args(elms, 2); |
1821 ReportMessage("redeclaration", args); | 1821 ReportMessage("redeclaration", args); |
1822 *ok = false; | 1822 *ok = false; |
1823 return; | 1823 return; |
1824 } | 1824 } |
1825 const char* type = (var->mode() == VAR) | 1825 const char* type = (var->mode() == VAR) |
1826 ? "var" : var->is_const_mode() ? "const" : "let"; | 1826 ? "var" : var->is_const_mode() ? "const" : "let"; |
1827 Handle<String> type_string = | 1827 Handle<String> type_string = |
1828 isolate()->factory()->NewStringFromUtf8(CStrVector(type), TENURED); | 1828 isolate()->factory()->NewStringFromUtf8( |
Erik Corry
2012/08/10 11:28:51
Inadvertent edit?
Yang
2012/08/10 13:14:45
Yup.
Done.
| |
1829 CStrVector(type), TENURED); | |
1829 Expression* expression = | 1830 Expression* expression = |
1830 NewThrowTypeError(isolate()->factory()->redeclaration_symbol(), | 1831 NewThrowTypeError(isolate()->factory()->redeclaration_symbol(), |
1831 type_string, name); | 1832 type_string, name); |
1832 declaration_scope->SetIllegalRedeclaration(expression); | 1833 declaration_scope->SetIllegalRedeclaration(expression); |
1833 } | 1834 } |
1834 } | 1835 } |
1835 } | 1836 } |
1836 | 1837 |
1837 // We add a declaration node for every declaration. The compiler | 1838 // We add a declaration node for every declaration. The compiler |
1838 // will only generate code if necessary. In particular, declarations | 1839 // will only generate code if necessary. In particular, declarations |
(...skipping 4244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6083 ASSERT(info->isolate()->has_pending_exception()); | 6084 ASSERT(info->isolate()->has_pending_exception()); |
6084 } else { | 6085 } else { |
6085 result = parser.ParseProgram(); | 6086 result = parser.ParseProgram(); |
6086 } | 6087 } |
6087 } | 6088 } |
6088 info->SetFunction(result); | 6089 info->SetFunction(result); |
6089 return (result != NULL); | 6090 return (result != NULL); |
6090 } | 6091 } |
6091 | 6092 |
6092 } } // namespace v8::internal | 6093 } } // namespace v8::internal |
OLD | NEW |