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

Unified Diff: runtime/vm/parser.cc

Issue 1923743002: Don’t cache constants in initializer expressions (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 14446d997566b961a762f96e7cb7dd5bff590864..98254a75610be88827f2b31019f90c9bb249fce9 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -12011,6 +12011,11 @@ typedef UnorderedHashMap<ConstMapKeyEqualsTraits> ConstantsMap;
void Parser::CacheConstantValue(TokenPosition token_pos,
const Instance& value) {
+ if (current_function().kind() == RawFunction::kImplicitStaticFinalGetter) {
+ // Don't cache constants in initializer expressions. They get
+ // evaluated only once.
+ return;
+ }
ConstantPosKey key(String::Handle(Z, script_.url()), token_pos);
if (isolate()->object_store()->compile_time_constants() == Array::null()) {
const intptr_t kInitialConstMapSize = 16;
« 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