Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/parser.h" | 5 #include "vm/parser.h" |
| 6 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/bigint_operations.h" | 8 #include "vm/bigint_operations.h" |
| 9 #include "vm/bootstrap.h" | 9 #include "vm/bootstrap.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1880 ConsumeToken(); | 1880 ConsumeToken(); |
| 1881 AstNode* index_expr = ParseExpr(kAllowConst, kConsumeCascades); | 1881 AstNode* index_expr = ParseExpr(kAllowConst, kConsumeCascades); |
| 1882 ExpectToken(Token::kRBRACK); | 1882 ExpectToken(Token::kRBRACK); |
| 1883 AstNode* receiver = LoadReceiver(operator_pos); | 1883 AstNode* receiver = LoadReceiver(operator_pos); |
| 1884 const Class& super_class = Class::ZoneHandle(current_class().SuperClass()); | 1884 const Class& super_class = Class::ZoneHandle(current_class().SuperClass()); |
| 1885 ASSERT(!super_class.IsNull()); | 1885 ASSERT(!super_class.IsNull()); |
| 1886 super_op = | 1886 super_op = |
| 1887 new LoadIndexedNode(operator_pos, receiver, index_expr, super_class); | 1887 new LoadIndexedNode(operator_pos, receiver, index_expr, super_class); |
| 1888 } else { | 1888 } else { |
| 1889 ASSERT(Token::CanBeOverloaded(CurrentToken()) || | 1889 ASSERT(Token::CanBeOverloaded(CurrentToken()) || |
| 1890 (CurrentToken() == Token::kNE)); | 1890 (CurrentToken() == Token::kNE)); |
|
Florian Schneider
2013/09/18 15:09:09
Could the ASSERT below even be removed since this
hausner
2013/09/18 15:52:37
If somebody decides tomorrow that the conditional
| |
| 1891 Token::Kind op = CurrentToken(); | 1891 Token::Kind op = CurrentToken(); |
| 1892 ConsumeToken(); | 1892 ConsumeToken(); |
| 1893 | 1893 |
| 1894 bool negate_result = false; | 1894 bool negate_result = false; |
| 1895 if (op == Token::kNE) { | 1895 if (op == Token::kNE) { |
| 1896 op = Token::kEQ; | 1896 op = Token::kEQ; |
| 1897 negate_result = true; | 1897 negate_result = true; |
| 1898 } | 1898 } |
| 1899 | 1899 |
| 1900 ASSERT(Token::Precedence(op) >= Token::Precedence(Token::kBIT_OR)); | 1900 ASSERT(Token::Precedence(op) >= Token::Precedence(Token::kEQ)); |
|
Kevin Millikin (Google)
2013/09/18 15:13:21
This is OK to fix the tests.
It's kind of annoyin
hausner
2013/09/18 15:52:37
We are blindly calling ParseBinaryExpr() here, so
| |
| 1901 AstNode* other_operand = ParseBinaryExpr(Token::Precedence(op) + 1); | 1901 AstNode* other_operand = ParseBinaryExpr(Token::Precedence(op) + 1); |
| 1902 | 1902 |
| 1903 ArgumentListNode* op_arguments = new ArgumentListNode(operator_pos); | 1903 ArgumentListNode* op_arguments = new ArgumentListNode(operator_pos); |
| 1904 AstNode* receiver = LoadReceiver(operator_pos); | 1904 AstNode* receiver = LoadReceiver(operator_pos); |
| 1905 op_arguments->Add(receiver); | 1905 op_arguments->Add(receiver); |
| 1906 op_arguments->Add(other_operand); | 1906 op_arguments->Add(other_operand); |
| 1907 | 1907 |
| 1908 // Resolve the operator function in the superclass. | 1908 // Resolve the operator function in the superclass. |
| 1909 const String& operator_function_name = | 1909 const String& operator_function_name = |
| 1910 String::ZoneHandle(Symbols::New(Token::Str(op))); | 1910 String::ZoneHandle(Symbols::New(Token::Str(op))); |
| (...skipping 5427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7338 arguments->Add(new LiteralNode(call_pos, array)); | 7338 arguments->Add(new LiteralNode(call_pos, array)); |
| 7339 } | 7339 } |
| 7340 return MakeStaticCall(Symbols::NoSuchMethodError(), | 7340 return MakeStaticCall(Symbols::NoSuchMethodError(), |
| 7341 PrivateCoreLibName(Symbols::ThrowNew()), | 7341 PrivateCoreLibName(Symbols::ThrowNew()), |
| 7342 arguments); | 7342 arguments); |
| 7343 } | 7343 } |
| 7344 | 7344 |
| 7345 | 7345 |
| 7346 AstNode* Parser::ParseBinaryExpr(int min_preced) { | 7346 AstNode* Parser::ParseBinaryExpr(int min_preced) { |
| 7347 TRACE_PARSER("ParseBinaryExpr"); | 7347 TRACE_PARSER("ParseBinaryExpr"); |
| 7348 ASSERT(min_preced >= 4); | 7348 ASSERT(min_preced >= Token::Precedence(Token::kOR)); |
| 7349 AstNode* left_operand = ParseUnaryExpr(); | 7349 AstNode* left_operand = ParseUnaryExpr(); |
| 7350 if (left_operand->IsPrimaryNode() && | 7350 if (left_operand->IsPrimaryNode() && |
| 7351 (left_operand->AsPrimaryNode()->IsSuper())) { | 7351 (left_operand->AsPrimaryNode()->IsSuper())) { |
| 7352 ErrorMsg(left_operand->token_pos(), "illegal use of 'super'"); | 7352 ErrorMsg(left_operand->token_pos(), "illegal use of 'super'"); |
| 7353 } | 7353 } |
| 7354 int current_preced = Token::Precedence(CurrentToken()); | 7354 int current_preced = Token::Precedence(CurrentToken()); |
| 7355 while (current_preced >= min_preced) { | 7355 while (current_preced >= min_preced) { |
| 7356 while (Token::Precedence(CurrentToken()) == current_preced) { | 7356 while (Token::Precedence(CurrentToken()) == current_preced) { |
| 7357 Token::Kind op_kind = CurrentToken(); | 7357 Token::Kind op_kind = CurrentToken(); |
| 7358 const intptr_t op_pos = TokenPos(); | 7358 const intptr_t op_pos = TokenPos(); |
| (...skipping 3066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10425 void Parser::SkipQualIdent() { | 10425 void Parser::SkipQualIdent() { |
| 10426 ASSERT(IsIdentifier()); | 10426 ASSERT(IsIdentifier()); |
| 10427 ConsumeToken(); | 10427 ConsumeToken(); |
| 10428 if (CurrentToken() == Token::kPERIOD) { | 10428 if (CurrentToken() == Token::kPERIOD) { |
| 10429 ConsumeToken(); // Consume the kPERIOD token. | 10429 ConsumeToken(); // Consume the kPERIOD token. |
| 10430 ExpectIdentifier("identifier expected after '.'"); | 10430 ExpectIdentifier("identifier expected after '.'"); |
| 10431 } | 10431 } |
| 10432 } | 10432 } |
| 10433 | 10433 |
| 10434 } // namespace dart | 10434 } // namespace dart |
| OLD | NEW |