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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 | 655 |
656 if (ok && is_extended_mode()) { | 656 if (ok && is_extended_mode()) { |
657 CheckConflictingVarDeclarations(top_scope_, &ok); | 657 CheckConflictingVarDeclarations(top_scope_, &ok); |
658 } | 658 } |
659 | 659 |
660 if (ok && info->parse_restriction() == ONLY_SINGLE_FUNCTION_LITERAL) { | 660 if (ok && info->parse_restriction() == ONLY_SINGLE_FUNCTION_LITERAL) { |
661 if (body->length() != 1 || | 661 if (body->length() != 1 || |
662 !body->at(0)->IsExpressionStatement() || | 662 !body->at(0)->IsExpressionStatement() || |
663 !body->at(0)->AsExpressionStatement()-> | 663 !body->at(0)->AsExpressionStatement()-> |
664 expression()->IsFunctionLiteral()) { | 664 expression()->IsFunctionLiteral()) { |
665 ReportMessage("unable_to_parse", Vector<const char*>::empty()); | 665 ReportMessage("single_function_literal", Vector<const char*>::empty()); |
666 ok = false; | 666 ok = false; |
667 } | 667 } |
668 } | 668 } |
669 | 669 |
670 if (ok) { | 670 if (ok) { |
671 result = factory()->NewFunctionLiteral( | 671 result = factory()->NewFunctionLiteral( |
672 no_name, | 672 no_name, |
673 top_scope_, | 673 top_scope_, |
674 body, | 674 body, |
675 function_state.materialized_literal_count(), | 675 function_state.materialized_literal_count(), |
(...skipping 4069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4745 // Check for built-in IS_VAR macro. | 4745 // Check for built-in IS_VAR macro. |
4746 if (function != NULL && | 4746 if (function != NULL && |
4747 function->intrinsic_type == Runtime::RUNTIME && | 4747 function->intrinsic_type == Runtime::RUNTIME && |
4748 function->function_id == Runtime::kIS_VAR) { | 4748 function->function_id == Runtime::kIS_VAR) { |
4749 // %IS_VAR(x) evaluates to x if x is a variable, | 4749 // %IS_VAR(x) evaluates to x if x is a variable, |
4750 // leads to a parse error otherwise. Could be implemented as an | 4750 // leads to a parse error otherwise. Could be implemented as an |
4751 // inline function %_IS_VAR(x) to eliminate this special case. | 4751 // inline function %_IS_VAR(x) to eliminate this special case. |
4752 if (args->length() == 1 && args->at(0)->AsVariableProxy() != NULL) { | 4752 if (args->length() == 1 && args->at(0)->AsVariableProxy() != NULL) { |
4753 return args->at(0); | 4753 return args->at(0); |
4754 } else { | 4754 } else { |
4755 ReportMessage("unable_to_parse", Vector<const char*>::empty()); | 4755 ReportMessage("not_isvar", Vector<const char*>::empty()); |
4756 *ok = false; | 4756 *ok = false; |
4757 return NULL; | 4757 return NULL; |
4758 } | 4758 } |
4759 } | 4759 } |
4760 | 4760 |
4761 // Check that the expected number of arguments are being passed. | 4761 // Check that the expected number of arguments are being passed. |
4762 if (function != NULL && | 4762 if (function != NULL && |
4763 function->nargs != -1 && | 4763 function->nargs != -1 && |
4764 function->nargs != args->length()) { | 4764 function->nargs != args->length()) { |
4765 ReportMessage("illegal_access", Vector<const char*>::empty()); | 4765 ReportMessage("illegal_access", Vector<const char*>::empty()); |
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6036 ASSERT(info()->isolate()->has_pending_exception()); | 6036 ASSERT(info()->isolate()->has_pending_exception()); |
6037 } else { | 6037 } else { |
6038 result = ParseProgram(); | 6038 result = ParseProgram(); |
6039 } | 6039 } |
6040 } | 6040 } |
6041 info()->SetFunction(result); | 6041 info()->SetFunction(result); |
6042 return (result != NULL); | 6042 return (result != NULL); |
6043 } | 6043 } |
6044 | 6044 |
6045 } } // namespace v8::internal | 6045 } } // namespace v8::internal |
OLD | NEW |