standalone_expression.gd 715 B

123456789101112131415161718192021
  1. func test():
  2. # The following statements should all be reported as standalone expressions:
  3. 1234
  4. 0.0 + 0.0
  5. Color(1, 1, 1)
  6. Vector3.ZERO
  7. [true, false]
  8. float(125)
  9. # The following statements should not produce `STANDALONE_EXPRESSION`:
  10. var _a = 1
  11. _a = 2 # Assignment is a local (or global) side effect.
  12. @warning_ignore("redundant_await")
  13. await 3 # The `await` operand is usually a coroutine or a signal.
  14. absi(4) # A call (in general) can have side effects.
  15. @warning_ignore("return_value_discarded")
  16. preload("../../utils.notest.gd") # A static initializer may have side effects.
  17. """
  18. Python-like "comment".
  19. """
  20. @warning_ignore("standalone_ternary")
  21. 1 if 2 else 3 # Produces `STANDALONE_TERNARY` instead.