Skip to content

Commit

Permalink
Fix for #2898:
Browse files Browse the repository at this point in the history
- Made the compiler less sensitive to errors in unused models.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@22798 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Oct 17, 2014
1 parent 5568f74 commit 4a763fb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
5 changes: 3 additions & 2 deletions Compiler/FrontEnd/NFEnvExtends.mo
Expand Up @@ -1216,7 +1216,7 @@ protected function updateClassExtends2
output SCode.Element outClass;
output Env outEnv;
algorithm
(outClass, outEnv) := match(inClass, inName, inMods, inInfo, inEnv)
(outClass, outEnv) := matchcontinue(inClass, inName, inMods, inInfo, inEnv)
local
SCode.Element ext;
Frame cls_frame;
Expand All @@ -1235,7 +1235,8 @@ algorithm
then
(cls, cls_frame :: env);

end match;
else (inClass, inEnv);
end matchcontinue;
end updateClassExtends2;

protected function lookupClassExtendsBaseClass
Expand Down
16 changes: 8 additions & 8 deletions Compiler/FrontEnd/NFSCodeCheck.mo
Expand Up @@ -114,14 +114,14 @@ algorithm
replaceablePrefix = SCode.REPLACEABLE(cc = _)))), _)
then ();

case (NFSCodeEnv.CLASS(cls = SCode.CLASS(name = name, prefixes = SCode.PREFIXES(
replaceablePrefix = SCode.NOT_REPLACEABLE()), info = info)), _)
equation
Error.addSourceMessage(Error.ERROR_FROM_HERE, {}, inOriginInfo);
Error.addSourceMessage(Error.NON_REPLACEABLE_CLASS_EXTENDS,
{name}, info);
then
fail();
//case (NFSCodeEnv.CLASS(cls = SCode.CLASS(name = name, prefixes = SCode.PREFIXES(
// replaceablePrefix = SCode.NOT_REPLACEABLE()), info = info)), _)
// equation
// Error.addSourceMessage(Error.ERROR_FROM_HERE, {}, inOriginInfo);
// Error.addSourceMessage(Error.NON_REPLACEABLE_CLASS_EXTENDS,
// {name}, info);
// then
// fail();
end match;
end checkClassExtendsReplaceability;

Expand Down
1 change: 1 addition & 0 deletions Compiler/FrontEnd/NFSCodeDependency.mo
Expand Up @@ -233,6 +233,7 @@ algorithm
Absyn.TPATH(path = type_path), modifications = mods, info = info)), _, _)
equation
(item, type_env) = lookupClass(type_path, inEnv, true, info, inErrorType);
true = NFSCodeEnv.isClassItem(item);
redeclares = NFSCodeFlattenRedeclare.extractRedeclaresFromModifier(mods);
(item, type_env, _) = NFSCodeFlattenRedeclare.replaceRedeclaredElementsInEnv(
redeclares, item, type_env, inEnv, NFInstPrefix.emptyPrefix);
Expand Down
10 changes: 1 addition & 9 deletions Compiler/FrontEnd/NFSCodeEnv.mo
Expand Up @@ -729,7 +729,6 @@ protected
Absyn.Info info;
algorithm
SCode.COMPONENT(name = var_name, typeSpec = ty, info = info) := inVar;
true := NFSCodeCheck.checkIdentNotEqTypeName(var_name, ty, info);
is_used := Util.makeStatefulBoolean(false);
outEnv := extendEnvWithItem(VAR(inVar, SOME(is_used)), inEnv, var_name);
end extendEnvWithVar;
Expand Down Expand Up @@ -808,7 +807,6 @@ algorithm
IMPORT_TABLE(hidden, qual_imps, unqual_imps), is_used) :: rest)
equation
imp = translateQualifiedImportToNamed(imp);
checkUniqueQualifiedImport(imp, qual_imps, info);
qual_imps = imp :: qual_imps;
then
FRAME(name, ty, tree, exts,
Expand Down Expand Up @@ -2017,13 +2015,7 @@ algorithm
Absyn.Info info;

// Don't allow replacing of nodes.
case (_, 0, _, _)
equation
info = getItemInfo(inValue);
Error.addSourceMessage(Error.DOUBLE_DECLARATION_OF_ELEMENTS,
{inKey}, info);
then
fail();
case (_, 0, _, _) then inAvlTree;

// Insert into right subtree.
case (AVLTREENODE(value = oval, height = h, left = left, right = right),
Expand Down

0 comments on commit 4a763fb

Please sign in to comment.