[Gambas Bug Tracker] Bug #1131: Nested WITHs : Cannot use the WITH variable shortcut in child WITH's expression

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Gambas Bug Tracker] Bug #1131: Nested WITHs : Cannot use the WITH variable shortcut in child WITH's expression

bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.1131&from=L21haW4-

Adrien PROKOPOWICZ reported a new bug.

Summary
-------

Nested WITHs : Cannot use the WITH variable shortcut in child WITH's expression

Type             : Bug
Priority         : Medium
Gambas version   : 3.9.90 (TRUNK)
Product          : Language


Description
-----------

In less confused terms, it means the following construct will not work at runtime :

  With obj
    .A = 69
    With .T2
      .B = 42
    End With
  End With

It fails at the second With's declaration with the error : "#12: Not an object", although the expression "obj.T2.B = 42" alone is valid and works well.

You can see the full code running here :
https://gambas-playground.proko.eu/?gist=7404d762b30f40b129f8f6faa8fbe19e

In the example the construct in the TestYes() function works, but the TestNo() fails with the above error.

I also looked at the compiled code generated by the compiler (see attached), and it seems that the bad function tries to load the variable's value from a different stack location (see line 9), which could explain why the interpreter finds a bad value.
(This is pure speculation since I know close to nothing about the Gambas bytecode, but I thought it might help)


System information
------------------

[System]
Gambas=3.10.90 git 4304011b0
OperatingSystem=Linux
Kernel=4.12.3-1-ARCH
Architecture=x86_64
Distribution=Arch Linux
Desktop=KDE5
Theme=Breeze
Language=fr_FR.UTF-8
Memory=15965M

[Libraries]
Cairo=libcairo.so.2.11400.10
Curl=libcurl.so.4.0.0
Curl=libcurl.so.4.1.0
Curl=libcurl.so.4.2.0
Curl=libcurl.so.4.3.0
Curl=libcurl.so.4.4.0
DBus=libdbus-1.so.3.14.11
GStreamer=libgstreamer-0.10.so.0.30.0
GStreamer=libgstreamer-1.0.so.0.1202.0
GTK+2=libgtk-x11-2.0.so.0.2400.31
GTK+3=libgtk-3.so.0.2200.17
OpenGL=libGL.so.1.0.0
Poppler=libpoppler.so.67.0.0
QT4=libQtCore.so.4.8.7
QT5=libQt5Core.so.5.9.1
SDL=libSDL-1.2.so.0.11.4
SQLite=libsqlite3.so.0.8.6

[Environment]
ANT_HOME=/usr/share/apache-ant
COGL_ATLAS_DEFAULT_BLIT_MODE=framebuffer
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DESKTOP_SESSION=/usr/share/xsessions/plasma
DISPLAY=:0
GB_GUI=gb.qt5
GEM_HOME=<home>/.rvm/gems/ruby-2.3.3
GEM_PATH=<home>/.rvm/gems/ruby-2.3.3:<home>/.rvm/gems/ruby-2.3.3@global
GRADLE_HOME=/usr/share/java/gradle
GS_LIB=<home>/.fonts
GTK_MODULES=canberra-gtk-module
HOME=<home>
IRBRC=<home>/.rvm/rubies/ruby-2.3.3/.irbrc
KDE_FULL_SESSION=true
KDE_SESSION_UID=1000
KDE_SESSION_VERSION=5
LANG=fr_FR.UTF-8
LANGUAGE=
LOGNAME=<user>
MAIL=/var/spool/mail/<user>
MAVEN_OPTS=-Xmx512m
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
MY_RUBY_HOME=<home>/.rvm/rubies/ruby-2.3.3
OLDPWD=<home>
PATH=<home>/.rvm/gems/ruby-2.3.3/bin:<home>/.rvm/gems/ruby-2.3.3@global/bin:<home>/.rvm/rubies/ruby-2.3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:<home>/.rvm/bin
PT5HOME=/opt/pt
PWD=<home>
QSG_RENDER_LOOP=
QT_AUTO_SCREEN_SCALE_FACTOR=0
QT_NO_GLIB=1
QT_QUICK_CONTROLS_STYLE=org.kde.desktop
RUBY_VERSION=ruby-2.3.3
SESSION_MANAGER=local/<hostname>:@/tmp/.ICE-unix/623,unix/<hostname>:/tmp/.ICE-unix/623
SHELL=/usr/bin/zsh
SHLVL=1
TZ=:/etc/localtime
USER=<user>
XAUTHORITY=<home>/.Xauthority
XCURSOR_SIZE=0
XCURSOR_THEME=breeze_cursors
XDG_CURRENT_DESKTOP=KDE
XDG_DATA_DIRS=/usr/share:/usr/share:/usr/local/share
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=KDE
XDG_SESSION_ID=c2
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
XDG_SESSION_TYPE=x11
XDG_VTNR=1
_=/usr/bin/kwrapper5
__GL_SYNC_TO_VBLANK=1
_system_arch=x86_64
_system_name=Arch
_system_type=Linux
_system_version=libc-2.25
rvm_bin_path=<home>/.rvm/bin
rvm_path=<home>/.rvm
rvm_prefix=<home>
rvm_version=1.27.0 (latest)



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Gambas Bug Tracker] Bug #1131: Nested WITHs : Cannot use the WITH variable shortcut in child WITH's expression

bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.1131&from=L21haW4-

Adrien PROKOPOWICZ added an attachment:

gbc.out



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Gambas Bug Tracker] Bug #1131: Nested WITHs : Cannot use the WITH variable shortcut in child WITH's expression

bugtracker
In reply to this post by bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.1131&from=L21haW4-

Comment #1 by Adrien PROKOPOWICZ:

I've actually found a fix to evaluate the expression before entering the WITH block.
But since I'm not confident enough with the compiler's internals to commit it directly, I put it in a separate temporary branch on the git repository.
The merge request can be found here : https://gitlab.com/prokopyl/gambas/merge_requests/1/diffs



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Loading...