mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-11 03:02:19 +00:00
objjc now checks syntax of preprocessed code.
This commit is contained in:
1 parent
32fd299d1d
commit
cd2a66a644
2 files changed
+46
-7
No files matched your search
+15
-1
@@ -9,7 +9,7 @@ var STATIC_MAGIC_NUMBER = "@STATIC",
|
||||
|
||||
var STATIC_EXTENSION = "sj";
|
||||
|
||||
function objj_preprocess_file(aFilePath, fileContents)
|
||||
function objj_preprocess_file(aFilePath, fileContents, checkSyntax)
|
||||
{
|
||||
// Preprocess contents into fragments.
|
||||
var fragments = objj_preprocess(fileContents, { path:"/x" }, { path:aFilePath}),
|
||||
@@ -25,7 +25,21 @@ function objj_preprocess_file(aFilePath, fileContents)
|
||||
if (IS_FILE(fragment))
|
||||
preprocessed += (IS_LOCAL(fragment) ? MARKER_IMPORT_LOCAL : MARKER_IMPORT_STD) + ';' + GET_PATH(fragment).length + ';' + GET_PATH(fragment);
|
||||
else
|
||||
{
|
||||
if (checkSyntax)
|
||||
{
|
||||
try
|
||||
{
|
||||
new Function(GET_CODE(fragment));
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
e.fragment = fragment;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
preprocessed += MARKER_CODE + ';' + GET_CODE(fragment).length + ';' + GET_CODE(fragment);
|
||||
}
|
||||
}
|
||||
|
||||
return preprocessed;
|
||||
|
||||
Reference in new issue
Block a user