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

Side by Side Diff: runtime/vm/parser.cc

Issue 2411633002: Add `=` as default-value separator for named parameters. (Closed)
Patch Set: Add co19 issue number Created 4 years, 2 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
« no previous file with comments | « pkg/compiler/lib/src/parser/parser.dart ('k') | tests/co19/co19-co19.status » ('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 (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 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED_RUNTIME 8 #ifndef DART_PRECOMPILED_RUNTIME
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 2167 matching lines...) Expand 10 before | Expand all | Expand 10 after
2178 2178
2179 if ((CurrentToken() == Token::kASSIGN) || (CurrentToken() == Token::kCOLON)) { 2179 if ((CurrentToken() == Token::kASSIGN) || (CurrentToken() == Token::kCOLON)) {
2180 if ((!params->has_optional_positional_parameters && 2180 if ((!params->has_optional_positional_parameters &&
2181 !params->has_optional_named_parameters) || 2181 !params->has_optional_named_parameters) ||
2182 !allow_explicit_default_value) { 2182 !allow_explicit_default_value) {
2183 ReportError("parameter must not specify a default value"); 2183 ReportError("parameter must not specify a default value");
2184 } 2184 }
2185 if (params->has_optional_positional_parameters) { 2185 if (params->has_optional_positional_parameters) {
2186 ExpectToken(Token::kASSIGN); 2186 ExpectToken(Token::kASSIGN);
2187 } else { 2187 } else {
2188 ExpectToken(Token::kCOLON); 2188 ConsumeToken();
2189 } 2189 }
2190 params->num_optional_parameters++; 2190 params->num_optional_parameters++;
2191 params->has_explicit_default_values = true; // Also if explicitly NULL. 2191 params->has_explicit_default_values = true; // Also if explicitly NULL.
2192 if (is_top_level_) { 2192 if (is_top_level_) {
2193 // Skip default value parsing. 2193 // Skip default value parsing.
2194 SkipExpr(); 2194 SkipExpr();
2195 } else { 2195 } else {
2196 const Instance& const_value = ParseConstExpr()->literal(); 2196 const Instance& const_value = ParseConstExpr()->literal();
2197 parameter.default_value = &const_value; 2197 parameter.default_value = &const_value;
2198 } 2198 }
(...skipping 12886 matching lines...) Expand 10 before | Expand all | Expand 10 after
15085 const ArgumentListNode& function_args, 15085 const ArgumentListNode& function_args,
15086 const LocalVariable* temp_for_last_arg, 15086 const LocalVariable* temp_for_last_arg,
15087 bool is_super_invocation) { 15087 bool is_super_invocation) {
15088 UNREACHABLE(); 15088 UNREACHABLE();
15089 return NULL; 15089 return NULL;
15090 } 15090 }
15091 15091
15092 } // namespace dart 15092 } // namespace dart
15093 15093
15094 #endif // DART_PRECOMPILED_RUNTIME 15094 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/parser/parser.dart ('k') | tests/co19/co19-co19.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698