mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
Fix PaperScript.parse() for use with load.js
This commit is contained in:
parent
735150d165
commit
87e72744ea
1 changed files with 7 additions and 3 deletions
|
@ -104,6 +104,10 @@ Base.exports.PaperScript = (function() {
|
|||
|
||||
// AST Helpers
|
||||
|
||||
function parse(code, options) {
|
||||
return scope.acorn.parse(code, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles PaperScript code into JavaScript code.
|
||||
*
|
||||
|
@ -286,7 +290,7 @@ Base.exports.PaperScript = (function() {
|
|||
sourceMap.sourcesContent = [source];
|
||||
}
|
||||
// Now do the parsing magic
|
||||
walkAST(scope.acorn.parse(code, { ranges: true }));
|
||||
walkAST(parse(code, { ranges: true }));
|
||||
|
||||
if (sourceMap) {
|
||||
// Adjust the line offset of the resulting code if required.
|
||||
|
@ -465,7 +469,7 @@ Base.exports.PaperScript = (function() {
|
|||
compile: compile,
|
||||
execute: execute,
|
||||
load: load,
|
||||
parse: scope.acorn.parse
|
||||
parse: parse
|
||||
};
|
||||
|
||||
/*#*/ } else { // !__options.environment == 'browser'
|
||||
|
@ -498,7 +502,7 @@ Base.exports.PaperScript = (function() {
|
|||
return {
|
||||
compile: compile,
|
||||
execute: execute,
|
||||
parse: scope.acorn.parse
|
||||
parse: parse
|
||||
};
|
||||
|
||||
/*#*/ } // !__options.environment == 'browser'
|
||||
|
|
Loading…
Reference in a new issue