OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/ast/ast.h" | 10 #include "src/ast/ast.h" |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 return factory->NewNumberLiteral(value, pos, has_dot); | 759 return factory->NewNumberLiteral(value, pos, has_dot); |
760 } | 760 } |
761 default: | 761 default: |
762 DCHECK(false); | 762 DCHECK(false); |
763 } | 763 } |
764 return NULL; | 764 return NULL; |
765 } | 765 } |
766 | 766 |
767 Expression* ParserTraits::ExpressionFromIdentifier(const AstRawString* name, | 767 Expression* ParserTraits::ExpressionFromIdentifier(const AstRawString* name, |
768 int start_position, | 768 int start_position, |
769 int end_position) { | 769 int end_position, |
770 if (parser_->fni_ != NULL) parser_->fni_->PushVariableName(name); | 770 InferName infer) { |
| 771 if (infer == InferName::Yes && parser_->fni_ != NULL) |
| 772 parser_->fni_->PushVariableName(name); |
771 return parser_->NewUnresolved(name, start_position, end_position); | 773 return parser_->NewUnresolved(name, start_position, end_position); |
772 } | 774 } |
773 | 775 |
774 | |
775 Expression* ParserTraits::ExpressionFromString(int pos, Scanner* scanner, | 776 Expression* ParserTraits::ExpressionFromString(int pos, Scanner* scanner, |
776 AstNodeFactory* factory) { | 777 AstNodeFactory* factory) { |
777 const AstRawString* symbol = GetSymbol(scanner); | 778 const AstRawString* symbol = GetSymbol(scanner); |
778 if (parser_->fni_ != NULL) parser_->fni_->PushLiteralName(symbol); | 779 if (parser_->fni_ != NULL) parser_->fni_->PushLiteralName(symbol); |
779 return factory->NewStringLiteral(symbol, pos); | 780 return factory->NewStringLiteral(symbol, pos); |
780 } | 781 } |
781 | 782 |
782 | 783 |
783 Expression* ParserTraits::GetIterator(Expression* iterable, | 784 Expression* ParserTraits::GetIterator(Expression* iterable, |
784 AstNodeFactory* factory, int pos) { | 785 AstNodeFactory* factory, int pos) { |
(...skipping 6285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7070 node->Print(Isolate::Current()); | 7071 node->Print(Isolate::Current()); |
7071 } | 7072 } |
7072 #endif // DEBUG | 7073 #endif // DEBUG |
7073 | 7074 |
7074 #undef CHECK_OK | 7075 #undef CHECK_OK |
7075 #undef CHECK_OK_VOID | 7076 #undef CHECK_OK_VOID |
7076 #undef CHECK_FAILED | 7077 #undef CHECK_FAILED |
7077 | 7078 |
7078 } // namespace internal | 7079 } // namespace internal |
7079 } // namespace v8 | 7080 } // namespace v8 |
OLD | NEW |