Giter Club home page Giter Club logo

aspa_cscc's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

jhiswin

aspa_cscc's Issues

Type coercion in addition

VBScript:
"0" + "1" = 1
"0" + 1 = 1
"0" & 1 = "01"

Solution:
Implement add(a,b), concat(a,b) and change emitted code to use function calls instead of operators.

function return type errors

Will error out with cannot cast to integer for function returns.
Reverting commit b6591c3 fixes this.

Function returns should not be initialized, because by default nothing is returned if the function does not set a return value.

Support emitting of javascript <script -tags again.

<title>IDIIL SelfStudy-Center Setting</title> <SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript> </SCRIPT> <SCRIPT LANGUAGE=javascript FOR=IDIILSS_SystemSetting EVENT=FunQuit> </SCRIPT>

Those get stripped totaly, which is not desired.

parsing error when '&' is next to an 'o' or 'O'

<script language=vbscript>
                sHtml=sHtml&"<td width='10%'>"&objNode.selectSingleNode("SpendTime").text&"</td></tr>"
</script>

Error: unexpected char: 'b'

Adding spaces between the "&"s is a workaround.

Unexpected AST node error (Unknown object members in For Loops)

Some files throw an AST node error, unknown AST node

ERROR AspParser - Failed to produce code from vb : 

<AST>:0:0: unexpected AST node: ubound
    at gr.omadak.leviathan.asp.VbsJsGenerator.expression(VbsJsGenerator.java:1325)
    at gr.omadak.leviathan.asp.VbsJsGenerator.expression(VbsJsGenerator.java:989)
    at gr.omadak.leviathan.asp.VbsJsGenerator.expr(VbsJsGenerator.java:822)
    at gr.omadak.leviathan.asp.VbsJsGenerator.nested(VbsJsGenerator.java:710)
    at gr.omadak.leviathan.asp.VbsJsGenerator.statement(VbsJsGenerator.java:187)
    at gr.omadak.leviathan.asp.VbsJsGenerator.statements(VbsJsGenerator.java:103)
    at gr.omadak.leviathan.asp.VbsJsGenerator.function(VbsJsGenerator.java:515)
    at gr.omadak.leviathan.asp.VbsJsGenerator.nested(VbsJsGenerator.java:633)
    at gr.omadak.leviathan.asp.VbsJsGenerator.statement(VbsJsGenerator.java:187)
    at gr.omadak.leviathan.asp.VbsJsGenerator.statements(VbsJsGenerator.java:103)
    at gr.omadak.leviathan.asp.VbsJsGenerator.generate(VbsJsGenerator.java:60)
    at gr.omadak.leviathan.asp.AspParser.produceCode(AspParser.java:424)
    at gr.omadak.leviathan.asp.AspParser.parseFile(AspParser.java:378)
    at gr.omadak.leviathan.asp.AspParser.parseFile(AspParser.java:493)
    at gr.omadak.leviathan.asp.AspParser.parseDir(AspParser.java:568)
    at gr.omadak.leviathan.asp.AspParser.main(AspParser.java:666)

Function parameters modified by reference

Sub subroutine(param)
param = 3
end sub

Emitting a JS comment (and/or a debugger breakpoint) when parameters are set would make the conversion process easier:

function subroutine(param) {
param = 3; debugger; //PARAMETER MODIFIED BY REFERENCE
}

Ideally this would be handled automatically, but that would be non-trivial, and in some cases may behave differently than intended or introduce performance penalties.

Handle unassigned variables with object and function wrappers for operations and types

Issue Overview:
So far, definite assignment analysis (useBeforeInit) has issues that make it impractical and it isn't completely reliable.

So, implementing add(a,b), minus(a,b), concat(a,b) and compareTo(a,b), and etc seems to be the only automated solution.
This can also benefit by fixing problems with primitive type coercion, which is different in VBScript and Javascript.
eg: 0 + "1" is 1 in VBScript

Performance and Work time:
Overhead should not be too much of an issue in modern browsers, and after using Closure Compiler (which can inline many of these calls with type analysis in Rhino).
Functions should be trivial, and only needs to check for typeof === "undefined", and replace with corresponding value. Undefined wrapper may not even be necessary.
This can also be used to fix issue #26

VBScript Behavior:
Undefined variable behavior in VBScript:
undefined == 0
undefined == ""
10 + undefined == 10
"" + undefined == ""
undefined - 10 == -10
undefined is nothing

Solution:
Translate
a + b to add(a,b)
if a = b then to if(compareTo(a,b))
a & b to concat(a,b)
Use typeof a === "undefined" to handle behavior.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.