1.1 --- a/micropython/ast.py Mon Apr 28 00:53:10 2008 +0200
1.2 +++ b/micropython/ast.py Mon Apr 28 21:19:42 2008 +0200
1.3 @@ -255,10 +255,15 @@
1.4 return
1.5
1.6 # Get the details of the access.
1.7 - # NOTE: Support constants here.
1.8
1.9 target = last.attr.value
1.10 - target_name = target.full_name()
1.11 +
1.12 + if isinstance(target, micropython.inspect.Const):
1.13 + target_name = target.value_type_name()
1.14 + else:
1.15 + target_name = target.full_name()
1.16 +
1.17 + # Access the object table to get the attribute position.
1.18
1.19 try:
1.20 table_entry = self.objtable.table[target_name]
1.21 @@ -272,9 +277,9 @@
1.22 raise TranslateError(self.module.full_name(), node,
1.23 "No attribute entry exists for name %r in target %r." % (attrname, target_name))
1.24
1.25 - # NOTE: Support constants here.
1.26 + # Produce a suitable instruction.
1.27
1.28 - if isinstance(target, micropython.inspect.Instance):
1.29 + if isinstance(target, micropython.inspect.Const):
1.30 self.replace_op(AttrInstruction(pos))
1.31 else:
1.32 self.replace_op(AddressInstruction(pos))
1.33 @@ -418,16 +423,8 @@
1.34
1.35 frame_pos = len(args)
1.36
1.37 - # NOTE: If any extra keywords were identified, generate them now.
1.38 - # NOTE: This needs to populate a ** argument dictionary.
1.39 - #
1.40 - # for arg in extra_keywords:
1.41 - # const = self.module.constant_values[arg.name]
1.42 - # self.new_op(LoadConst(const))
1.43 - # self.dispatch(arg.expr)
1.44 - # frame_pos += 1
1.45 -
1.46 - # NOTE: Somehow, the above needs to be combined with * and ** arguments.
1.47 + # NOTE: Extra keywords are not supported.
1.48 + # NOTE: Somehow, the above needs to be combined with * arguments.
1.49
1.50 # Either test for a complete set of arguments.
1.51
1.52 @@ -556,7 +553,7 @@
1.53 def _have_constant_input(self, n):
1.54 last = self.last_ops(n+1)
1.55 return len(last) > n and (isinstance(last[n], LoadAddress) and last[n].attr.assignments == 1 or
1.56 - isinstance(last[n], LoadConst))
1.57 + isinstance(last[n], LoadConst)) # and not isinstance(last[n].attr, micropython.inspect.Instance)
1.58
1.59 def _have_known_target(self):
1.60 return self._have_constant_input(0)