fjgandrade / sharpkit

Automatically exported from code.google.com/p/sharpkit
0 stars 0 forks source link

Mixing multiple and single variable declarations compilation #331

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If you mix multiple and single variable declaration on a class it fails at 
compile time.

using SharpKit.JavaScript;
using SharpKit.Html;
using SharpKit.jQuery;

[assembly: JsType(JsMode.Clr, Filename = "res/Default.js")]

namespace SharpKitWebApp3
{

    public class Box
    {
        //Fails
        int a;
        int b, c;

        //Works
        /*int a;
        int b;
        int c;*/

        //Works
        //int a, b, c;

        public Box() { }
    }

}

The two variants, all single declaration and and all multiple declaration 
compile correctly.

This is using v5.2.8.

The full error is:

1>  Parallel=False
1>  14:15:05.091: SaveLastInputArgs: Start: 
1>  14:15:05.099: SaveLastInputArgs: End: 5ms
1>  C:\Windows\Microsoft.NET\Framework\v4.0.30319\SharpKit\5\skc5.exe 
/dir:"C:\dev\assorted\SharpKitWebApp3\SharpKitWebApp3" /define:TRACE;DEBUG 
/reference:"C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\.NETFramework\v4.0\Microsoft.CSharp.dll" 
/reference:"C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" 
/reference:"C:\Program Files 
(x86)\SharpKit\5\Assemblies\v4.0\SharpKit.Html.dll" /reference:"C:\Program 
Files (x86)\SharpKit\5\Assemblies\v4.0\SharpKit.JavaScript.dll" 
/reference:"C:\Program Files 
(x86)\SharpKit\5\Assemblies\v4.0\SharpKit.jQuery.dll" /reference:"C:\Program 
Files (x86)\Reference 
Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Configuration.dll" 
/reference:"C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" 
/reference:"C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Data.dll" 
/reference:"C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" 
/reference:"C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Drawing.dll" 
/reference:"C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.EnterpriseServices.dll"
 /reference:"C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.ApplicationServices
.dll" /reference:"C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.dll" 
/reference:"C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.Extensions.dll" 
/reference:"C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.Services.dll" 
/reference:"C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.dll" 
/reference:"C:\Program Files (x86)\Reference 
Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.Linq.dll" 
/out:obj\Debug\SharpKitWebApp3.dll /target:library Default.aspx.cs 
Default.aspx.designer.cs Properties\AssemblyInfo.cs DefaultClient.cs 
"C:\Users\a-cograv\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttribu
tes.cs" /contentfile:Default.aspx /contentfile:res\Default.js 
/contentfile:res\jquery-1.8.2.min.js /contentfile:Web.config 
/nonefile:Web.Debug.config /nonefile:Web.Release.config 
/TargetFrameworkVersion:v4.0
1>  14:15:05.100: ParseArgs: Start: 
1>  14:15:05.140: ParseArgs: End: 40ms
1>  14:15:05.141: CalculateMissingArgs: Start: 
1>  14:15:05.145: CalculateMissingArgs: End: 3ms
1>  14:15:05.146: CheckManifest: Start: 
1>  14:15:05.149: CheckManifest: End: 2ms
1>  14:15:05.149: VerifyNativeImage: Start: 
1>  14:15:05.149: VerifyNativeImage: End: 0ms
1>  14:15:05.149: CheckActivation: Start: 
1>  SharpKit 5 Professional Edition v5.2.1
1>  14:15:05.187: CheckActivation: End: 37ms
1>  14:15:05.187: LoadPlugins: Start: 
1>  14:15:05.189: LoadPlugins: End: 2ms
1>  14:15:05.189: ParseCs: Start: 
1>  14:15:05.716: 5 Sources files 510ms
1>  14:15:07.933: 17 References End: 1ms
1>  14:15:07.959: CreateCompilation 20ms
1>  14:15:07.960: ParseCs: End: 2771ms
1>  14:15:07.960: ApplyExternalMetadata: Start: 
1>  14:15:08.257: ApplyExternalMetadata: End: 296ms
1>  14:15:08.257: ConvertCsToJs: Start: 
1>  14:15:08.321: ApplyNavigator
1>  14:15:08.395: ApplyNavigator End:74
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>SKC : warning SK0000: Cannot resolve attribute constructor
1>C:\dev\assorted\SharpKitWebApp3\SharpKitWebApp3\DefaultClient.cs(24,9): error 
SK0000: Error while processing node 
[C:\dev\assorted\SharpKitWebApp3\SharpKitWebApp3\DefaultClient.cs]
1>  ICSharpCode.NRefactory.CSharp.CompilerException: Error while processing 
node ---> System.NullReferenceException: Object reference not set to an 
instance of an object.
1>     at SharpKit.Compiler.JsTypeImporter.GetCreateFieldInitializer(IField fe)
1>     at SharpKit.Compiler.JsTypeImporter.ExportInitializer(IMember 
fieldOrProperty, BlockStatement ccBlock, Boolean isGlobal, Boolean isNative)
1>     at 
SharpKit.Compiler.JsTypeImporter.<>c__DisplayClass21.<ExportConstructorBody>b__1
e(IMember fe)
1>     at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
1>     at System.Linq.Enumerable.<CastIterator>d__b1`1.MoveNext()
1>     at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
1>     at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
1>     at SharpKit.Compiler.JsTypeImporter.ExportConstructorBody(IMethod ctor)
1>     at SharpKit.Compiler.JsTypeImporter_Clr.ExportConstructor(IMethod ctor)
1>     at SharpKit.Compiler.JsTypeImporter.UnsafeVisit(IEntity me)
1>     at SharpKit.Compiler.JsTypeImporter.Visit(IEntity node)
1>     --- End of inner exception stack trace ---
1>     at SharpKit.Compiler.JsTypeImporter.Visit(IEntity node)
1>     at SharpKit.Compiler.JsModelImporter.ExportType(ITypeDefinition ce)
1>     at SharpKit.Compiler.JsModelImporter.ExportType(ITypeDefinition ce, 
JsFile jsFile)
1>     at System.Collections.Generic.List`1.ForEach(Action`1 action)
1>     at System.Linq.Extensions.ForEach[T](IEnumerable`1 items, Action`1 
action)
1>     at SharpKit.Compiler.JsModelImporter.Process()
1>     at SharpKit.Compiler.CompilerTool.ConvertCsToJs()
1>     at SharpKit.Compiler.CompilerTool.Time(Action action)
1>     at SharpKit.Compiler.CompilerTool.InternalRun()
1>  Total: 3615ms

Original issue reported on code.google.com by co...@gravill.com on 2 Dec 2013 at 2:20

GoogleCodeExporter commented 9 years ago

Original comment by DanelK...@gmail.com on 2 Dec 2013 at 6:03

GoogleCodeExporter commented 9 years ago
Thank you for the hint. In my tests, this never occur (i tested a lot of 
combinations). But i will check this today again.

Original comment by sebastia...@gmail.com on 3 Dec 2013 at 9:59

GoogleCodeExporter commented 9 years ago
It's quite particular, so if you flip the order to

        int b, c;
        int a;

then it builds for me.

Hope it helps.

Original comment by co...@gravill.com on 3 Dec 2013 at 10:09

GoogleCodeExporter commented 9 years ago
This error is now fixed, the fix will available in v5.2.9

Original comment by sebastia...@gmail.com on 3 Dec 2013 at 10:31

GoogleCodeExporter commented 9 years ago
Tested, seems to work great!

Original comment by DanelK...@gmail.com on 14 Dec 2013 at 12:51