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 2988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2999 if (!Token::IsAssignmentOp(peek())) { | 2999 if (!Token::IsAssignmentOp(peek())) { |
3000 if (fni_ != NULL) fni_->Leave(); | 3000 if (fni_ != NULL) fni_->Leave(); |
3001 // Parsed conditional expression only (no assignment). | 3001 // Parsed conditional expression only (no assignment). |
3002 return expression; | 3002 return expression; |
3003 } | 3003 } |
3004 | 3004 |
3005 // Signal a reference error if the expression is an invalid left-hand | 3005 // Signal a reference error if the expression is an invalid left-hand |
3006 // side expression. We could report this as a syntax error here but | 3006 // side expression. We could report this as a syntax error here but |
3007 // for compatibility with JSC we choose to report the error at | 3007 // for compatibility with JSC we choose to report the error at |
3008 // runtime. | 3008 // runtime. |
| 3009 // TODO(ES5): Should change parsing for spec conformance. |
3009 if (expression == NULL || !expression->IsValidLeftHandSide()) { | 3010 if (expression == NULL || !expression->IsValidLeftHandSide()) { |
3010 Handle<String> type = | 3011 Handle<String> type = |
3011 isolate()->factory()->invalid_lhs_in_assignment_symbol(); | 3012 isolate()->factory()->invalid_lhs_in_assignment_symbol(); |
3012 expression = NewThrowReferenceError(type); | 3013 expression = NewThrowReferenceError(type); |
3013 } | 3014 } |
3014 | 3015 |
3015 if (!top_scope_->is_classic_mode()) { | 3016 if (!top_scope_->is_classic_mode()) { |
3016 // Assignment to eval or arguments is disallowed in strict mode. | 3017 // Assignment to eval or arguments is disallowed in strict mode. |
3017 CheckStrictModeLValue(expression, "strict_lhs_assignment", CHECK_OK); | 3018 CheckStrictModeLValue(expression, "strict_lhs_assignment", CHECK_OK); |
3018 } | 3019 } |
(...skipping 2909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5928 ASSERT(info->isolate()->has_pending_exception()); | 5929 ASSERT(info->isolate()->has_pending_exception()); |
5929 } else { | 5930 } else { |
5930 result = parser.ParseProgram(); | 5931 result = parser.ParseProgram(); |
5931 } | 5932 } |
5932 } | 5933 } |
5933 info->SetFunction(result); | 5934 info->SetFunction(result); |
5934 return (result != NULL); | 5935 return (result != NULL); |
5935 } | 5936 } |
5936 | 5937 |
5937 } } // namespace v8::internal | 5938 } } // namespace v8::internal |
OLD | NEW |