Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ extend lang::rascal::\syntax::Rascal;
import List;
import Set;
//import Node;
import util::Memo;
import String;

data Keyword
Expand Down Expand Up @@ -89,7 +90,7 @@ data AType (str alabel = "")
| avalue()
;

@memo{expireAfter(minutes=5),maximumSize(1000)}
@memo={expireAfter(minutes=5),maximumSize(1000)}
AType overloadedAType(rel[loc, IdRole, AType] overloads){
if(all(<loc _, IdRole _, AType t> <- overloads, aadt(_, _, _) := t)){
str adtName = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import util::Reflective;
import util::FileSystem;
import lang::rascalcore::check::BasicRascalConfig;
import lang::rascalcore::check::LogicalLocations;
import util::Memo;

str makeFileName(str qualifiedModuleName, str extension = "rsc") {
str qnameSlashes = replaceAll(qualifiedModuleName, "::", "/");
Expand Down Expand Up @@ -101,7 +102,7 @@ int commonPrefix(list[str] rdir, list[str] rm){
}
return size(rm);
}
@memo{expireAfter(minutes=5),maximumSize(500)}
@memo={expireAfter(minutes=5),maximumSize(500)}
@synopsis{Find the module name corresponding to a given module location via its (src, tpl or logical) location}
str getRascalModuleName(loc moduleLoc, PathConfig pcfg){
modulePath = moduleLoc.path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import Map;
import Set;
import Relation;
import String;
import util::Memo;

str parserPackage = "org.rascalmpl.core.library.lang.rascalcore.grammar.tests.generated_parsers";

Expand Down Expand Up @@ -136,7 +137,7 @@ bool rascalMayOverload(set[loc] defs, map[loc, Define] defines){

set[IdRole] defBeforeUseRoles = {variableId(), moduleVariableId(), formalId(), keywordFormalId(), patternVariableId()};

@memo{expireAfter(minutes=5),maximumSize(1000)}
@memo={expireAfter(minutes=5),maximumSize(1000)}
Accept rascalIsAcceptableSimple(loc def, Use use, Solver s){
//println("rascalIsAcceptableSimple: *** <use.id> *** def=<def>, use=<use>");
Define d = s.getDefine(def);
Expand Down Expand Up @@ -577,7 +578,7 @@ loc rascalCreateLogicalLoc(Define def, str modelName, PathConfig pcfg){
return def.defined;
}

@memo{expireAfter(minutes=5),maximumSize(1000)}
@memo={expireAfter(minutes=5),maximumSize(1000)}
rel[str shortName, str longName] getRascalModuleNames(PathConfig pcfg){
longNames = {};
for(srcdir <- pcfg.srcs){
Expand Down
6 changes: 6 additions & 0 deletions src/org/rascalmpl/interpreter/result/NamedFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import io.usethesource.vallang.IConstructor;
import io.usethesource.vallang.IInteger;
import io.usethesource.vallang.ISet;
import io.usethesource.vallang.IString;
import io.usethesource.vallang.IValue;
import io.usethesource.vallang.type.Type;

Expand Down Expand Up @@ -73,6 +74,11 @@ public NamedFunction(AbstractAST ast, IEvaluator<Result<IValue>> eval, Type func
IValue memoTag = tags.get("memo");
if (memoTag != null) {
this.hasMemoization = true;
if (memoTag instanceof IString) {
if (!((IString)memoTag).getValue().isBlank()) {
eval.warning("Ignored memo configuration " + memoTag + ", in most cases `@memo={..}` is needed instead of `@memo{..}`", ((FunctionDeclaration)ast).getTags().getLocation());
}
}
if (!(memoTag instanceof ISet)) {
memoTag = vf.set(memoTag);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test bool memoCalledCorrectly2(set[value] x) {
test bool memoExpire() {
int callCount2 = 0;

@memo=maximumSize(10)
@memo={maximumSize(10)}
int call2(int i) {
callCount2 += 1;
return callCount2;
Expand Down
Loading