Comments (6)
Can you provide a simple test case?
from jsil.
Here is a sammpe.
static void TestNestedLambda()
{
var set1 = new int[] { 1, 2, 3 };
var set2 = new int[] { 2, 3, 5 };
var intersection = set1.Where(x => set2.Any(y => y == x));
}
The problem occurrs if you have nested lambda expressions (i.e. the innse lambda expresion references the variable from the outer one).
If you add the folowing block after the assigment to emitInLine:
if (methodMember.Method.IsIgnored && !emitInline) // matra774 https://github.com/kevingadd/JSIL/issues/37
{
Console.WriteLine("WARNING: {0} is ignored, but is not considered to be emmited inline. ", methodDot);
}
You will get the following warning when runing JSILC:
WARNING: <JSType 'TestHelloWorld.Program/<>c__DisplayClass2/<>c__DisplayClass4'>.<JSStringIdentifier 'prototype'>.<JSMethod '<TestNestedLambda>b__1'> is ignored, but is not considered to be emmited inline.
Here are some other sasamples from Mono's implementation of LINQ:
WARNING: <JSType 'System.Linq.Enumerable'>.<JSMethod '<ToLookup>b__bb`2'> is ignored, but is not considered to be emmited inline.
WARNING: <JSType 'System.Linq.Enumerable/PredicateOf`1<T>'>.<JSMethod 'cctor>b__c9'> is ignored, but is not considered to be emmited inline.
WARNING: <JSType 'System.Linq.Enumerable/Function`1<T>'>.<JSMethod 'cctor>b__cb'> is ignored, but is not considered to be emmitd inline.
from jsil.
All the issues demonstrated by your test case should be fixed in bf107bc.
from jsil.
I'm not positive it is fixed though as I'm seeing a related error.
Will continue to debug and hopefully provide another test case (oh, and a fix if I can figure it out)
from jsil.
Didn't come up with a test for this.. but what happened for me was that I had a method with identifier "<System.Collections.ICollection.CopyTo>b__0" (from mono's Dictionary) which was ignored (it is a delegate), but "compilerGenerated" became false so it went straight to the exception.
I've tested to always emit inline if method is ignored and it works so far. I haven't ran the unit tests using this though because I'm in my corlib setup and the unit tests doesn't compile.. Might continue on sunday.
from jsil.
Emitting if ignored sounds like a reasonable heuristic. I'll see if that breaks any tests.
from jsil.
Related Issues (20)
- DCE works incorrectly for derived interface implementation
- Content Not Being Generated XNA HOT 1
- Assembly.GetType is not working for generics.
- Unsigned comparisons work incorrect
- Type.FullName is not returning correct name for generic dictionary
- Async state machine incorrect translation HOT 6
- Calling External Library From C# HOT 2
- string.IndexOf(String value, StringComparison comparisonType) not available HOT 2
- Support netstandard assemblies
- ulong math is incorrect HOT 2
- Installing JSIL on Linux HOT 2
- Support pascalabc
- InvalidCastException when using Newtonsoft.Json.dll (10.0.1 .NET 4.0) HOT 1
- Delegate.Method fails when called in constructor. HOT 3
- C# 7.2 "in" keyword in interfaces
- DateTime Object does not implement public functions
- load file
- Attribute properties are missing HOT 1
- How to Convert a CSharp Project to JavaScript on a Mac? HOT 2
- where do I find the namespace and game?
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 jsil.