Comparing version 1.0.6 to 1.0.7
@@ -168,2 +168,19 @@ 'use strict'; | ||
// Add values in scopes | ||
visitAlgoDecls(decls) { | ||
if (decls.consts.length) this.array(decls.consts); | ||
if (decls.types.length) { | ||
const prevMode = this.typeMode; | ||
this.typeMode = 'register'; | ||
this.array(decls.types); | ||
this.typeMode = 'check'; | ||
this.array(decls.types); | ||
this.typeMode = prevMode; | ||
} | ||
if (decls.variables.length) this.array(decls.variables); | ||
if (decls.routines && decls.routines.length) this.array(decls.routines); | ||
} | ||
visitConst(c) { | ||
@@ -174,2 +191,6 @@ c.type = this.scopes.getType(c.value.type); | ||
visitArray(array) { | ||
if (this.typeMode === 'check') { | ||
array.type = this.scopes.getType(array.type); | ||
return; | ||
} | ||
array.dimensions = array.dimensions.map(dimension => { | ||
@@ -185,9 +206,12 @@ if (!isNaN(+dimension)) return dimension; | ||
this.scopes.addType(array); | ||
array.type = this.scopes.getType(array.type); | ||
} | ||
visitEnum(e) { | ||
if (this.typeMode === 'check') return; | ||
this.scopes.addType(e); | ||
} | ||
visitRecord(record) { | ||
this.scopes.addType(record); | ||
if (this.typeMode === 'register') { | ||
this.scopes.addType(record); | ||
return; | ||
} | ||
this.scopes.pushScope(); | ||
@@ -198,3 +222,6 @@ super.visitRecord(record); | ||
visitPointer(pointer) { | ||
pointer.pointOn = this.scopes.getType(pointer.pointOn); | ||
if (this.typeMode === 'check') { | ||
pointer.pointOn = this.scopes.getType(pointer.pointOn); | ||
return; | ||
} | ||
this.scopes.addType(pointer); | ||
@@ -201,0 +228,0 @@ } |
@@ -164,2 +164,22 @@ import {EmptyVisitor} from './empty.js' | ||
// Add values in scopes | ||
visitAlgoDecls(decls) { | ||
if (decls.consts.length) | ||
this.array(decls.consts) | ||
if (decls.types.length) { | ||
const prevMode = this.typeMode | ||
this.typeMode = 'register' | ||
this.array(decls.types) | ||
this.typeMode = 'check' | ||
this.array(decls.types) | ||
this.typeMode = prevMode | ||
} | ||
if (decls.variables.length) | ||
this.array(decls.variables) | ||
if (decls.routines && decls.routines.length) | ||
this.array(decls.routines) | ||
} | ||
visitConst(c) { | ||
@@ -170,2 +190,6 @@ c.type = this.scopes.getType(c.value.type) | ||
visitArray(array) { | ||
if (this.typeMode === 'check') { | ||
array.type = this.scopes.getType(array.type) | ||
return | ||
} | ||
array.dimensions = array.dimensions.map(dimension => { | ||
@@ -183,9 +207,13 @@ if (!isNaN(+dimension)) | ||
this.scopes.addType(array) | ||
array.type = this.scopes.getType(array.type) | ||
} | ||
visitEnum(e) { | ||
if (this.typeMode === 'check') | ||
return | ||
this.scopes.addType(e) | ||
} | ||
visitRecord(record) { | ||
this.scopes.addType(record) | ||
if (this.typeMode === 'register') { | ||
this.scopes.addType(record) | ||
return | ||
} | ||
this.scopes.pushScope() | ||
@@ -196,3 +224,6 @@ super.visitRecord(record) | ||
visitPointer(pointer) { | ||
pointer.pointOn = this.scopes.getType(pointer.pointOn) | ||
if (this.typeMode === 'check') { | ||
pointer.pointOn = this.scopes.getType(pointer.pointOn) | ||
return | ||
} | ||
this.scopes.addType(pointer) | ||
@@ -199,0 +230,0 @@ } |
{ | ||
"name": "algo-lang", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Algorithmic language interpreter (in French only for now)", | ||
@@ -5,0 +5,0 @@ "homepage": "https://bitbucket.org/lsystems/algo-lang/overview", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
493207
6313