Comments (9)
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.
I do believe this is a real issue
from saltarellecompiler.
Turned out I was wrong. Switching on strings does work.
from saltarellecompiler.
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.
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.
And, contributions are of course welcome. Drop me an email and we can discuss it more.
from saltarellecompiler.
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.
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.
I just managed to reproduce and resolve the issue.
from saltarellecompiler.
Related Issues (20)
- [2.6.2] Canceled tasks should throw TaskCanceledException instead of InvalidOperationException HOT 3
- Status? HOT 1
- [2.6.2] Combining async, finally and IList/IEnumerable results in an incorrect execution workflow HOT 3
- Bridge.NET Acquires Saltarelle HOT 54
- Boolean XORs generate incorrect result HOT 1
- Non-serializable properties for serializable types HOT 1
- int.Parse() gets translated to parseInt(), which isn't precise HOT 4
- Bug in inheritance? HOT 3
- INTERNAL ERROR: ResolveResult ConversionResolveResult HOT 6
- Add support for InternalsVisibleTo attribute HOT 3
- [2.7.0] Asynchronous tasks swallow exceptions
- Minifier incorrectly minifies '+ ++' into '+++'
- When using [NamedValuesAttribute] on an enum, that enum's values are not compiled correctly when used as default parameters HOT 3
- If the data exict HOT 1
- Saltarelle.Runtime HOT 1
- Saltarelle rewrites Mixing expression $.expr[':'] to $["expr[':']"] HOT 1
- Provide toString override for Exception class, otherwise uncaught exceptions will end up logged as [object Object]
- ss_Int32.tryParse returns 0 when value can't be parsed (when input does not match regexp)
- Dictionary issue on Chrome HOT 3
- Saltarelle.Compiler 2.7.0 - INTERNAL ERROR: System.TypeLoadException
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from saltarellecompiler.