Skip to content

SyntaxError: Unexpected reserved word #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Bizarrus opened this issue Jul 14, 2018 · 1 comment
Open

SyntaxError: Unexpected reserved word #43

Bizarrus opened this issue Jul 14, 2018 · 1 comment

Comments

@Bizarrus
Copy link

I've tryed out these interpreter. An simple console.log will work - But when i try to use ES6 classes, i've got following Exception:

Noesis.Javascript.JavascriptException: SyntaxError: Unexpected reserved word

   bei Noesis.Javascript.CompileScript(Local<v8::Script>* , Char* source_code, Char* resource_name)
   bei Noesis.Javascript.JavascriptContext.Run(String iSourceCode)
   bei ReactSharp.Program.Main(String[] args) in c:\Users\info\Documents\SharpDevelop Projects\ReactSharp\ReactSharp\Program.cs:Zeile 48.

Program.cs

using System;
using System.IO;
using Noesis.Javascript;

namespace Sample {
	public class SystemConsole {
		public SystemConsole() {}

		public void log(string iString) {
			Console.WriteLine(iString);
			System.Diagnostics.Debug.WriteLine(iString);
		}
	}

	internal sealed class Program {
		[STAThread]
		private static void Main(string[] args) {
			System.Diagnostics.Debug.WriteLine("HI");
		
			using(JavascriptContext context = new JavascriptContext()) {
				context.SetParameter("console", new SystemConsole());
				
				// Read the "main.js"
				string contents = File.ReadAllText(@"main.js");
				
				// Run the script
				context.Run(contents);
			}
		}
	}
}

main.js

class Example {
	constructor() {
		console.log("Hello World, APP!");
	}
}
@oliverbock
Copy link
Contributor

You probably need to build from source to get a version that supports ES6 classes. Someone may provide more help if you specify which version of JavaScript.Net you are using, and cut the example down to work out which reserved word is the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants