-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add the comment to link the specification #1680
base: master
Are you sure you want to change the base?
Changes from 2 commits
16bd534
cb32185
57027fc
0e406de
45a6446
d5181d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1751,7 +1751,9 @@ function reduceMain( | |
] | ||
} | ||
}, | ||
|
||
/** | ||
* Please refer to reduction of Program in stepper specification | ||
*/ | ||
Program( | ||
node: es.Program, | ||
context: Context, | ||
|
@@ -1974,7 +1976,9 @@ function reduceMain( | |
] | ||
} | ||
}, | ||
|
||
/** | ||
* Please refer to reduction of BlockStatement in stepper specification | ||
*/ | ||
BlockStatement( | ||
node: es.BlockStatement, | ||
context: Context, | ||
|
@@ -2194,7 +2198,10 @@ function reduceMain( | |
] | ||
} | ||
}, | ||
|
||
/** | ||
* Please refer to reduction of BlockExpression in stepper specification | ||
* This is related to function application | ||
*/ | ||
BlockExpression( | ||
node: BlockExpression, | ||
context: Context, | ||
|
@@ -3345,6 +3352,7 @@ export function getEvaluationSteps( | |
const steps: [es.Program, string[][], string][] = [] | ||
try { | ||
checkProgramForUndefinedVariables(program, context) | ||
//reading the step limit | ||
const limit = stepLimit === undefined ? 1000 : stepLimit % 2 === 0 ? stepLimit : stepLimit + 1 | ||
evaluateImports(program, context) | ||
// starts with substituting predefined constants | ||
|
@@ -3361,6 +3369,10 @@ export function getEvaluationSteps( | |
[], | ||
'Start of evaluation' | ||
] | ||
/** | ||
* push the content into frontend for showing contents in the | ||
* this comment may not be correct, please correct it if you find any mismatch in description | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment "this comment may not be correct" is quite strange. Are you referring to the one above: "push the content..."? |
||
steps.push([ | ||
reducedWithPath[0] as es.Program, | ||
reducedWithPath[2].length > 1 ? reducedWithPath[2].slice(1) : reducedWithPath[2], | ||
|
@@ -3372,13 +3384,18 @@ export function getEvaluationSteps( | |
// odd steps: program after reduction | ||
let i = 1 | ||
let limitExceeded = false | ||
/** | ||
* This is the start of actual reduction, calling reduceMain function in each iteration | ||
* cause the program get reduced by one step at one iteration | ||
*/ | ||
while (isStatementsReducible(reducedWithPath[0] as es.Program, context)) { | ||
//Should work on isReducibleStatement instead of checking body.length | ||
if (steps.length === limit) { | ||
steps[steps.length - 1] = [ast.program([]), [], 'Maximum number of steps exceeded'] | ||
limitExceeded = true | ||
break | ||
} | ||
//the program reduce by one step here | ||
reducedWithPath = reduceMain(reducedWithPath[0], context) | ||
steps.push([ | ||
reducedWithPath[0] as es.Program, | ||
|
@@ -3405,6 +3422,10 @@ export function getEvaluationSteps( | |
]) | ||
} | ||
} | ||
/** | ||
* Deprecated check for empty program | ||
* It can be deleted or kept as a reference for legacy code. | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the check is deprecated, please delete it. |
||
if (steps.length === 0) { | ||
steps.push([reducedWithPath[0] as es.Program, [], 'Nothing to evaluate']) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence is not complete: "in the" ...