Get rid of the support for the old parameter syntax.

I've CC'ed Matthias too and I wouldn't be surprised if he can
find a nicer way of dealing with this, but this is pretty
simple and allows me to make progress on getting rid of the
old syntax.

R=iposva@google.com
BUG=
TEST=

Review URL: https://chromereviews.googleplex.com/3569013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@199 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
kasperl@google.com 2011-10-07 08:03:04 +00:00
parent cb3a9f6641
commit de889ee719
4 changed files with 12 additions and 22 deletions

View file

@ -40,7 +40,7 @@ TEST_CASE(CodeIndexTable) {
for (int i = 0; i < kNumFunctions; i++) {
OS::SNPrint(buffer,
256,
"static foo%d(int i=1,int j=2,int k=3){return i+j+k;}", i);
"static foo%d([int i=1,int j=2,int k=3]){return i+j+k;}", i);
written += OS::SNPrint((scriptChars + written),
(kScriptSize - written),
"%s",
@ -65,7 +65,7 @@ TEST_CASE(CodeIndexTable) {
// Now load up class B with 1024 functions.
written = OS::SNPrint(scriptChars, kScriptSize, "class B {");
// Create one large function.
OS::SNPrint(buffer, sizeof(buffer), "static moo0(int i=1) { return ");
OS::SNPrint(buffer, sizeof(buffer), "static moo0([int i=1]) { return ");
written += OS::SNPrint((scriptChars + written),
(kScriptSize - written),
"%s",
@ -90,7 +90,7 @@ TEST_CASE(CodeIndexTable) {
for (int i = 1; i < kNumFunctions; i++) {
OS::SNPrint(buffer,
256,
"static moo%d(int i=1,int j=2,int k=3){return i+j+k;}", i);
"static moo%d([int i=1,int j=2,int k=3]){return i+j+k;}", i);
written += OS::SNPrint((scriptChars + written),
(kScriptSize - written),
"%s",

View file

@ -26,7 +26,6 @@ DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks.");
DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations.");
DEFINE_FLAG(bool, warning_as_error, false, "Treat warnings as errors.");
DEFINE_FLAG(bool, silent_warnings, true, "Silence warnings.");
DEFINE_FLAG(bool, warn_params, false, "Report legacy parameter syntax");
// All references to Dart names are listed here.
static const char* kAssertErrorName = "AssertError";
@ -883,20 +882,9 @@ void Parser::ParseFormalParameter(bool allow_explicit_default_value,
}
if (CurrentToken() == Token::kASSIGN) {
if (!allow_explicit_default_value) {
// TODO(regis): Remove support for legacy optional parameters:
// The if guard below needs to be removed, i.e. the error must
// be reported for both positional and named optional parameters.
if (params->has_named_optional_parameters) {
ErrorMsg("parameter must not specify a default value");
}
}
if (FLAG_warn_params && !params->has_named_optional_parameters) {
// Turn on warnings automagically.
bool save_silent = FLAG_silent_warnings;
FLAG_silent_warnings = false;
Warning("legacy optional parameter '%s'", parameter.name->ToCString());
FLAG_silent_warnings = save_silent;
if (!params->has_named_optional_parameters ||
!allow_explicit_default_value) {
ErrorMsg("parameter must not specify a default value");
}
ConsumeToken();
params->num_optional_parameters++;

View file

@ -108,7 +108,7 @@ TEST_CASE(ParseClassDefinition) {
" final int f3, f4; \n"
" static String s1, s2; \n"
" static final int s3 = 8675309; \n"
" static bar(i, var d = 5) { return 77; } \n"
" static bar(i, [var d = 5]) { return 77; } \n"
" static foo() native \"native_function_name\"; \n"
"} \n";
@ -147,7 +147,7 @@ TEST_CASE(ParseClassDefinition) {
TEST_CASE(Parser_TopLevel) {
const char* script_chars =
"class A extends B { \n"
" static bar(var i, var d = 5) { return 77; } \n"
" static bar(var i, [var d = 5]) { return 77; } \n"
" static foo() { return 42; } \n"
" static baz(var i) { var q = 5; return i + q; } \n"
"} \n"

View file

@ -140,12 +140,10 @@ LibTest/core/Date/toString/Date/toString/A01/t01 : Skip
LibTest/core/Date/year/Date/year/A01/t01 : Skip
LibTest/core/Date/year/Date/year/A01/t02 : Skip
# The illegal constructor initializer in this test does not get compiled.
# This test does fail as it's supposed to when invoked with the --compile_all flag.
LangGuideTest/02_Language_Constructs/02_1_Class/02_1_Class_Construction/A08/t02: Skip
# The DateTime class has been renamed to Date
LibTest/core/DateTime/compareTo/DateTime/compareTo/A01/t01: Skip
LibTest/core/DateTime/compareTo/DateTime/compareTo/A01/t02: Skip
@ -202,6 +200,10 @@ LibTest/core/RegExp/firstMatch/Pattern_semantics/15.10.2.12_CharacterClassEscape
LibTest/core/RegExp/hasMatch/Pattern_semantics/15.10.2.11_DecimalEscape/RegExp/hasMatch/DecimalEscape/A01/t04: Fail
LibTest/core/RegExp/firstMatch/Pattern_semantics/15.10.2.11_DecimalEscape/RegExp/firstMatch/DecimalEscape/A01/t04: Fail
# Following tests uses the old syntax for default argument values.
LibTest/core/RegExp/firstMatch/Pattern_semantics/15.10.2.06_Assertion/RegExp/firstMatch/Assertion/A01/t01: Fail
LibTest/core/RegExp/firstMatch/Pattern_semantics/15.10.2.15_NonEmptyClassRanges/RegExp/firstMatch/NonEmptyClassRanges/A01/t03: Fail
# Rationals are not part of the language anymore so the test below which
# uses Rationals is incorrect. Marking as Fail,Okay
LangGuideTest/03_Values/03_2_Numbers/A02/t01: Fail,Okay