bugGNU Octave - Bugs: bug #36217, New variables should be disallowed...

 
 

bug #36217: New variables should be disallowed in nested functions

Submitted by:  Max Brister <fisheater>
Submitted on:  Mon 16 Apr 2012 09:58:16 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sat 25 Aug 2012 11:04:33 PM UTC, comment #2:

Rebased and applied
http://hg.savannah.gnu.org/hgweb/octave/rev/44d6ffdf9479

Max Brister <fisheater>
Project Member
Wed 18 Apr 2012 03:53:24 AM UTC, comment #1:

I now have a patch. It was not quite as simple to fix as I had hoped (is it ever?). Anyways, the idea is
- Mark a symbol_tables as static_workspaces once parsing is complete
- If a symbol is added to a static_workspace, mark it as added_static
- Call symbol_table::force_varref to get around marking symbols with added_static (used for .varargin., ans, ect.)
- If a symbol marked as added_static is accessed as a variable by tree_indentifier::rvalue or tree_indentifier::lvalue error

This silliness exists because can't disallow adding new symbol_records to static workspaces because that would prevent users from calling new functions.

I have checked, and I see no new errors with this patch applied ontop of 14570:d07d96e53612.

(file #25674)

Max Brister <fisheater>
Project Member
Mon 16 Apr 2012 09:58:16 PM UTC, original submission:

Code like

This should error as it causes problems for variable scopes. This is consistent with how matlab handles the issue. I am currently working on a patch.

Max Brister <fisheater>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #25674:  static_workspace.patch added by fisheater (11KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by fisheater (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 25 Aug 2012 11:04:33 PM UTCfisheaterStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Wed 18 Apr 2012 03:53:24 AM UTCfisheaterAttached File-=>Added static_workspace.patch, #25674

    Back to the top


    Powered by Savane 3.1-cleanup1