Skip to content

SyntaxError: Unexpected reserved word #43

Description

@Bizarrus

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!");
	}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions