-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e5b914
commit e15c3a7
Showing
13 changed files
with
122 additions
and
24 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
snap-compile/src/test/java/org/snapscript/compile/ScopeInheritanceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.snapscript.compile; | ||
|
||
import junit.framework.TestCase; | ||
|
||
public class ScopeInheritanceTest extends ScriptTestCase { | ||
|
||
private static final String SOURCE = | ||
"for(i in 0..2){\n"+ | ||
" fun(i);\n"+ | ||
"}\n"+ | ||
"\n"+ | ||
"func fun(i){\n"+ | ||
" println(i);\n"+ | ||
"}\n"; | ||
|
||
public void testInheritance() throws Exception { | ||
assertScriptCompiles(SOURCE); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 6 additions & 4 deletions
10
snap-core/src/main/java/org/snapscript/core/scope/index/Local.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.snapscript.tree; | ||
|
||
import static org.snapscript.core.ModifierType.*; | ||
|
||
import org.snapscript.core.Evaluation; | ||
import org.snapscript.core.constraint.Constraint; | ||
import org.snapscript.core.scope.Scope; | ||
import org.snapscript.core.variable.Value; | ||
import org.snapscript.tree.literal.TextLiteral; | ||
|
||
public class Global extends Declaration { | ||
|
||
public Global(TextLiteral identifier) { | ||
this(identifier, null, null); | ||
} | ||
|
||
public Global(TextLiteral identifier, Constraint constraint) { | ||
this(identifier, constraint, null); | ||
} | ||
|
||
public Global(TextLiteral identifier, Evaluation value) { | ||
this(identifier, null, value); | ||
} | ||
|
||
public Global(TextLiteral identifier, Constraint constraint, Evaluation value) { | ||
super(identifier, constraint, value); | ||
} | ||
|
||
public Value compile(Scope scope, int modifiers) throws Exception { | ||
return super.compile(scope, modifiers | STATIC.mask | PUBLIC.mask); | ||
} | ||
|
||
public Value declare(Scope scope, int modifiers) throws Exception { | ||
return super.declare(scope, modifiers | STATIC.mask | PUBLIC.mask); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters