View Issue Details

IDProjectCategoryView StatusLast Update
0039000pas2jstranspilerpublic2021-06-14 05:50
ReporterChuck Norris Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionunable to reproduce 
Summary0039000: Self is not available in TIntegerHelper
DescriptionI added the method Inc to an TIntegerHelper and get at runtime that the variable Self is not available in this context.
Steps To ReproduceRun the attached project and you can see the error in the console.
TagsNo tags attached.
Fixed in Revision
Attached Files

Activities

Chuck Norris

2021-06-13 23:06

reporter  

Project1.dpr (418 bytes)   
´╗┐program Project1;

uses
  browserconsole;

type
  TIntegerHelper = record helper for Integer
  public
    function Inc: Integer;
  end;

{ TIntegerHelper }

function TIntegerHelper.Inc: Integer;
begin
  System.Inc(Self);
  Result := Self;
end;

var
  lBuffer: Integer;
begin
  lBuffer := 41;
  lBuffer.Inc;

  if lBuffer = 42 then
    Writeln('True')
  else
    Writeln('False');
end.
Project1.dpr (418 bytes)   
Project1.dproj (10,882 bytes)   
´╗┐<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <Base>True</Base>
        <AppType>Console</AppType>
        <Config Condition="'$(Config)'==''">Debug</Config>
        <FrameworkType>VCL</FrameworkType>
        <MainSource>Project1.dpr</MainSource>
        <Platform Condition="'$(Platform)'==''">Win32</Platform>
        <ProjectGuid>{47E1C173-5064-4475-A248-A42A0E3B79B3}</ProjectGuid>
        <ProjectVersion>18.8</ProjectVersion>
        <TargetedPlatforms>1</TargetedPlatforms>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
        <Base>true</Base>
    </PropertyGroup>
    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
        <Base_Win32>true</Base_Win32>
        <CfgParent>Base</CfgParent>
        <Base>true</Base>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
        <Cfg_1>true</Cfg_1>
        <CfgParent>Base</CfgParent>
        <Base>true</Base>
    </PropertyGroup>
    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
        <Cfg_1_Win32>true</Cfg_1_Win32>
        <CfgParent>Cfg_1</CfgParent>
        <Cfg_1>true</Cfg_1>
        <Base>true</Base>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
        <Cfg_2>true</Cfg_2>
        <CfgParent>Base</CfgParent>
        <Base>true</Base>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Base)'!=''">
        <SanitizedProjectName>Project1</SanitizedProjectName>
        <DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
        <DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
        <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
        <Icns_MainIcns>$(BDS)\bin\delphi_PROJECTICNS.icns</Icns_MainIcns>
        <Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
        <TMSWebHTMLFile>Project1.html</TMSWebHTMLFile>
        <TMSWebProject>2</TMSWebProject>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Base_Win32)'!=''">
        <BT_BuildType>Debug</BT_BuildType>
        <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
        <DCC_UsePackage>DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;DataSnapFireDAC;svnui;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;TMSWEBCorePkgLibDXE12;DBXOracleDriver;madSecurity_;inetdb;VirtualTreesDR;FmxTeeUI;emsedge;FireDACIBDriver;fmx;fmxdae;TP_LockBox3;fs26;FireDACDBXDriver;dbexpress;IndyCore;xdata;vclx;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;DataSnapConnectors;RemObjects_Indy_Rio;VCLRESTComponents;soapserver;TMSVCLUIPackPkgWizDXE12;TMSLoggingPkgFMXDXE12;gtPDFkitRioProP;SVObjekte;vclie;TMSVCLUIPackPkgDXE12;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;madKernel_;Abbrevia;frx26;FireDACCommonODBC;FireDACCommonDriver;ORM;DataSnapClient;fr26;inet;bindcompdbx;IndyIPCommon;RemObjects_Synapse_Rio;RTLObjekte;vcl;DBXSybaseASEDriver;IndyIPServer;sparkle;tmsbcl;IndySystem;FireDACDb2Driver;dsnapcon;madExcept_;IntraWebD;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;madBasic_;TeeDB;FireDAC;emshosting;gtPDF32Rio;madShell_;frxe26;FireDACSqliteDriver;FireDACPgDriver;FireDACASADriver;ipstudiowindataset;DBXOdbcDriver;FireDACTDataDriver;FMXTee;O408br;TMSVCLUIPackPkgXlsDXE12;soaprtl;DbxCommonDriver;RemObjects_WebBroker_Rio;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;emsserverresource;DbxClientDriver;madDisAsm_;DBXSybaseASADriver;iw15tmsxlsdxe12upd;CustomIPTransport;vcldsnap;KDVReiseKomponentenD;iw15tmsdxe12upd;iw15tmsgriddxe12upd;SynEditDR;PowerPDF;bindcomp;appanalytics;ipstudiowin;DBXInformixDriver;TMSVCLUIPackPkgExDXE12;TMSLoggingPkgVCLDXE12;IndyIPClient;TMSWEBCorePkgDXE12;bindcompvcl;TMSLoggingPkgCoreDXE12;TMSCryptoPkgDXE12;TeeUI;fc3000v6;dbxcds;VclSmp;adortl;FireDACODBCDriver;Intraweb_15_D10_3;AbbreviaVCL;DataSnapIndy10ServerTransport;aurelius;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;TMSCryptoPkgDEDXE12;O408_r;iw15tmsgriddedxe12upd;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
        <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
        <VerInfo_Locale>1033</VerInfo_Locale>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Cfg_1)'!=''">
        <DCC_DebugDCUs>true</DCC_DebugDCUs>
        <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
        <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
        <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
        <DCC_Optimize>false</DCC_Optimize>
        <DCC_RemoteDebug>true</DCC_RemoteDebug>
        <TMSWebDebugInfo>2</TMSWebDebugInfo>
        <TMSWebDefines>$(TMSWebDefines);DEBUG</TMSWebDefines>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
        <DCC_RemoteDebug>false</DCC_RemoteDebug>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Cfg_2)'!=''">
        <DCC_DebugInformation>0</DCC_DebugInformation>
        <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
        <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
        <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
        <TMSWebDefines>$(TMSWebDefines);RELEASE</TMSWebDefines>
        <TMSWebObfuscation>2</TMSWebObfuscation>
        <TMSWebOptimization>2</TMSWebOptimization>
    </PropertyGroup>
    <ItemGroup>
        <DelphiCompile Include="$(MainSource)">
            <MainSource>MainSource</MainSource>
        </DelphiCompile>
        <None Include="Project1.html"/>
        <BuildConfiguration Include="Base">
            <Key>Base</Key>
        </BuildConfiguration>
        <BuildConfiguration Include="Debug">
            <Key>Cfg_1</Key>
            <CfgParent>Base</CfgParent>
        </BuildConfiguration>
        <BuildConfiguration Include="Release">
            <Key>Cfg_2</Key>
            <CfgParent>Base</CfgParent>
        </BuildConfiguration>
    </ItemGroup>
    <ProjectExtensions>
        <Borland.Personality>Delphi.Personality.12</Borland.Personality>
        <Borland.ProjectType>Console</Borland.ProjectType>
        <BorlandProject>
            <Delphi.Personality>
                <Source>
                    <Source Name="MainSource">Project1.dpr</Source>
                </Source>
            </Delphi.Personality>
            <Deployment Version="3">
                <DeployFile LocalName="Project1.html" Configuration="Debug" Class="ProjectFile">
                    <Platform Name="Win32">
                        <RemoteDir>.\</RemoteDir>
                        <Overwrite>true</Overwrite>
                    </Platform>
                </DeployFile>
                <DeployFile LocalName="Win32\Debug\Project1.exe" Configuration="Debug" Class="ProjectOutput">
                    <Platform Name="Win32">
                        <RemoteName>Project1.exe</RemoteName>
                        <Overwrite>true</Overwrite>
                    </Platform>
                </DeployFile>
                <DeployClass Name="AdditionalDebugSymbols">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="DebugSymbols">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="DependencyFramework">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="DependencyModule">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                        <Extensions>.dll;.bpl</Extensions>
                    </Platform>
                </DeployClass>
                <DeployClass Required="true" Name="DependencyPackage">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                        <Extensions>.bpl</Extensions>
                    </Platform>
                </DeployClass>
                <DeployClass Name="File">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Required="true" Name="ProjectOutput">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="ProjectUWPManifest">
                    <Platform Name="Win32">
                        <Operation>1</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="UWP_DelphiLogo150">
                    <Platform Name="Win32">
                        <RemoteDir>Assets</RemoteDir>
                        <Operation>1</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="UWP_DelphiLogo44">
                    <Platform Name="Win32">
                        <RemoteDir>Assets</RemoteDir>
                        <Operation>1</Operation>
                    </Platform>
                </DeployClass>
                <ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
            </Deployment>
            <Platforms>
                <Platform value="Win32">True</Platform>
                <Platform value="Win64">False</Platform>
            </Platforms>
        </BorlandProject>
        <ProjectFileVersion>12</ProjectFileVersion>
    </ProjectExtensions>
    <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
    <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
    <Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
</Project>
Project1.dproj (10,882 bytes)   
Project1.html (622 bytes)   
´╗┐<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta $(ThemeColor)>
    <noscript>Your browser does not support JavaScript!</noscript>
    <link rel="icon" href="data:;base64,=">
    <meta $(Manifest)>
    <title>TMS Web Project</title>
    <script type="text/javascript" src="$(ProjectName).js"></script>
    <style>
    </style>
  </head>
  <body>
<meta $(BodyParameters)>
  </body>
  <script type="text/javascript">
    rtl.run();
  </script>
</html>
Project1.html (622 bytes)   

jamie philbrook

2021-06-14 01:15

reporter   ~0131297

is there really any advantage to that ?

There is the intrinsic "Inc(YourInteger)"

btw, you do have += operator that you can use...
  MyInteger +=1;

Oh well, I suppose this is about the JS side of it.

Michael Van Canneyt

2021-06-14 05:48

administrator   ~0131299

Last edited: 2021-06-14 05:50

View 2 revisions

pas2js -Tbrowser p.pp
Info: 28141 lines in 12 files compiled, 0.4 secs

Works fine here.

If you look in the sysutils unit, you'll see e.g.
 
Function TIntegerHelper.SetBit(const index: TIntegerBitIndex) : Integer; inline;

begin
  Self := Self or (Integer(1) shl index);
  Result:=Self;
end;

Issue History

Date Modified Username Field Change
2021-06-13 23:06 Chuck Norris New Issue
2021-06-13 23:06 Chuck Norris File Added: Project1.dpr
2021-06-13 23:06 Chuck Norris File Added: Project1.dproj
2021-06-13 23:06 Chuck Norris File Added: Project1.html
2021-06-14 01:15 jamie philbrook Note Added: 0131297
2021-06-14 05:48 Michael Van Canneyt Assigned To => Michael Van Canneyt
2021-06-14 05:48 Michael Van Canneyt Status new => resolved
2021-06-14 05:48 Michael Van Canneyt Resolution open => unable to reproduce
2021-06-14 05:48 Michael Van Canneyt Note Added: 0131299
2021-06-14 05:50 Michael Van Canneyt Note Edited: 0131299 View Revisions