How to evaluate expression?

Hi,

I have two children nodes of expression type. The first node must contains link to variable of node<> type, the second node - string type. When in behaviour I tried to call "eval" method with "null" parameter it thorows an exception. What I do wrong?

Exception:

an error occurred while applying rule to node set: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at jetbrains.mps.smodel.behaviour.BehaviorManager._invokeInternal(BehaviorManager.java:289)
    at jetbrains.mps.smodel.behaviour.BehaviorManager.invoke(BehaviorManager.java:244)
    at jetbrains.mps.baseLanguage.behavior.Expression_Behavior.call_eval_1213877519769(Expression_Behavior.java:53)
    at ASN.behavior.ValidationMessage_Behavior.call_getMessage_2335512627511238296(ValidationMessage_Behavior.java:18)
    at ASN.typesystem.typeof_IValueAssignment_InferenceRule.applyRule(typeof_IValueAssignment_InferenceRule.java:42)
    at jetbrains.mps.typesystem.inference.NodeTypesComponent.applyRuleToNode(NodeTypesComponent.java:698)
    at jetbrains.mps.typesystem.inference.NodeTypesComponent.applyRulesToNode(NodeTypesComponent.java:609)
    at jetbrains.mps.typesystem.inference.NodeTypesComponent.computeTypesForNode(NodeTypesComponent.java:480)
    at jetbrains.mps.typesystem.inference.NodeTypesComponent.computeTypes(NodeTypesComponent.java:309)
    at jetbrains.mps.typesystem.inference.NodeTypesComponent.computeTypes(NodeTypesComponent.java:288)
    at jetbrains.mps.typesystem.inference.TypeChecker$3.run(TypeChecker.java:202)
    at jetbrains.mps.typesystem.inference.TypeChecker.checkWithinRoot(TypeChecker.java:210)
    at jetbrains.mps.typesystem.inference.TypeChecker.checkRoot(TypeChecker.java:196)
    at jetbrains.mps.typesystem.inference.TypeChecker.checkRoot(TypeChecker.java:178)
    at jetbrains.mps.typesystem.checking.TypesEditorChecker.createMessages(TypesEditorChecker.java:56)
    at jetbrains.mps.nodeEditor.Highlighter$7.run(Highlighter.java:370)
    at jetbrains.mps.smodel.ModelAccess$1.compute(ModelAccess.java:70)
    at jetbrains.mps.smodel.ModelAccess$3.compute(ModelAccess.java:90)
    at com.intellij.openapi.application.impl.ApplicationImpl$11.run(ApplicationImpl.java:711)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:681)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:709)
    at jetbrains.mps.smodel.ModelAccess.runReadAction(ModelAccess.java:86)
    at jetbrains.mps.smodel.ModelAccess.runReadAction(ModelAccess.java:68)
    at jetbrains.mps.nodeEditor.Highlighter.updateEditor(Highlighter.java:374)
    at jetbrains.mps.nodeEditor.Highlighter.access$500(Highlighter.java:45)
    at jetbrains.mps.nodeEditor.Highlighter$5.compute(Highlighter.java:326)
    at jetbrains.mps.nodeEditor.Highlighter$5.compute(Highlighter.java:292)
    at jetbrains.mps.nodeEditor.Highlighter.runUpdateMessagesAction(Highlighter.java:286)
    at jetbrains.mps.nodeEditor.Highlighter.updateEditorComponent(Highlighter.java:291)
    at jetbrains.mps.nodeEditor.Highlighter.doUpdate(Highlighter.java:233)
    at jetbrains.mps.nodeEditor.Highlighter$HighlighterThread.run(Highlighter.java:430)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at jetbrains.mps.smodel.behaviour.BehaviorManager._invokeInternal(BehaviorManager.java:285)
    ... 30 more
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at jetbrains.mps.smodel.behaviour.BehaviorManager._invokeInternal(BehaviorManager.java:289)
    at jetbrains.mps.smodel.behaviour.BehaviorManager.invoke(BehaviorManager.java:244)
    at jetbrains.mps.baseLanguage.behavior.Expression_Behavior.call_eval_1213877519769(Expression_Behavior.java:53)
    at jetbrains.mps.baseLanguage.behavior.PlusExpression_Behavior.virtual_eval_1213877519769(PlusExpression_Behavior.java:15)
    ... 35 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at jetbrains.mps.smodel.behaviour.BehaviorManager._invokeInternal(BehaviorManager.java:285)
    ... 38 more
Caused by: java.lang.UnsupportedOperationException:  LocalVariableReference <no name>[null] in typesModel@$runtimeTypes$
    at jetbrains.mps.baseLanguage.behavior.Expression_Behavior.virtual_eval_1213877519769(Expression_Behavior.java:25)
    ... 43 more

1 comment
Comment actions Permalink

Hello, Oleg,

This method is created to evaluate constant values so we can inline them. You have a variable reference, and that's why it doesn't work.

Regards,

Konstantin

0

Please sign in to leave a comment.