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

Unified Diff: runtime/vm/parser.cc

Issue 219473007: Deferred prefix support in metadata (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/deferred_constraints_constants_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 34600)
+++ runtime/vm/parser.cc (working copy)
@@ -906,6 +906,13 @@
if (!IsIdentifier()) {
ExpectIdentifier("identifier expected");
}
+ // Reject expressions with deferred library prefix eagerly.
+ Object& obj = Object::Handle(library_.LookupLocalObject(*CurrentLiteral()));
+ if (!obj.IsNull() && obj.IsLibraryPrefix()) {
+ if (LibraryPrefix::Cast(obj).is_deferred_load()) {
+ ErrorMsg("Metadata must be compile-time constant");
+ }
+ }
AstNode* expr = NULL;
if ((LookaheadToken(1) == Token::kLPAREN) ||
((LookaheadToken(1) == Token::kPERIOD) &&
@@ -9247,8 +9254,11 @@
obj = prefix.LookupObject(ident);
} else {
// Remember that this function depends on an import prefix of an
- // unloaded deferred library.
- parsed_function()->AddDeferredPrefix(prefix);
+ // unloaded deferred library. Note that parsed_function() can be
+ // NULL when parsing expressions outside the scope of a function.
+ if (parsed_function() != NULL) {
+ parsed_function()->AddDeferredPrefix(prefix);
+ }
}
if (obj.IsNull()) {
// Unresolved prefixed primary identifier.
« no previous file with comments | « no previous file | tests/language/deferred_constraints_constants_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698