Libraries: update VM to current spec

- Exports allowed in script files
- library name is optional
- delete meaningless test, file co19 bugs
Review URL: https://codereview.chromium.org//12382026

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19258 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
hausner@google.com 2013-02-28 21:17:47 +00:00
parent ba7597afb4
commit 34cebe18cb
4 changed files with 8 additions and 28 deletions

View file

@ -4550,9 +4550,6 @@ void Parser::ParseLibraryDefinition() {
return;
}
const bool is_script = (script_.kind() == RawScript::kScriptTag);
const bool is_library = (script_.kind() == RawScript::kLibraryTag);
const bool is_patch = (script_.kind() == RawScript::kPatchTag);
ASSERT(script_.kind() != RawScript::kSourceTag);
// We may read metadata tokens that are part of the toplevel
@ -4562,20 +4559,15 @@ void Parser::ParseLibraryDefinition() {
intptr_t metadata_pos = TokenPos();
SkipMetadata();
if (CurrentToken() == Token::kLIBRARY) {
if (is_patch) {
if (is_patch_source()) {
ErrorMsg("patch cannot override library name");
}
ParseLibraryName();
metadata_pos = TokenPos();
SkipMetadata();
} else if (is_library) {
ErrorMsg("library name definition expected");
}
while ((CurrentToken() == Token::kIMPORT) ||
(CurrentToken() == Token::kEXPORT)) {
if (is_script && (CurrentToken() == Token::kEXPORT)) {
ErrorMsg("export not allowed in scripts");
}
ParseLibraryImportExport();
metadata_pos = TokenPos();
SkipMetadata();

View file

@ -10,6 +10,13 @@ LibTest/core/Strings/join_A04_t01: Fail, OK # checks for ArgumentError. TypeErro
Language/13_Libraries_and_Scripts/1_Imports_A02_t21: Crash # Dart issue 6060
Language/13_Libraries_and_Scripts/1_Imports_A02_t22: Crash # Dart issue 6060
Language/13_Libraries_and_Scripts/1_Imports_A04_t03: Fail # co19 issue 385
Language/13_Libraries_and_Scripts/2_Exports_A05_t01: Fail # co19 issue 385
Language/13_Libraries_and_Scripts/4_Scripts_A01_t20: Fail # co19 issue 387
Language/13_Libraries_and_Scripts/4_Scripts_A01_t21: Fail # co19 issue 387
Language/13_Libraries_and_Scripts/4_Scripts_A01_t22: Fail # co19 issue 387
Language/13_Libraries_and_Scripts/4_Scripts_A01_t23: Fail # co19 issue 387
Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t10: Fail # co19 issue 348
Language/07_Classes/3_Setters_A04_t01: Fail # co19 issue 383
Language/07_Classes/3_Setters_A04_t04: Fail # co19 issue 383

View file

@ -1,7 +0,0 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
class A {
var a;
}

View file

@ -1,12 +0,0 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Imported library does not start with a library tag.
library ScriptNegativeTest.dart;
import "script_negative_lib.dart";
main() {
print("Should not reach here.");
}