Ticket #369 (closed enhancement: fixed)

Opened 4 years ago

Last modified 3 years ago

Compiler directive: warning_undeclared

Reported by: dagss Owned by: robertwb
Priority: major Milestone: 0.12.1
Component: Parsing Keywords:
Cc:

Description

A directive to warn/give error on any undeclared variables? I.e.:

@cython.warning_undeclared(True)
def foo():
    global g
    cdef object a
    cdef int b
    g = 3 # ok
    a = 3 # ok
    b = 3 # ok
    c = 3 # warns that "c" is not declared

error_undeclared should probably be available as well.

Implementation note:

In this specific case I think I'd tend to add a few lines in 
analyse_target_type (or whatever) in NameNode I think, without using a transform (where the directives in effect are available in 
env.directives or similar

Change History

Changed 4 years ago by robertwb

Ideally, this should be rolled into a directive like

@cython.warn(undeclared=True)

Changed 4 years ago by dagss

  • milestone changed from 0.12 to 0.12.1

Changed 3 years ago by robertwb

  • owner changed from somebody to robertwb

Depends on #479.

Changed 3 years ago by robertwb

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.