Skip to content

Commit 2bf4852

Browse files
committed
Rename BReference -> BParamRef
1 parent ebbf449 commit 2bf4852

File tree

46 files changed

+310
-309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+310
-309
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"java.compile.nullAnalysis.mode": "automatic"
3+
}

src/cli/src/test/java/org/smoothbuild/cli/accept/traces/call_and_order/logs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@
4040
:vm:schedule:call:execute
4141
@ {t-project}/module.smooth:1 myfunc
4242
:vm:schedule:call
43-
:vm:schedule:reference
43+
:vm:schedule:paramRef
4444
:vm:inline
4545
@ {t-project}/module.smooth:1 myfunc
4646
:vm:schedule:call:execute
4747
@ {t-project}/module.smooth:2 apply
4848
@ {t-project}/module.smooth:1 myfunc
4949
:vm:schedule:order
50-
:vm:schedule:reference
51-
:vm:schedule:reference
50+
:vm:schedule:paramRef
51+
:vm:schedule:paramRef
5252
:vm:schedule:order
5353
:vm:evaluate:order
5454
@ {t-project}/module.smooth:1 myfunc

src/cli/src/test/java/org/smoothbuild/cli/accept/traces/deep_lambda/logs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
:vm:schedule:call:execute
4646
@ <empty trace>
4747
:vm:schedule:order
48-
:vm:schedule:reference
48+
:vm:schedule:paramRef
4949
:vm:evaluate:order
5050
@ {t-project}/module.smooth:2 ???
5151
:scheduler:join

src/cli/src/test/java/org/smoothbuild/cli/accept/traces/default_value/logs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
@ <empty trace>
3535
:vm:schedule:call:execute
3636
@ <empty trace>
37-
:vm:schedule:reference
37+
:vm:schedule:paramRef
3838
:vm:schedule:call
3939
:vm:inline
4040
@ <empty trace>

src/cli/src/test/java/org/smoothbuild/cli/accept/traces/lambda_and_constructor/logs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
:vm:schedule:call:execute
3636
@ <empty trace>
3737
:vm:schedule:call
38-
:vm:schedule:reference
38+
:vm:schedule:paramRef
3939
:vm:inline
4040
@ <empty trace>
4141
:vm:schedule:call:execute
@@ -48,9 +48,9 @@
4848
@ {t-project}/module.smooth:5 result:lambda~1
4949
@ {t-project}/module.smooth:4 apply
5050
:vm:schedule:combine
51-
:vm:schedule:reference
52-
:vm:schedule:reference
53-
:vm:schedule:reference
51+
:vm:schedule:paramRef
52+
:vm:schedule:paramRef
53+
:vm:schedule:paramRef
5454
:vm:evaluate:combine
5555
@ {t-project}/module.smooth:4 MyStruct
5656
@ {t-project}/module.smooth:5 result:lambda~1

src/cli/src/test/java/org/smoothbuild/cli/accept/traces/select/logs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
:vm:schedule:call:execute
3737
@ <empty trace>
3838
:vm:schedule:combine
39-
:vm:schedule:reference
39+
:vm:schedule:paramRef
4040
:vm:evaluate:combine
4141
@ {t-project}/module.smooth:4 MyStruct
4242
:vm:evaluate:select

src/compiler-backend/src/main/java/org/smoothbuild/compilerbackend/ChainingBytecodeFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import org.smoothbuild.virtualmachine.bytecode.expr.base.BLambdaRef;
2020
import org.smoothbuild.virtualmachine.bytecode.expr.base.BMethod;
2121
import org.smoothbuild.virtualmachine.bytecode.expr.base.BOrder;
22-
import org.smoothbuild.virtualmachine.bytecode.expr.base.BReference;
22+
import org.smoothbuild.virtualmachine.bytecode.expr.base.BParamRef;
2323
import org.smoothbuild.virtualmachine.bytecode.expr.base.BSelect;
2424
import org.smoothbuild.virtualmachine.bytecode.expr.base.BString;
2525
import org.smoothbuild.virtualmachine.bytecode.expr.base.BTuple;
@@ -98,9 +98,9 @@ public BTuple tuple(List<BValue> items) throws SbTranslatorException {
9898
return invokeTranslatingIOException(() -> bytecodeFactory.tuple(items));
9999
}
100100

101-
public BReference reference(BType evaluationType, BigInteger index) throws SbTranslatorException {
101+
public BParamRef paramRef(BType evaluationType, BigInteger index) throws SbTranslatorException {
102102
return invokeTranslatingIOException(
103-
() -> bytecodeFactory.reference(evaluationType, bytecodeFactory.int_(index)));
103+
() -> bytecodeFactory.paramRef(evaluationType, bytecodeFactory.int_(index)));
104104
}
105105

106106
public BLambdaRef lambdaRef(BLambdaType evaluationType, BValue value)

src/compiler-backend/src/main/java/org/smoothbuild/compilerbackend/SbTranslator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ private BExpr translateMonoReference(SMonoReference sMonoReference) throws SbTra
203203
if (itemS != null) {
204204
var evaluationType = typeTranslator.translate(itemS.type());
205205
var index = BigInteger.valueOf(lexicalEnvironment.indexOf(name));
206-
var bReference = bytecodeF.reference(evaluationType, index);
207-
return saveNalAndReturn(name.toString(), sMonoReference, bReference);
206+
var bParamRef = bytecodeF.paramRef(evaluationType, index);
207+
return saveNalAndReturn(name.toString(), sMonoReference, bParamRef);
208208
}
209209
}
210210
throw new SbTranslatorException(compileErrorMessage(
@@ -296,7 +296,7 @@ private BCombine referencesToAllArguments(BLambdaType lambdaType) throws SbTrans
296296
.params()
297297
.elements()
298298
.zipWithIndex()
299-
.map(t -> bytecodeF.reference(t.element1(), BigInteger.valueOf(t.element2())));
299+
.map(t -> bytecodeF.paramRef(t.element1(), BigInteger.valueOf(t.element2())));
300300
return bytecodeF.combine(argumentReferences);
301301
}
302302

@@ -311,7 +311,7 @@ private List<BExpr> createReferenceB(BTupleType sParamTypes) throws SbTranslator
311311
return sParamTypes
312312
.elements()
313313
.zipWithIndex()
314-
.map(tuple -> bytecodeF.reference(tuple.element1(), BigInteger.valueOf(tuple.element2())));
314+
.map(tuple -> bytecodeF.paramRef(tuple.element1(), BigInteger.valueOf(tuple.element2())));
315315
}
316316

317317
private BOrder translateOrder(SOrder sOrder) throws SbTranslatorException {

src/compiler-backend/src/test/java/org/smoothbuild/compilerbackend/SbTranslatorTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void mono_expression_function() throws Exception {
141141
void poly_expression_function() throws Exception {
142142
var sFunc = idSFunc();
143143
var sInstantiate = sInstantiate(sFunc, list(sIntType()));
144-
var bLambda = bLambda(bIntIntLambdaType(), bReference(bIntType(), 0));
144+
var bLambda = bLambda(bIntIntLambdaType(), bParamRef(bIntType(), 0));
145145
assertTranslation(bindings(sFunc), sInstantiate, bLambda);
146146
}
147147

@@ -157,9 +157,9 @@ void poly_expression_func_instantiated_with_type_param_of_enclosing_func_type_pa
157157
var sWrapFunc = sPoly(list(b), sFunc(b, "wrap", nlist(sItem(b, "p")), sBody));
158158
var sWrapMonoFunc = sInstantiate(sWrapFunc, list(sIntType()));
159159

160-
var bIdLambda = bLambda(bIntIntLambdaType(), bReference(bIntType(), 0));
160+
var bIdLambda = bLambda(bIntIntLambdaType(), bParamRef(bIntType(), 0));
161161
var bWrapLambda =
162-
bLambda(bIntIntLambdaType(), bCall(bIdLambda, bReference(bIntType(), 0)));
162+
bLambda(bIntIntLambdaType(), bCall(bIdLambda, bParamRef(bIntType(), 0)));
163163
assertTranslation(bindings(sIdFunc, sWrapFunc), sWrapMonoFunc, bWrapLambda);
164164
}
165165

@@ -176,7 +176,7 @@ void mono_native_function() throws Exception {
176176
bIntType(),
177177
bMethodTuple(jar, bString(classBinaryName)),
178178
bBool(true),
179-
bCombine(bReference(bBlobType(), 0)));
179+
bCombine(bParamRef(bBlobType(), 0)));
180180
var bLambda = bLambda(list(bBlobType()), bInvoke);
181181

182182
var fileContentReader = fileContentReaderMock(path.withExtension("jar"), jar);
@@ -198,7 +198,7 @@ void poly_native_function() throws Exception {
198198
bIntType(),
199199
bMethodTuple(jar, bString(classBinaryName)),
200200
bBool(true),
201-
bCombine(bReference(bIntType(), 0)));
201+
bCombine(bParamRef(bIntType(), 0)));
202202
var bLambda = bLambda(list(bIntType()), bInvoke);
203203

204204
var fileContentReader = fileContentReaderMock(path.withExtension("jar"), jar);
@@ -267,15 +267,15 @@ void string() throws Exception {
267267
@Test
268268
void lambda() throws Exception {
269269
var lambda = sLambda(nlist(sItem(sIntType(), "p")), sParamRef(sIntType(), "p"));
270-
assertTranslation(lambda, bLambda(list(bIntType()), bReference(bIntType(), 0)));
270+
assertTranslation(lambda, bLambda(list(bIntType()), bParamRef(bIntType(), 0)));
271271
}
272272

273273
@Test
274274
void lambda_referencing_param_of_enclosing_function() throws Exception {
275275
var sLambda = sLambda(sParamRef(sIntType(), "p"));
276276
var sFunc = sPoly(sFunc("myFunc", nlist(sItem(sIntType(), "p")), sLambda));
277277

278-
var bBody = bLambda(bReference(bIntType(), 0));
278+
var bBody = bLambda(bParamRef(bIntType(), 0));
279279
var bLambda = bLambda(bLambdaType(bIntType(), bIntLambdaType()), bBody);
280280

281281
assertTranslation(sFunc, bLambda);
@@ -287,7 +287,7 @@ void lambda_with_param_and_referencing_param_of_enclosing_function() throws Exce
287287
var sLambda = sLambda(nlist(sItem(sBlobType(), "b")), sParamRef(sIntType(), "i"));
288288
var sFunc = sPoly(sFunc("myFunc", nlist(sItem(sIntType(), "i")), sLambda));
289289

290-
var bBody = bLambda(list(bBlobType()), bReference(bIntType(), 1));
290+
var bBody = bLambda(list(bBlobType()), bParamRef(bIntType(), 1));
291291
var bLambda = bLambda(list(bIntType()), bBody);
292292

293293
assertTranslation(sFunc, bLambda);
@@ -333,7 +333,7 @@ void select() throws Exception {
333333
var sCall = sCall(sInstantiate(sConstructor), sString("abc"));
334334
var sSelect = sStructSelect(sCall, "field");
335335

336-
var bConstructor = bLambda(list(bStringType()), bCombine(bReference(bStringType(), 0)));
336+
var bConstructor = bLambda(list(bStringType()), bCombine(bParamRef(bStringType(), 0)));
337337
var bCall = bCall(bConstructor, bString("abc"));
338338
assertTranslation(bindings(sConstructor), sSelect, bSelect(bCall, bInt(0)));
339339
}
@@ -346,7 +346,7 @@ void instantiated_poly_expr_twice_with_outer_instantiation_actually_setting_its_
346346
var sFunc = sPoly(list(varA()), sFunc("myFunc", nlist(sItem(varA(), "a")), sLambda));
347347
var sInstantiate = sInstantiate(sFunc, list(sIntType()));
348348

349-
var bBody = bLambda(bReference(bIntType(), 0));
349+
var bBody = bLambda(bParamRef(bIntType(), 0));
350350
var bLambda = bLambda(bLambdaType(bIntType(), bIntLambdaType()), bBody);
351351

352352
assertTranslation(bindings(sFunc), sInstantiate, bLambda);

src/evaluator/src/test/java/org/smoothbuild/evaluator/EvaluatorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ void constructor() throws BytecodeException {
209209
var constructorS =
210210
sPoly(sConstructor(sStructType("MyStruct", nlist(sSig(sIntType(), "myField")))));
211211
assertEvaluation(
212-
constructorS, bLambda(list(bIntType()), bCombine(bReference(bIntType(), 0))));
212+
constructorS, bLambda(list(bIntType()), bCombine(bParamRef(bIntType(), 0))));
213213
}
214214
}
215215

@@ -238,7 +238,7 @@ void constructor() throws BytecodeException {
238238
sPoly(sConstructor(sStructType("MyStruct", nlist(sSig(sIntType(), "field"))))),
239239
bLambda(
240240
bLambdaType(bIntType(), bTupleType(bIntType())),
241-
bCombine(bReference(bIntType(), 0))));
241+
bCombine(bParamRef(bIntType(), 0))));
242242
}
243243
}
244244
}

0 commit comments

Comments
 (0)