Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/preparser.h

Issue 493173003: Fix issue with numeric property names (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef V8_PREPARSER_H 5 #ifndef V8_PREPARSER_H
6 #define V8_PREPARSER_H 6 #define V8_PREPARSER_H
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/func-name-inferrer.h" 10 #include "src/func-name-inferrer.h"
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 } 1241 }
1242 1242
1243 // Odd-ball literal creators. 1243 // Odd-ball literal creators.
1244 static PreParserExpression GetLiteralTheHole(int position, 1244 static PreParserExpression GetLiteralTheHole(int position,
1245 PreParserFactory* factory) { 1245 PreParserFactory* factory) {
1246 return PreParserExpression::Default(); 1246 return PreParserExpression::Default();
1247 } 1247 }
1248 1248
1249 // Producing data during the recursive descent. 1249 // Producing data during the recursive descent.
1250 PreParserIdentifier GetSymbol(Scanner* scanner); 1250 PreParserIdentifier GetSymbol(Scanner* scanner);
1251 PreParserIdentifier GetNumberAsSymbol(Scanner* scanner);
1251 1252
1252 static PreParserIdentifier GetNextSymbol(Scanner* scanner) { 1253 static PreParserIdentifier GetNextSymbol(Scanner* scanner) {
1253 return PreParserIdentifier::Default(); 1254 return PreParserIdentifier::Default();
1254 } 1255 }
1255 1256
1256 static PreParserExpression ThisExpression(PreParserScope* scope, 1257 static PreParserExpression ThisExpression(PreParserScope* scope,
1257 PreParserFactory* factory) { 1258 PreParserFactory* factory) {
1258 return PreParserExpression::This(); 1259 return PreParserExpression::This();
1259 } 1260 }
1260 1261
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1886 // { ... , get foo() { ... }, ... , set foo(v) { ... v ... } , ... } 1887 // { ... , get foo() { ... }, ... , set foo(v) { ... v ... } , ... }
1887 // We have already read the "get" or "set" keyword. 1888 // We have already read the "get" or "set" keyword.
1888 IdentifierT name = this->EmptyIdentifier(); 1889 IdentifierT name = this->EmptyIdentifier();
1889 switch (peek()) { 1890 switch (peek()) {
1890 case Token::STRING: 1891 case Token::STRING:
1891 Consume(Token::STRING); 1892 Consume(Token::STRING);
1892 name = this->GetSymbol(scanner_); 1893 name = this->GetSymbol(scanner_);
1893 break; 1894 break;
1894 case Token::NUMBER: 1895 case Token::NUMBER:
1895 Consume(Token::NUMBER); 1896 Consume(Token::NUMBER);
1896 // TODO(arv): Fix issue with numeric keys. get 1.0() should be 1897 name = this->GetNumberAsSymbol(scanner_);
1897 // treated as if the key was '1'
1898 // https://code.google.com/p/v8/issues/detail?id=3507
1899 name = this->GetSymbol(scanner_);
1900 break; 1898 break;
1901 default: 1899 default:
1902 name = ParseIdentifierName( 1900 name = ParseIdentifierName(
1903 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); 1901 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
1904 } 1902 }
1905 // Validate the property. 1903 // Validate the property.
1906 PropertyKind type = is_getter ? kGetterProperty : kSetterProperty; 1904 PropertyKind type = is_getter ? kGetterProperty : kSetterProperty;
1907 checker->CheckProperty(next, type, 1905 checker->CheckProperty(next, type,
1908 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); 1906 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
1909 typename Traits::Type::FunctionLiteral value = 1907 typename Traits::Type::FunctionLiteral value =
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
2661 DCHECK(IsAccessorAccessorConflict(old_type, type)); 2659 DCHECK(IsAccessorAccessorConflict(old_type, type));
2662 // Both accessors of the same type. 2660 // Both accessors of the same type.
2663 parser()->ReportMessage("accessor_get_set"); 2661 parser()->ReportMessage("accessor_get_set");
2664 } 2662 }
2665 *ok = false; 2663 *ok = false;
2666 } 2664 }
2667 } 2665 }
2668 } } // v8::internal 2666 } } // v8::internal
2669 2667
2670 #endif // V8_PREPARSER_H 2668 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698