| 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 "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 if (!this_seen && (CurrentToken() == Token::kTHIS)) { | 886 if (!this_seen && (CurrentToken() == Token::kTHIS)) { |
| 887 ConsumeToken(); | 887 ConsumeToken(); |
| 888 ExpectToken(Token::kPERIOD); | 888 ExpectToken(Token::kPERIOD); |
| 889 this_seen = true; | 889 this_seen = true; |
| 890 parameter.is_field_initializer = true; | 890 parameter.is_field_initializer = true; |
| 891 } | 891 } |
| 892 | 892 |
| 893 // At this point, we must see an identifier for the parameter name. | 893 // At this point, we must see an identifier for the parameter name. |
| 894 parameter.name_pos = token_index_; | 894 parameter.name_pos = token_index_; |
| 895 parameter.name = ExpectIdentifier("parameter name expected"); | 895 parameter.name = ExpectIdentifier("parameter name expected"); |
| 896 if (params->has_named_optional_parameters && |
| 897 (parameter.name->CharAt(0) == '_')) { |
| 898 ErrorMsg(parameter.name_pos, |
| 899 "named optional parameters may not start with '_'\n"); |
| 900 } |
| 896 | 901 |
| 897 if (parameter.is_field_initializer) { | 902 if (parameter.is_field_initializer) { |
| 898 params->has_field_initializer = true; | 903 params->has_field_initializer = true; |
| 899 } | 904 } |
| 900 | 905 |
| 901 if (CurrentToken() == Token::kLPAREN) { | 906 if (CurrentToken() == Token::kLPAREN) { |
| 902 // This parameter is probably a closure. If we saw the keyword 'var' | 907 // This parameter is probably a closure. If we saw the keyword 'var' |
| 903 // or 'final', a closure is not legal here and we ignore the | 908 // or 'final', a closure is not legal here and we ignore the |
| 904 // opening parens. | 909 // opening parens. |
| 905 if (!var_seen && !parameter.is_final) { | 910 if (!var_seen && !parameter.is_final) { |
| (...skipping 7301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8207 void Parser::SkipQualIdent() { | 8212 void Parser::SkipQualIdent() { |
| 8208 ASSERT(IsIdentifier()); | 8213 ASSERT(IsIdentifier()); |
| 8209 ConsumeToken(); | 8214 ConsumeToken(); |
| 8210 if (CurrentToken() == Token::kPERIOD) { | 8215 if (CurrentToken() == Token::kPERIOD) { |
| 8211 ConsumeToken(); // Consume the kPERIOD token. | 8216 ConsumeToken(); // Consume the kPERIOD token. |
| 8212 ExpectIdentifier("identifier expected after '.'"); | 8217 ExpectIdentifier("identifier expected after '.'"); |
| 8213 } | 8218 } |
| 8214 } | 8219 } |
| 8215 | 8220 |
| 8216 } // namespace dart | 8221 } // namespace dart |
| OLD | NEW |