GithubHelp home page GithubHelp logo

Comments (9)

volkanceylan avatar volkanceylan commented on June 14, 2024

noticed that there is a problem with references, as project still uses a mix of scriptsharp mscorlib.dll and saltarelle dlls. please ignore this till i resolve issue myself.

from saltarellecompiler.

erik-kallen avatar erik-kallen commented on June 14, 2024

I do believe this is a real issue

from saltarellecompiler.

erik-kallen avatar erik-kallen commented on June 14, 2024

Turned out I was wrong. Switching on strings does work.

from saltarellecompiler.

volkanceylan avatar volkanceylan commented on June 14, 2024

Ok, now my project does build but case statements still don't work, so i had to comment them.

You are right, switching on strings does work, but if strings are set of constants defined in another class, it doesn't.

I have a class like this:

public static class FilterOp
{
    ...
    public const string EQ = "eq";
    public const string NE = "ne";
    ...
}

If i change case statement to use inline strings it works.

I'm trying to convert a big ScriptSharp project (about 5 MB of *.cs files) to your compiler. Had some issues but i could manage it to build with several changes / search replaces mostly.

I'll let you know about issues i encountered later, so maybe you can write them in your wiki, and it may help others.

Anyway, your project looks promising. I'd like to contribute.

from saltarellecompiler.

erik-kallen avatar erik-kallen commented on June 14, 2024

Can't reproduce this.


public static class FilterOp
{
    public const string EQ = "eq";
    public const string NE = "ne";
}
public class Driver {
    public int Main() {
        string s = null;
        switch (s) {
            case FilterOp.EQ: return 1;
            case FilterOp.NE: return 2;
        }
        return 0;
    }
}

generates

////////////////////////////////////////////////////////////////////////////////
// Driver
Driver = function() {
};
Driver.prototype = {
    main: function() {
        var s = null;
        switch (s) {
            case 'eq': {
                return 1;
            }
            case 'ne': {
                return 2;
            }
        }
        return 0;
    }
};
////////////////////////////////////////////////////////////////////////////////
// FilterOp
FilterOp = function() {
};
Driver.registerClass('Driver', Object);
FilterOp.registerClass('FilterOp', Object);
FilterOp.EQ = 'eq';
FilterOp.NE = 'ne';

Perhaps you need to update-package to get the latest version. For some reason, NuGet seems to install an old version when installing the compiler as a dependency.

from saltarellecompiler.

erik-kallen avatar erik-kallen commented on June 14, 2024

And, contributions are of course welcome. Drop me an email and we can discuss it more.

from saltarellecompiler.

volkanceylan avatar volkanceylan commented on June 14, 2024

Cloned your git repository but still getting similar error in switch statements.

Created an empty project for testing but this time got a Internal Compiler Error:

Can you please confirm this works with yours?

(If i decrease number of case statements i got no error)

using System;
using System.Text;
using System.Html;

namespace TestLibrary1
{
    public static class FilterOp
    {
        public const string IsTrue = "true";
        public const string IsFalse = "false";
        public const string Contains = "contains";
        public const string StartsWith = "startswith";
        public const string EQ = "eq";
        public const string NE = "ne";
        public const string GT = "gt";
        public const string GE = "ge";
        public const string LT = "lt";
        public const string LE = "le";
        public const string BW = "bw";
        public const string IN = "in";
        public const string IsNull = "isnull";
        public const string IsNotNull = "isnotnull";
    }

    public class TestClass
    {
        public static void Test(string testing)
        {
            switch (testing)
            {
                case FilterOp.BW:
                    Window.Alert("hello");
                    return;
                case FilterOp.GE:
                case FilterOp.GT:
                case FilterOp.LT:
                case FilterOp.LE:
                case FilterOp.EQ:
                case FilterOp.NE:
                    Window.Alert("hello");
                    return;
            }
        }
    }

}

In test project i got:

Error   7   Internal Compiler Error (0xc0000005 at address 61CBC3C9): likely culprit is 'CODEGEN'.

An internal error has occurred in the compiler. To work around this problem, try simplifying or changing the program near the locations listed below. Locations at the top of the list are closer to the point at which the internal error occurred. Errors such as this can be reported to Microsoft by using the /errorreport option.
    TestLibrary1

In my main project i still have:

Error   7   The best overloaded method match for `System.Collections.Generic.Dictionary<string,int>.Dictionary(System.Collections.Generic.JsDictionary<string,int>)' has some invalid arguments

Argument `#1' cannot convert `int' expression to type `System.Collections.Generic.JsDictionary<string,int>' 

from saltarellecompiler.

erik-kallen avatar erik-kallen commented on June 14, 2024

The first internal compiler error is due to the work-around you are using to get Visual Studio IntelliSense working, it's an internal error in csc.exe, not in Saltarelle. Most likely due to a missing member in my runtime lib.

from saltarellecompiler.

erik-kallen avatar erik-kallen commented on June 14, 2024

I just managed to reproduce and resolve the issue.

from saltarellecompiler.

Related Issues (20)

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.