Skip to content

Commit 658eecb

Browse files
committed
We expand attributes at compile time
1 parent 6dabf2f commit 658eecb

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

fluent.runtime/fluent/runtime/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from .builtins import BUILTINS
1111
from .prepare import Compiler
1212
from .resolver import ResolverEnvironment, CurrentEnvironment
13-
from .utils import ATTRIBUTE_SEPARATOR, TERM_SIGIL, add_message_and_attrs_to_store, ast_to_id, native_to_fluent
13+
from .utils import ATTRIBUTE_SEPARATOR, TERM_SIGIL, ast_to_id, native_to_fluent
1414

1515

1616
class FluentBundle(object):
@@ -47,9 +47,7 @@ def add_messages(self, source):
4747
if isinstance(item, (Message, Term)):
4848
full_id = ast_to_id(item)
4949
if full_id not in self._messages_and_terms:
50-
# We add attributes to the store to enable faster looker
51-
# later, and more direct code in some instances.
52-
add_message_and_attrs_to_store(self._messages_and_terms, full_id, item)
50+
self._messages_and_terms[full_id] = item
5351

5452
def has_message(self, message_id):
5553
if message_id.startswith(TERM_SIGIL) or ATTRIBUTE_SEPARATOR in message_id:

fluent.runtime/fluent/runtime/utils.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,6 @@ def ast_to_id(ast):
2121
return ast.id.name
2222

2323

24-
def add_message_and_attrs_to_store(store, ref_id, item, is_parent=True):
25-
store[ref_id] = item
26-
if is_parent:
27-
for attr in item.attributes:
28-
add_message_and_attrs_to_store(store,
29-
_make_attr_id(ref_id, attr.id.name),
30-
attr,
31-
is_parent=False)
32-
33-
3424
def native_to_fluent(val):
3525
"""
3626
Convert a python type to a Fluent Type.

0 commit comments

Comments
 (0)