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

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

Issue 1152833002: Add a runtime flag to control availability of dart:mirrors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/ast_transformer.h" 9 #include "vm/ast_transformer.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 26 matching lines...) Expand all
37 37
38 namespace dart { 38 namespace dart {
39 39
40 DEFINE_FLAG(bool, enable_debug_break, false, "Allow use of break \"message\"."); 40 DEFINE_FLAG(bool, enable_debug_break, false, "Allow use of break \"message\".");
41 DEFINE_FLAG(bool, load_deferred_eagerly, false, 41 DEFINE_FLAG(bool, load_deferred_eagerly, false,
42 "Load deferred libraries eagerly."); 42 "Load deferred libraries eagerly.");
43 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); 43 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations.");
44 DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef."); 44 DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef.");
45 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); 45 DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
46 DECLARE_FLAG(bool, warn_on_javascript_compatibility); 46 DECLARE_FLAG(bool, warn_on_javascript_compatibility);
47 47 DEFINE_FLAG(bool, enable_mirrors, true,
48 "Disable to make importing dart:mirrors an error.");
48 49
49 // Quick access to the current isolate and zone. 50 // Quick access to the current isolate and zone.
50 #define I (isolate()) 51 #define I (isolate())
51 #define Z (zone()) 52 #define Z (zone())
52 53
53 54
54 #if defined(DEBUG) 55 #if defined(DEBUG)
55 class TraceParser : public ValueObject { 56 class TraceParser : public ValueObject {
56 public: 57 public:
57 TraceParser(intptr_t token_pos, 58 TraceParser(intptr_t token_pos,
(...skipping 5718 matching lines...) Expand 10 before | Expand all | Expand 10 after
5776 } 5777 }
5777 5778
5778 // Ensure that private dart:_ libraries are only imported into dart: 5779 // Ensure that private dart:_ libraries are only imported into dart:
5779 // libraries, including indirectly through exports. 5780 // libraries, including indirectly through exports.
5780 const String& lib_url = String::Handle(Z, library_.url()); 5781 const String& lib_url = String::Handle(Z, library_.url());
5781 if (canon_url.StartsWith(Symbols::DartSchemePrivate()) && 5782 if (canon_url.StartsWith(Symbols::DartSchemePrivate()) &&
5782 !lib_url.StartsWith(Symbols::DartScheme())) { 5783 !lib_url.StartsWith(Symbols::DartScheme())) {
5783 ReportError(import_pos, "private library is not accessible"); 5784 ReportError(import_pos, "private library is not accessible");
5784 } 5785 }
5785 5786
5787 if (!FLAG_enable_mirrors && Symbols::DartMirrors().Equals(canon_url)) {
5788 ReportError(import_pos,
5789 "import of dart:mirrors with --enable-mirrors=false");
5790 }
5791
5786 if (is_import) { 5792 if (is_import) {
5787 if (prefix.IsNull() || (prefix.Length() == 0)) { 5793 if (prefix.IsNull() || (prefix.Length() == 0)) {
5788 ASSERT(!is_deferred_import); 5794 ASSERT(!is_deferred_import);
5789 library_.AddImport(ns); 5795 library_.AddImport(ns);
5790 } else { 5796 } else {
5791 LibraryPrefix& library_prefix = LibraryPrefix::Handle(Z); 5797 LibraryPrefix& library_prefix = LibraryPrefix::Handle(Z);
5792 library_prefix = library_.LookupLocalLibraryPrefix(prefix); 5798 library_prefix = library_.LookupLocalLibraryPrefix(prefix);
5793 if (!library_prefix.IsNull()) { 5799 if (!library_prefix.IsNull()) {
5794 // Check that prefix names of deferred import clauses are 5800 // Check that prefix names of deferred import clauses are
5795 // unique. 5801 // unique.
(...skipping 7681 matching lines...) Expand 10 before | Expand all | Expand 10 after
13477 void Parser::SkipQualIdent() { 13483 void Parser::SkipQualIdent() {
13478 ASSERT(IsIdentifier()); 13484 ASSERT(IsIdentifier());
13479 ConsumeToken(); 13485 ConsumeToken();
13480 if (CurrentToken() == Token::kPERIOD) { 13486 if (CurrentToken() == Token::kPERIOD) {
13481 ConsumeToken(); // Consume the kPERIOD token. 13487 ConsumeToken(); // Consume the kPERIOD token.
13482 ExpectIdentifier("identifier expected after '.'"); 13488 ExpectIdentifier("identifier expected after '.'");
13483 } 13489 }
13484 } 13490 }
13485 13491
13486 } // namespace dart 13492 } // namespace dart
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