Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/createContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,22 @@ export const importBuiltins = (context: Context, externalBuiltIns: CustomBuiltIn
defineSymbol(context, 'equal', list.equal)
}

if (context.chapter >= 3) {
defineSymbol(context, 'set_head', list.set_head)
defineSymbol(context, 'set_tail', list.set_tail)
defineSymbol(context, 'array_length', misc.array_length)
}

if (context.chapter >= Infinity) {
// previously week 4
defineSymbol(context, 'alert', alert)
defineSymbol(context, 'math_floor', Math.floor)
// tslint:disable-next-line:ban-types
defineSymbol(context, 'timed', (f: Function) => misc.timed(context, f, context.externalContext, externalBuiltIns.display))
// previously week 5
defineSymbol(context, 'assoc', list.assoc)
defineSymbol(context, 'draw', visualiseList)
// previously week 6
defineSymbol(context, 'is_number', misc.is_number)
// previously week 8
defineSymbol(context, 'undefined', undefined)
defineSymbol(context, 'set_head', list.set_head)
defineSymbol(context, 'set_tail', list.set_tail)
// previously week 9
defineSymbol(context, 'array_length', misc.array_length)
}
}

Expand Down
1 change: 1 addition & 0 deletions src/rules/noDeclareMutable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class NoDeclareMutableError implements SourceError {

const noDeclareMutable: Rule<es.VariableDeclaration> = {
name: 'no-declare-mutable',
disableOn: 3,

checkers: {
VariableDeclaration(node: es.VariableDeclaration) {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/noImplicitDeclareUndefined.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class NoImplicitDeclareUndefinedError implements SourceError {
A variable declaration assigns a value to a name.
For instance, to assign 20 to ${this.node.name}, you can write:

var ${this.node.name} = 20;
let ${this.node.name} = 20;

${this.node.name} + ${this.node.name}; // 40
`
Expand Down
2 changes: 1 addition & 1 deletion src/rules/noNonEmptyList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class NoNonEmptyListError implements SourceError {
const noNonEmptyList: Rule<es.ArrayExpression> = {
name: 'no-non-empty-list',

disableOn: 9,
disableOn: 3,

checkers: {
ArrayExpression(node: es.ArrayExpression) {
Expand Down
24 changes: 12 additions & 12 deletions src/syntaxTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ const syntaxTypes: { [nodeName: string]: number } = {
// Chapter 2
ArrayExpression: 2,

// Chapter 3
AssignmentExpression: 3,
ForStatement: 3,
WhileStatement: 3,
BreakStatement: 3,
ContinueStatement: 3,
ThisExpression: 3,
ObjectExpression: 3,
MemberExpression: 3,
Property: 3,
UpdateExpression: 3,

// Week 5
EmptyStatement: 5,
// preivously Week 8
AssignmentExpression: 8,
WhileStatement: 8,
// previously Week 9
ForStatement: 9,
BreakStatement: 9,
ContinueStatement: 9,
MemberExpression: 9,
// previously Week 10
ThisExpression: 10,
ObjectExpression: 10,
Property: 10,
UpdateExpression: 10,
NewExpression: 10,
// Disallowed Forever
SwitchStatement: Infinity,
Expand Down