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

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

Issue 2073223002: Improve error message for illegal part of declarations (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | no next file » | 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 6044 matching lines...) Expand 10 before | Expand all | Expand 10 after
6055 } else { 6055 } else {
6056 ASSERT(is_export); 6056 ASSERT(is_export);
6057 library_.AddExport(ns); 6057 library_.AddExport(ns);
6058 } 6058 }
6059 } 6059 }
6060 6060
6061 6061
6062 void Parser::ParseLibraryPart() { 6062 void Parser::ParseLibraryPart() {
6063 const TokenPosition source_pos = TokenPos(); 6063 const TokenPosition source_pos = TokenPos();
6064 ConsumeToken(); // Consume "part". 6064 ConsumeToken(); // Consume "part".
6065 if (IsSymbol(Symbols::Of())) {
6066 ReportError("part of declarations are not allowed in script files");
6067 }
6065 CheckToken(Token::kSTRING, "url expected"); 6068 CheckToken(Token::kSTRING, "url expected");
6066 AstNode* url_literal = ParseStringLiteral(false); 6069 AstNode* url_literal = ParseStringLiteral(false);
6067 ASSERT(url_literal->IsLiteralNode()); 6070 ASSERT(url_literal->IsLiteralNode());
6068 ASSERT(url_literal->AsLiteralNode()->literal().IsString()); 6071 ASSERT(url_literal->AsLiteralNode()->literal().IsString());
6069 const String& url = String::Cast(url_literal->AsLiteralNode()->literal()); 6072 const String& url = String::Cast(url_literal->AsLiteralNode()->literal());
6070 ExpectSemicolon(); 6073 ExpectSemicolon();
6071 const String& canon_url = String::CheckedHandle( 6074 const String& canon_url = String::CheckedHandle(
6072 CallLibraryTagHandler(Dart_kCanonicalizeUrl, source_pos, url)); 6075 CallLibraryTagHandler(Dart_kCanonicalizeUrl, source_pos, url));
6073 CallLibraryTagHandler(Dart_kSourceTag, source_pos, canon_url); 6076 CallLibraryTagHandler(Dart_kSourceTag, source_pos, canon_url);
6074 } 6077 }
(...skipping 8532 matching lines...) Expand 10 before | Expand all | Expand 10 after
14607 const ArgumentListNode& function_args, 14610 const ArgumentListNode& function_args,
14608 const LocalVariable* temp_for_last_arg, 14611 const LocalVariable* temp_for_last_arg,
14609 bool is_super_invocation) { 14612 bool is_super_invocation) {
14610 UNREACHABLE(); 14613 UNREACHABLE();
14611 return NULL; 14614 return NULL;
14612 } 14615 }
14613 14616
14614 } // namespace dart 14617 } // namespace dart
14615 14618
14616 #endif // DART_PRECOMPILED_RUNTIME 14619 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698