Comparing version 1.0.13 to 1.0.14
@@ -49,3 +49,3 @@ 'use strict'; | ||
this.getOverVariables(paramsDecls, (variables, name, index) => { | ||
if (variables.type !== args[index].resType) throw new _error.JungleError('L\'argument ' + (index + 1) + ' de la routine routine ' + this.name + ' attend un ' + variables.type.name + ' mais un ' + args[index].resType.name + ' a été fourni à la place', args[index].location); | ||
if (!variables.type.isCompatibleWith(args[index].resType)) throw new _error.JungleError('L\'argument ' + (index + 1) + ' de la routine routine ' + this.name + ' attend un ' + variables.type.name + ' mais un ' + args[index].resType.name + ' a été fourni à la place', args[index].location); | ||
@@ -67,2 +67,4 @@ if (variables.assignable && !args[index].writable) throw new _error.JungleError('L\'argument ' + (index + 1) + ' de la routine ' + this.name + ' attend une expression ' + 'assignable pour un paramètre global', args[index].location); | ||
if (this.type && !this.returnValue) throw new _error.JungleError('retourne n\'a pas été appelé durant l\'exécution de la routine ' + this.name); | ||
const res = this.returnValue; | ||
@@ -69,0 +71,0 @@ this.returnValue = null; |
@@ -19,3 +19,7 @@ 'use strict'; | ||
} | ||
isCompatibleWith(type) { | ||
return this === type || type.name === '!nul'; | ||
} | ||
} | ||
exports.Pointer = Pointer; |
@@ -33,3 +33,7 @@ 'use strict'; | ||
} | ||
isCompatibleWith(type) { | ||
return this === type; | ||
} | ||
} | ||
exports.Type = Type; |
@@ -86,3 +86,3 @@ 'use strict'; | ||
this.registerRule('*/', this.lex_62, 'comment'); | ||
this.registerRule(new RegExp('.'), this.lex_63, 'comment'); | ||
this.registerRule(new RegExp('.|\\n'), this.lex_63, 'comment'); | ||
this.registerRule('\\n', this.lex_64, 'dbstring'); | ||
@@ -89,0 +89,0 @@ this.registerRule(new RegExp('\\\\([\\\\"])'), this.lex_65, 'dbstring'); |
@@ -46,3 +46,3 @@ import {Ast} from './base.js' | ||
this.getOverVariables(paramsDecls, (variables, name, index) => { | ||
if (variables.type !== args[index].resType) | ||
if (!variables.type.isCompatibleWith(args[index].resType)) | ||
throw new JungleError('L\'argument ' + (index + 1) + ' de la routine routine ' + this.name + ' attend un ' + | ||
@@ -72,2 +72,5 @@ variables.type.name + ' mais un ' + args[index].resType.name + ' a été fourni à la place', args[index].location) | ||
if (this.type && !this.returnValue) | ||
throw new JungleError('retourne n\'a pas été appelé durant l\'exécution de la routine ' + this.name) | ||
const res = this.returnValue | ||
@@ -74,0 +77,0 @@ this.returnValue = null |
@@ -12,2 +12,6 @@ import {Type} from './type.js' | ||
} | ||
isCompatibleWith(type) { | ||
return this === type || type.name === '!nul' | ||
} | ||
} |
@@ -26,2 +26,6 @@ import {Ast} from './base.js' | ||
} | ||
isCompatibleWith(type) { | ||
return this === type | ||
} | ||
} |
@@ -73,3 +73,3 @@ import * as ast from "./ast" | ||
this.registerRule('*/', this.lex_62, 'comment') | ||
this.registerRule(new RegExp('.'), this.lex_63, 'comment') | ||
this.registerRule(new RegExp('.|\\n'), this.lex_63, 'comment') | ||
this.registerRule('\\n', this.lex_64, 'dbstring') | ||
@@ -76,0 +76,0 @@ this.registerRule(new RegExp('\\\\([\\\\"])'), this.lex_65, 'dbstring') |
{ | ||
"name": "algo-lang", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"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
Sorry, the diff of this file is not supported yet
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
486166
6334