| 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 Warning(parameter.name_pos, | |
| 899 "named optional parameters may not start with '_'\n"); | |
| 900 } | |
| 901 if (parameter.is_field_initializer) { | 896 if (parameter.is_field_initializer) { |
| 902 params->has_field_initializer = true; | 897 params->has_field_initializer = true; |
| 903 } | 898 } |
| 904 | 899 |
| 905 if (CurrentToken() == Token::kLPAREN) { | 900 if (CurrentToken() == Token::kLPAREN) { |
| 906 // This parameter is probably a closure. If we saw the keyword 'var' | 901 // This parameter is probably a closure. If we saw the keyword 'var' |
| 907 // or 'final', a closure is not legal here and we ignore the | 902 // or 'final', a closure is not legal here and we ignore the |
| 908 // opening parens. | 903 // opening parens. |
| 909 if (!var_seen && !parameter.is_final) { | 904 if (!var_seen && !parameter.is_final) { |
| 910 // The parsed parameter type is actually the function result type. | 905 // The parsed parameter type is actually the function result type. |
| (...skipping 7300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8211 void Parser::SkipQualIdent() { | 8206 void Parser::SkipQualIdent() { |
| 8212 ASSERT(IsIdentifier()); | 8207 ASSERT(IsIdentifier()); |
| 8213 ConsumeToken(); | 8208 ConsumeToken(); |
| 8214 if (CurrentToken() == Token::kPERIOD) { | 8209 if (CurrentToken() == Token::kPERIOD) { |
| 8215 ConsumeToken(); // Consume the kPERIOD token. | 8210 ConsumeToken(); // Consume the kPERIOD token. |
| 8216 ExpectIdentifier("identifier expected after '.'"); | 8211 ExpectIdentifier("identifier expected after '.'"); |
| 8217 } | 8212 } |
| 8218 } | 8213 } |
| 8219 | 8214 |
| 8220 } // namespace dart | 8215 } // namespace dart |
| OLD | NEW |