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

bugtracker at ...3416... bugtracker at ...3416...
Mon Jul 31 17:18:51 CEST 2017


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 at ...3675.....
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 at ...3675...../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)






More information about the User mailing list