/src/tools/interpreter/liberty_interpreter_feature_call.e

http://github.com/tybor/Liberty · Specman e · 734 lines · 647 code · 68 blank · 19 comment · 40 complexity · ee0148e5933a45875478826d0f337141 MD5 · raw file

  1. -- This file is part of Liberty Eiffel.
  2. --
  3. -- Liberty Eiffel is free software: you can redistribute it and/or modify
  4. -- it under the terms of the GNU General Public License as published by
  5. -- the Free Software Foundation, version 3 of the License.
  6. --
  7. -- Liberty Eiffel is distributed in the hope that it will be useful,
  8. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. -- GNU General Public License for more details.
  11. --
  12. -- You should have received a copy of the GNU General Public License
  13. -- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
  14. --
  15. class LIBERTY_INTERPRETER_FEATURE_CALL
  16. inherit
  17. LIBERTY_FEATURE_VISITOR
  18. insert
  19. LIBERTY_TAGS
  20. LOGGING
  21. creation {LIBERTY_INTERPRETER}
  22. make, make_precursor
  23. feature {ANY}
  24. name: FIXED_STRING
  25. target: LIBERTY_INTERPRETER_OBJECT
  26. parameters: TRAVERSABLE[LIBERTY_INTERPRETER_OBJECT]
  27. position: LIBERTY_POSITION
  28. definition_type: LIBERTY_ACTUAL_TYPE is
  29. do
  30. Result := bound_feature.definition_type
  31. end
  32. returned_static_type: LIBERTY_ACTUAL_TYPE
  33. feature {LIBERTY_INTERPRETER_EXTERNAL_PLUGINS}
  34. bound_feature: LIBERTY_FEATURE
  35. feature {LIBERTY_INTERPRETER}
  36. call (debug_steps: LIBERTY_INTERPRETER_DEBUGGER_STEPS) is
  37. do
  38. check not prepare end
  39. if log.is_trace then
  40. log_call(once "Calling")
  41. end
  42. prepare := True
  43. bound_feature.accept(Current)
  44. prepare := False
  45. debug_steps.enter_call
  46. if options.is_invariant_checked then
  47. check_invariant
  48. end
  49. if options.is_require_checked then
  50. check_precondition
  51. end
  52. debug ("interpreter.call.steps")
  53. debug_step(once"Calling the feature")
  54. end
  55. bound_feature.accept(Current)
  56. if parameters = Void and then options.is_ensure_checked then
  57. -- Can happen only when semi-evaluated built-in externals are used
  58. -- In that case the postcondition must not depend on the arguments...
  59. prepare_postcondition
  60. end
  61. if options.is_ensure_checked then
  62. check_postcondition
  63. end
  64. if options.is_invariant_checked then
  65. check_invariant
  66. end
  67. debug_steps.exit_call
  68. if log.is_trace then
  69. log_call(once "Returning from")
  70. end
  71. end
  72. feature {LIBERTY_FEATURE_ACCELERATOR}
  73. accelerate_call (a: LIBERTY_FEATURE_ACCELERATOR) is
  74. do
  75. bound_feature.accelerate_call(a)
  76. end
  77. feature {LIBERTY_INTERPRETER, LIBERTY_INTERPRETER_EXTERNAL_BUILTINS_CALLER}
  78. evaluate_parameters is
  79. local
  80. i: INTEGER; p: FAST_ARRAY[LIBERTY_INTERPRETER_OBJECT]
  81. val: LIBERTY_INTERPRETER_OBJECT
  82. formal_type: LIBERTY_ACTUAL_TYPE; actual_type: LIBERTY_KNOWN_TYPE
  83. do
  84. if parameters = Void then
  85. interpreter.set_evaluating_parameters(Current)
  86. if bound_feature.parameters.count /= actuals.count then
  87. interpreter.fatal_error("Bad parameters count: expected " + bound_feature.parameters.count.out
  88. + " but got " + actuals.count.out, position)
  89. end
  90. check
  91. bound_feature.parameters.lower = actuals.lower
  92. end
  93. from
  94. create p.with_capacity(actuals.count)
  95. i := actuals.lower
  96. until
  97. i > actuals.upper
  98. loop
  99. actuals.item(i).accept(interpreter.expressions)
  100. val := interpreter.expressions.eval_as_right_value
  101. formal_type ::= bound_feature.parameters.item(i).result_type.known_type
  102. actual_type := val.type.known_type
  103. if actual_type.is_conform_to(formal_type) then
  104. p.add_last(val)
  105. elseif actual_type.converts_to(formal_type) then
  106. p.add_last(interpreter.object_converter.convert_object(val, formal_type))
  107. else
  108. interpreter.fatal_error("Bad object type: " + actual_type.full_name + " does not conform or convert to " + formal_type.full_name, actuals.item(i).position)
  109. p.add_last(val)
  110. end
  111. i := i + 1
  112. end
  113. parameters := p
  114. interpreter.unset_evaluating_parameters(Current)
  115. prepare_parameter_map(bound_feature)
  116. debug ("interpreter.call.internals")
  117. show_parameter_map(std_output)
  118. std_output.put_new_line
  119. end
  120. if options.is_ensure_checked then
  121. prepare_postcondition
  122. end
  123. end
  124. end
  125. feature {LIBERTY_INTERPRETER, LIBERTY_INTERPRETER_EXTERNAL_BUILTIN_CALL, LIBERTY_INTERPRETER_EXTERNAL_PLUGINS}
  126. returned_object: LIBERTY_INTERPRETER_OBJECT
  127. set_returned_object (a_returned_object: like returned_object) is
  128. do
  129. if returned_static_type = Void then
  130. check a_returned_object = Void end
  131. else
  132. returned_object := a_returned_object
  133. debug ("interpreter.call.internals")
  134. std_output.put_string(once " >>> Feature ")
  135. std_output.put_string(name)
  136. std_output.put_string(once " @")
  137. std_output.put_string(to_pointer.out)
  138. std_output.put_string(once ": setting Result to ")
  139. interpreter.object_printer.print_object(std_output, returned_object, 2)
  140. end
  141. end
  142. ensure
  143. returned_object = a_returned_object
  144. end
  145. local_static_type (local_name: FIXED_STRING): LIBERTY_ACTUAL_TYPE is
  146. do
  147. Result := local_types.reference_at(local_name)
  148. end
  149. set_local_value (local_name: FIXED_STRING; value: LIBERTY_INTERPRETER_OBJECT) is
  150. do
  151. local_map.put(value, local_name)
  152. end
  153. local_value (local_name: FIXED_STRING): LIBERTY_INTERPRETER_OBJECT is
  154. do
  155. if local_map = Void then
  156. interpreter.fatal_error("Locals map not ready!", position)
  157. end
  158. Result := local_map.fast_reference_at(local_name)
  159. end
  160. parameter (parameter_name: FIXED_STRING): LIBERTY_INTERPRETER_OBJECT is
  161. do
  162. if parameter_map = Void then
  163. interpreter.fatal_error("Parameters map not ready!", position)
  164. end
  165. Result := parameter_map.fast_reference_at(parameter_name)
  166. end
  167. writable_feature_static_type (a_feature_name: LIBERTY_FEATURE_NAME): LIBERTY_ACTUAL_TYPE is
  168. do
  169. Result ::= target.type.feature_definition(a_feature_name).result_type.known_type
  170. end
  171. set_writable_feature (a_name: LIBERTY_FEATURE_NAME; a_value: LIBERTY_INTERPRETER_OBJECT) is
  172. local
  173. struct: LIBERTY_INTERPRETER_OBJECT_STRUCTURE
  174. do
  175. struct ::= target
  176. struct.put_attribute(a_name.name, a_value)
  177. end
  178. writable_feature (a_name: LIBERTY_FEATURE_NAME): LIBERTY_INTERPRETER_OBJECT is
  179. local
  180. struct: LIBERTY_INTERPRETER_OBJECT_STRUCTURE
  181. do
  182. struct ::= target
  183. Result := struct.attribute_object(a_name.name)
  184. end
  185. raised_exception: LIBERTY_INTERPRETER_EXCEPTION
  186. raise (a_exception: like raised_exception) is
  187. do
  188. raised_exception := a_exception
  189. ensure
  190. raised_exception = a_exception
  191. end
  192. feature {ANY}
  193. show_stack (o: OUTPUT_STREAM) is
  194. do
  195. o.put_string(once "Feature {")
  196. o.put_string(target.type.full_name)
  197. o.put_string(once "}.")
  198. o.put_string(name)
  199. o.put_string(once " @")
  200. o.put_line(to_pointer.out)
  201. if not position.is_unknown then
  202. o.put_character('%T')
  203. position.show(o)
  204. end
  205. o.put_new_line
  206. o.put_string(once "Current = ")
  207. interpreter.object_printer.print_object(o, target, 0)
  208. if returned_static_type /= Void then
  209. o.put_new_line
  210. o.put_string(once "Result = ")
  211. interpreter.object_printer.print_object(o, returned_object, 0)
  212. end
  213. show_parameter_map(o)
  214. show_local_map(o)
  215. end
  216. feature {}
  217. show_parameter_map (o: OUTPUT_STREAM) is
  218. do
  219. show_map(parameter_map, once "Parameters", o)
  220. end
  221. show_local_map (o: OUTPUT_STREAM) is
  222. do
  223. show_map(local_map, once "Locals", o)
  224. end
  225. show_map (map: DICTIONARY[LIBERTY_INTERPRETER_OBJECT, FIXED_STRING]; tag: STRING; o: OUTPUT_STREAM) is
  226. local
  227. i: INTEGER; obj: LIBERTY_INTERPRETER_OBJECT
  228. do
  229. if map = Void then
  230. o.put_new_line
  231. o.put_string(tag)
  232. o.put_line(once " map not yet computed")
  233. elseif not map.is_empty then
  234. o.put_new_line
  235. o.put_string(tag)
  236. o.put_line(once ":")
  237. from
  238. i := map.lower
  239. until
  240. i > map.upper
  241. loop
  242. o.put_string(once " ")
  243. o.put_string(map.key(i))
  244. o.put_string(once " = ")
  245. obj := map.item(i)
  246. interpreter.object_printer.print_object(o, obj, 1)
  247. i := i + 1
  248. end
  249. end
  250. end
  251. feature {LIBERTY_FEATURE_ATTRIBUTE}
  252. visit_liberty_feature_attribute (v: LIBERTY_FEATURE_ATTRIBUTE) is
  253. local
  254. t: LIBERTY_INTERPRETER_OBJECT_STRUCTURE
  255. fn: LIBERTY_FEATURE_NAME
  256. actual_type: LIBERTY_ACTUAL_TYPE
  257. do
  258. if prepare then
  259. evaluate_parameters
  260. else
  261. if t ?:= target then
  262. t ::= target
  263. if t.has_attribute(name) then
  264. set_returned_object(t.attribute_object(name))
  265. else
  266. create fn.make(name)
  267. if t.type.has_feature(fn) then
  268. -- at creation time
  269. actual_type ::= t.type.feature_definition(fn).result_type.known_type
  270. set_returned_object(interpreter.default_object(actual_type, t.position))
  271. t.put_attribute(name, returned_object)
  272. else
  273. interpreter.fatal_error("No such attribute: " + name, position)
  274. end
  275. end
  276. else
  277. --|*** TODO: not good. Native objects may have attributes too (e.g. string)
  278. interpreter.fatal_error("No such attribute: " + name, position)
  279. end
  280. end
  281. end
  282. feature {LIBERTY_FEATURE_CONSTANT}
  283. visit_liberty_feature_constant (v: LIBERTY_FEATURE_CONSTANT) is
  284. do
  285. if prepare then
  286. evaluate_parameters
  287. else
  288. v.expression.accept(interpreter.expressions)
  289. set_returned_object(interpreter.expressions.eval_as_right_value)
  290. end
  291. end
  292. feature {LIBERTY_FEATURE_DEFERRED}
  293. visit_liberty_feature_deferred (v: LIBERTY_FEATURE_DEFERRED) is
  294. do
  295. evaluate_parameters
  296. interpreter.fatal_error("Deferred feature called", position)
  297. end
  298. feature {LIBERTY_FEATURE_DO}
  299. visit_liberty_feature_do (v: LIBERTY_FEATURE_DO) is
  300. do
  301. if prepare then
  302. evaluate_parameters
  303. prepare_local_map(v)
  304. else
  305. v.block_instruction.accept(interpreter.instructions)
  306. end
  307. end
  308. feature {LIBERTY_FEATURE_EXTERNAL}
  309. visit_liberty_feature_external (v: LIBERTY_FEATURE_EXTERNAL) is
  310. do
  311. if prepare then
  312. inspect
  313. v.external_def
  314. when "built_in" then
  315. -- nothing
  316. when "plug_in" then
  317. evaluate_parameters
  318. else
  319. not_yet_implemented
  320. end
  321. else
  322. inspect
  323. v.external_def
  324. when "built_in" then
  325. interpreter.builtins.call(Current)
  326. when "plug_in" then
  327. interpreter.plugins.call(Current, v.alias_def, position)
  328. else
  329. not_yet_implemented
  330. end
  331. end
  332. end
  333. feature {LIBERTY_FEATURE_ONCE}
  334. visit_liberty_feature_once (v: LIBERTY_FEATURE_ONCE) is
  335. local
  336. tags: LIBERTY_TAGS
  337. do
  338. if prepare then
  339. evaluate_parameters
  340. if not tags.once_flag.is_set(v.original) then
  341. prepare_local_map(v)
  342. end
  343. elseif tags.once_flag.is_set(v.original) then
  344. log.trace.put_line(once "Once feature already called")
  345. set_returned_object(tags.once_flag.value(v.original))
  346. else
  347. log.trace.put_line(once "Evaluating once feature")
  348. v.block_instruction.accept(interpreter.instructions)
  349. tags.once_flag.add(returned_object, v.original)
  350. end
  351. end
  352. feature {LIBERTY_FEATURE_REDEFINED}
  353. visit_liberty_feature_redefined (v: LIBERTY_FEATURE_REDEFINED) is
  354. do
  355. v.redefined_feature.accept(Current)
  356. end
  357. feature {LIBERTY_FEATURE_UNIQUE}
  358. visit_liberty_feature_unique (v: LIBERTY_FEATURE_UNIQUE) is
  359. do
  360. if prepare then
  361. evaluate_parameters
  362. else
  363. not_yet_implemented
  364. end
  365. end
  366. feature {}
  367. make (a_interpreter: like interpreter; a_target: like target; a_feature_definition: LIBERTY_FEATURE_DEFINITION; a_actuals: like actuals; a_position: like position) is
  368. require
  369. a_interpreter /= Void
  370. a_target /= Void
  371. a_feature_definition /= Void
  372. a_actuals /= Void
  373. a_position /= Void
  374. do
  375. feature_name := a_feature_definition.feature_name
  376. name := feature_name.full_name
  377. interpreter := a_interpreter
  378. target := a_target
  379. actuals := a_actuals
  380. position := a_position
  381. bound_feature := a_feature_definition.the_feature.bound(a_target.type)
  382. if bound_feature.result_type /= Void then
  383. returned_static_type ::= bound_feature.result_type.known_type
  384. end
  385. create {ARRAY_DICTIONARY[TUPLE[LIBERTY_INTERPRETER_OBJECT, FIXED_STRING, LIBERTY_POSITION], LIBERTY_EXPRESSION]} old_values.with_capacity(0)
  386. if returned_static_type /= Void then
  387. returned_object := interpreter.default_object(returned_static_type, position)
  388. end
  389. ensure
  390. interpreter = a_interpreter
  391. target = a_target
  392. actuals = a_actuals
  393. end
  394. make_precursor (a_interpreter: like interpreter; a_target: like target; a_precursor: LIBERTY_FEATURE; a_actuals: like actuals; a_position: like position) is
  395. require
  396. a_interpreter /= Void
  397. a_target /= Void
  398. a_actuals /= Void
  399. a_position /= Void
  400. do
  401. name := name_precursor
  402. interpreter := a_interpreter
  403. target := a_target
  404. actuals := a_actuals
  405. position := a_position
  406. bound_feature := a_precursor
  407. if bound_feature.result_type /= Void then
  408. returned_static_type ::= bound_feature.result_type.known_type
  409. end
  410. create {ARRAY_DICTIONARY[TUPLE[LIBERTY_INTERPRETER_OBJECT, FIXED_STRING, LIBERTY_POSITION], LIBERTY_EXPRESSION]} old_values.with_capacity(0)
  411. ensure
  412. interpreter = a_interpreter
  413. target = a_target
  414. actuals = a_actuals
  415. end
  416. feature_name: LIBERTY_FEATURE_NAME
  417. name_precursor: FIXED_STRING is
  418. once
  419. Result := "Precursor".intern
  420. end
  421. interpreter: LIBERTY_INTERPRETER
  422. actuals: TRAVERSABLE[LIBERTY_EXPRESSION]
  423. parameter_types: DICTIONARY[LIBERTY_ACTUAL_TYPE, FIXED_STRING]
  424. parameter_map: DICTIONARY[LIBERTY_INTERPRETER_OBJECT, FIXED_STRING]
  425. local_types: DICTIONARY[LIBERTY_ACTUAL_TYPE, FIXED_STRING]
  426. local_map: DICTIONARY[LIBERTY_INTERPRETER_OBJECT, FIXED_STRING]
  427. empty_types: DICTIONARY[LIBERTY_ACTUAL_TYPE, FIXED_STRING] is
  428. once
  429. create {AVL_DICTIONARY[LIBERTY_ACTUAL_TYPE, FIXED_STRING]} Result.make
  430. end
  431. empty_map: DICTIONARY[LIBERTY_INTERPRETER_OBJECT, FIXED_STRING] is
  432. once
  433. create {AVL_DICTIONARY[LIBERTY_INTERPRETER_OBJECT, FIXED_STRING]} Result.make
  434. end
  435. prepare_parameter_map (f: LIBERTY_FEATURE) is
  436. require
  437. parameters /= Void
  438. local
  439. i: INTEGER; p: LIBERTY_PARAMETER
  440. actual_type: LIBERTY_ACTUAL_TYPE
  441. do
  442. if f.parameters.count /= actuals.count then
  443. interpreter.fatal_error("Bad number of arguments: expected " + f.parameters.count.out
  444. + " but got " + actuals.count.out, position)
  445. end
  446. if actuals.is_empty then
  447. parameter_types := empty_types
  448. parameter_map := empty_map
  449. else
  450. check
  451. f.parameters.lower = actuals.lower
  452. parameters.lower = actuals.lower
  453. end
  454. create {HASHED_DICTIONARY[LIBERTY_ACTUAL_TYPE, FIXED_STRING]} parameter_types.with_capacity(actuals.count)
  455. create {HASHED_DICTIONARY[LIBERTY_INTERPRETER_OBJECT, FIXED_STRING]} parameter_map.with_capacity(actuals.count)
  456. from
  457. i := actuals.lower
  458. until
  459. i > actuals.upper
  460. loop
  461. p := f.parameters.item(i)
  462. actual_type ::= p.result_type.known_type
  463. parameter_types.add(actual_type, p.name)
  464. parameter_map.add(parameters.item(i), p.name)
  465. i := i + 1
  466. end
  467. end
  468. ensure
  469. parameter_types /= Void
  470. parameter_map /= Void
  471. end
  472. prepare_local_map (f: LIBERTY_FEATURE_ROUTINE) is
  473. local
  474. i: INTEGER; l: LIBERTY_LOCAL; def: LIBERTY_INTERPRETER_OBJECT
  475. actual_type: LIBERTY_ACTUAL_TYPE
  476. do
  477. if f.locals.is_empty then
  478. local_types := empty_types
  479. local_map := empty_map
  480. else
  481. create {HASHED_DICTIONARY[LIBERTY_ACTUAL_TYPE, FIXED_STRING]} local_types.with_capacity(f.locals.count)
  482. create {HASHED_DICTIONARY[LIBERTY_INTERPRETER_OBJECT, FIXED_STRING]} local_map.with_capacity(f.locals.count)
  483. from
  484. i := f.locals.lower
  485. until
  486. i > f.locals.upper
  487. loop
  488. l := f.locals.item(i)
  489. actual_type ::= l.result_type.known_type
  490. local_types.add(actual_type, l.name)
  491. def := interpreter.default_object(actual_type, l.position)
  492. local_map.add(def, l.name)
  493. i := i + 1
  494. end
  495. end
  496. ensure
  497. local_types /= Void
  498. local_map /= Void
  499. end
  500. feature {LIBERTY_INTERPRETER}
  501. has_old_value (a_expression: LIBERTY_EXPRESSION): BOOLEAN is
  502. do
  503. Result := old_values.fast_has(a_expression)
  504. end
  505. old_value (a_expression: LIBERTY_EXPRESSION): LIBERTY_INTERPRETER_OBJECT is
  506. require
  507. has_old_value(a_expression)
  508. local
  509. t: TUPLE[LIBERTY_INTERPRETER_OBJECT, FIXED_STRING, LIBERTY_POSITION]
  510. do
  511. t := old_values.fast_at(a_expression)
  512. if t.second /= Void then
  513. interpreter.fatal_error(t.second, t.third)
  514. end
  515. Result := t.first
  516. end
  517. add_old_value (a_expression: LIBERTY_EXPRESSION; a_value: LIBERTY_INTERPRETER_OBJECT; a_fatal_error: FIXED_STRING; a_fatal_position: LIBERTY_POSITION) is
  518. require
  519. not has_old_value(a_expression)
  520. do
  521. old_values.add([a_value, a_fatal_error, a_fatal_position], a_expression)
  522. debug ("interpreter.call.internals")
  523. std_output.put_string(once " >>> Feature ")
  524. std_output.put_string(name)
  525. std_output.put_string(once " @")
  526. std_output.put_string(to_pointer.out)
  527. std_output.put_string(once ": adding old value: ")
  528. interpreter.object_printer.print_object(std_output, a_value, 2)
  529. end
  530. ensure
  531. old_values.fast_at(a_expression).first = a_value
  532. old_values.fast_at(a_expression).second = a_fatal_error
  533. old_values.fast_at(a_expression).third = a_fatal_position
  534. a_fatal_error = Void implies old_value(a_expression) = a_value
  535. end
  536. feature {}
  537. check_invariant is
  538. require
  539. options.is_invariant_checked
  540. do
  541. debug ("interpreter.call.steps")
  542. debug_step(once "Checking invariant")
  543. end
  544. interpreter.assertions.validate(target.type.the_invariant, once "Invariant")
  545. debug ("interpreter.call.steps")
  546. debug_step(once "Done checking invariant")
  547. end
  548. end
  549. check_precondition is
  550. require
  551. options.is_require_checked
  552. do
  553. debug ("interpreter.call.steps")
  554. debug_step(once "Checking precondition")
  555. end
  556. interpreter.assertions.validate(bound_feature.precondition, once "Precondition")
  557. debug ("interpreter.call.steps")
  558. debug_step(once "Done checking precondition")
  559. end
  560. end
  561. prepare_postcondition is
  562. require
  563. options.is_ensure_checked
  564. do
  565. debug ("interpreter.call.steps")
  566. debug_step(once "Preparing postcondition (gathering old values)")
  567. end
  568. interpreter.postcondition_browser.gather_old(bound_feature.postcondition)
  569. debug ("interpreter.call.steps")
  570. debug_step(once "Done preparing postcondition (gathering old values)")
  571. end
  572. end
  573. check_postcondition is
  574. require
  575. options.is_ensure_checked
  576. do
  577. debug ("interpreter.call.steps")
  578. debug_step(once "Checking postcondition")
  579. end
  580. interpreter.assertions.validate(bound_feature.postcondition, once "Postcondition")
  581. debug ("interpreter.call.steps")
  582. debug_step(once "Done checking postcondition")
  583. end
  584. end
  585. options: LIBERTY_INTERPRETER_OPTIONS
  586. old_values: DICTIONARY[TUPLE[LIBERTY_INTERPRETER_OBJECT, FIXED_STRING, LIBERTY_POSITION], LIBERTY_EXPRESSION]
  587. prepare: BOOLEAN
  588. debug_step (step: STRING) is
  589. do
  590. std_output.put_new_line
  591. std_output.put_string(once " >>> ")
  592. std_output.put_string(name)
  593. std_output.put_string(once " @")
  594. std_output.put_string(to_pointer.out)
  595. std_output.put_string(once ": ")
  596. std_output.put_line(step)
  597. end
  598. log_call (tag: STRING) is
  599. require
  600. log.is_trace
  601. local
  602. i: INTEGER; log_out: OUTPUT_STREAM
  603. formals: TRAVERSABLE[LIBERTY_PARAMETER]
  604. p: LIBERTY_PARAMETER
  605. do
  606. log_out := log.trace
  607. log_out.put_string(tag)
  608. log_out.put_string(once " feature {")
  609. log_out.put_string(bound_feature.current_type.full_name)
  610. log_out.put_string(once "}.")
  611. log_out.put_string(name)
  612. formals := bound_feature.parameters
  613. if not formals.is_empty then
  614. log_out.put_character(' ')
  615. log_out.put_character('(')
  616. from
  617. i := formals.lower
  618. until
  619. i > formals.upper
  620. loop
  621. if i > formals.lower then
  622. log_out.put_string(once ", ")
  623. end
  624. log_out.put_string(formals.item(i).result_type.full_name)
  625. i := i + 1
  626. end
  627. log_out.put_character(')')
  628. end
  629. if returned_static_type /= Void then
  630. log_out.put_string(once ": ")
  631. log_out.put_string(returned_static_type.full_name)
  632. end
  633. if position.is_unknown then
  634. log_out.put_new_line
  635. else
  636. log_out.put_character(' ')
  637. position.show(log_out)
  638. end
  639. log_out.put_string(once " - Current=")
  640. interpreter.object_printer.print_object(log_out, target, 1)
  641. if parameter_map /= Void then
  642. from
  643. i := formals.lower
  644. until
  645. i > formals.upper
  646. loop
  647. p := formals.item(i)
  648. log_out.put_string(once " - ")
  649. log_out.put_string(p.name)
  650. log_out.put_character('=')
  651. interpreter.object_printer.print_object(log_out, parameter_map.fast_at(p.name), 1)
  652. i := i + 1
  653. end
  654. end
  655. if returned_object /= Void then
  656. log_out.put_string(once " - Result=")
  657. interpreter.object_printer.print_object(log_out, returned_object, 1)
  658. end
  659. end
  660. invariant
  661. interpreter /= Void
  662. actuals /= Void
  663. target /= Void
  664. name /= Void
  665. not interpreter.gathering_old_values implies ((returned_static_type = Void) = (returned_object = Void))
  666. end -- class LIBERTY_INTERPRETER_FEATURE_CALL