mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
Directly expose Acorn parser through PaperScript.parse(), and replace options.inline with options.source.
This commit is contained in:
parent
c36712758b
commit
2d702d0247
1 changed files with 5 additions and 4 deletions
|
@ -279,8 +279,9 @@ Base.exports.PaperScript = (function() {
|
|||
};
|
||||
// Include the original code in the sourceMap if there is no linked
|
||||
// source file so the debugger can still display it correctly.
|
||||
if (!url || options.inline)
|
||||
sourceMap.sourcesContent = [code];
|
||||
var source = options.source || !url && code;
|
||||
if (source)
|
||||
sourceMap.sourcesContent = [source];
|
||||
}
|
||||
// Now do the parsing magic
|
||||
walkAST(scope.acorn.parse(code, { ranges: true }));
|
||||
|
@ -462,7 +463,7 @@ Base.exports.PaperScript = (function() {
|
|||
compile: compile,
|
||||
execute: execute,
|
||||
load: load,
|
||||
acorn: scope.acorn
|
||||
parse: scope.acorn.parse
|
||||
};
|
||||
|
||||
/*#*/ } else { // !__options.environment == 'browser'
|
||||
|
@ -495,7 +496,7 @@ Base.exports.PaperScript = (function() {
|
|||
return {
|
||||
compile: compile,
|
||||
execute: execute,
|
||||
acorn: scope.acorn
|
||||
parse: scope.acorn.parse
|
||||
};
|
||||
|
||||
/*#*/ } // !__options.environment == 'browser'
|
||||
|
|
Loading…
Reference in a new issue