seed r62 - in trunk: . libseed
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r62 - in trunk: . libseed
- Date: Sun, 2 Nov 2008 23:00:25 +0000 (UTC)
Author: racarr
Date: Sun Nov 2 23:00:24 2008
New Revision: 62
URL: http://svn.gnome.org/viewvc/seed?rev=62&view=rev
Log:
Syntax exceptions only get printed once now. Proper file and line number
for syntax fail. Add Seed.syntax_check, checks syntax of script,
propogates exception.
Modified:
trunk/libseed/seed-builtins.c
trunk/libseed/seed-engine.c
trunk/main.c
Modified: trunk/libseed/seed-builtins.c
==============================================================================
--- trunk/libseed/seed-builtins.c (original)
+++ trunk/libseed/seed-builtins.c Sun Nov 2 23:00:24 2008
@@ -140,6 +140,24 @@
return seed_gobject_get_prototype_for_gtype(type);
}
+JSValueRef
+seed_check_syntax(JSContextRef ctx,
+ JSObjectRef function,
+ JSObjectRef this_object,
+ size_t argumentCount,
+ const JSValueRef arguments[],
+ JSValueRef * exception)
+{
+ if (argumentCount != 0)
+ {
+ JSStringRef jsstr = JSValueToStringCopy(eng->context, arguments[0], exception);
+ JSCheckScriptSyntax(ctx, jsstr, 0, 0, exception);
+ if (jsstr)
+ JSStringRelease(jsstr);
+ }
+ return JSValueMakeNull(eng->context);
+}
+
void seed_init_builtins(int * argc, char *** argv)
{
int i;
@@ -151,6 +169,7 @@
seed_create_function("print", &seed_print, obj);
seed_create_function("readline", &seed_readline, obj);
seed_create_function("prototype", &seed_prototype, obj);
+ seed_create_function("check_syntax", &seed_check_syntax, obj);
arrayObj = JSObjectMake(eng->context, NULL, NULL);
Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c (original)
+++ trunk/libseed/seed-engine.c Sun Nov 2 23:00:24 2008
@@ -877,8 +877,6 @@
SeedScript * ret = g_new0(SeedScript, 1);
ret->script = JSStringCreateWithUTF8CString(js);
- JSCheckScriptSyntax(eng->context, ret->script,
- 0, 0, &ret->exception);
if (source_url)
{
@@ -886,6 +884,10 @@
}
ret->line_number = line_number;
+ JSCheckScriptSyntax(eng->context, ret->script,
+ ret->source_url, ret->line_number, &ret->exception);
+
+
return ret;
}
Modified: trunk/main.c
==============================================================================
--- trunk/main.c (original)
+++ trunk/main.c Sun Nov 2 23:00:24 2008
@@ -54,11 +54,14 @@
}
script = seed_make_script(buffer, argv[1], 1);
if (e =seed_script_exception(script))
+ {
g_critical("%s. %s in %s at line %d",
seed_exception_get_name(e),
seed_exception_get_message(e),
seed_exception_get_file(e),
seed_exception_get_line(e));
+ exit(1);
+ }
seed_evaluate(script, 0);
if (e = seed_script_exception(script))
g_critical("%s. %s in %s at line %d",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]