Skip to content

Commit 5172851

Browse files
committed
self-review nits on VariableReference.
I wonder if we should throw on bad external variables instead of making them a silent runtime error.
1 parent 6d6c21a commit 5172851

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

fluent.runtime/fluent/runtime/resolver.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def lookup_reference(ref, env):
194194
return FluentNoneResolver(ref_id)
195195

196196

197-
class VariableReference(FTL.VariableReference):
197+
class VariableReference(FTL.VariableReference, BaseResolver):
198198
def __call__(self, env):
199199
name = self.id.name
200200
try:
@@ -205,10 +205,7 @@ def __call__(self, env):
205205
FluentReferenceError("Unknown external: {0}".format(name)))
206206
return FluentNoneResolver(name)
207207

208-
if isinstance(arg_val,
209-
(int, float, Decimal,
210-
date, datetime,
211-
text_type)):
208+
if isinstance(arg_val, (FluentType, text_type)):
212209
return arg_val
213210
env.errors.append(TypeError("Unsupported external type: {0}, {1}"
214211
.format(name, type(arg_val))))

0 commit comments

Comments
 (0)