Skip to content

Commit

Permalink
check null properties
Browse files Browse the repository at this point in the history
  • Loading branch information
yinwang0 committed Feb 4, 2014
1 parent 3ae9359 commit d3f9e21
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/main/java/org/yinwang/yin/ast/Call.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ public Call(Node func, Argument args, String file, int start, int end, int line,
public Value interp(Scope s) {
Value fun = this.func.interp(s);
if (fun instanceof Closure) {
Fun def = ((Closure) fun).fun;
Closure closure = (Closure) fun;
Scope funScope = new Scope(closure.env);
List<Name> params = closure.fun.params;

if (def.propertyForm != null) {
if (closure.properties != null) {
Declare.mergeProperties(closure.properties, funScope);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/yinwang/yin/ast/Fun.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public Fun(List<Name> params, Scope propertyForm, Node body, String file, int st

public Value interp(Scope s) {
// evaluate and cache the properties in the closure
Scope properties = Declare.evalProperties(propertyForm, s);
Scope properties = propertyForm == null ? null : Declare.evalProperties(propertyForm, s);
return new Closure(this, properties, s);
}

Expand Down

0 comments on commit d3f9e21

Please sign in to comment.