@@ -563,7 +563,7 @@ macrodef
563
563
}
564
564
: ^ (t= OP_MACRO n= unbound_identifier[ " macro" ] a= arguments {
565
565
symbol = sc.createMacro(find(n), n.getText(), a.first, a.second);
566
- } s= semantic[ env, sc.pcode, $t, false , true ] ) {
566
+ } s= semantic[ env, null, sc.pcode, $t, false , true ] ) {
567
567
if (symbol != null) {
568
568
sc.buildMacro(symbol, $macrodef:: macrobody);
569
569
}
@@ -612,13 +612,13 @@ constructorlikelist
612
612
;
613
613
614
614
constructor
615
- : ^ (OP_CONSTRUCTOR c= ctorstart e= bitpattern b= contextblock r= ctorsemantic) {
615
+ : ^ (OP_CONSTRUCTOR c= ctorstart e= bitpattern b= contextblock r= ctorsemantic[ c ] ) {
616
616
sc.buildConstructor(c, e, b, r);
617
617
}
618
618
;
619
619
620
- ctorsemantic returns [ SectionVector value]
621
- : ^ (t= OP_PCODE p= semantic[ env, sc.pcode, $t, true , false ] ) { $value = p; }
620
+ ctorsemantic[ Constructor ctor ] returns [ SectionVector value]
621
+ : ^ (t= OP_PCODE p= semantic[ env, ctor.location, sc.pcode, $t, true , false ] ) { $value = p; }
622
622
| ^ (OP_PCODE OP_UNIMPL) { /* unimpl unimplemented ; */ $value = null; }
623
623
;
624
624
@@ -941,7 +941,7 @@ cstatement[VectorSTL<ContextChange> r]
941
941
}
942
942
;
943
943
944
- semantic[ ParsingEnvironment pe, PcodeCompile pcode, Tree where , boolean sectionsAllowed, boolean isMacroParse] returns [ SectionVector rtl]
944
+ semantic[ ParsingEnvironment pe, Location containerLoc, PcodeCompile pcode, Tree where , boolean sectionsAllowed, boolean isMacroParse] returns [ SectionVector rtl]
945
945
scope {
946
946
SectionVector sections;
947
947
boolean containsMultipleSections;
@@ -966,7 +966,11 @@ semantic[ParsingEnvironment pe, PcodeCompile pcode, Tree where, boolean sections
966
966
: ^ (x= OP_SEMANTIC c= code_block[ find($x)] {
967
967
if (c != null) {
968
968
if (c.getOpvec().empty() && c.getResult() == null) {
969
- pcode.recordNop(find(where ));
969
+ Location loc = find(where );
970
+ if (loc == null) {
971
+ loc = containerLoc;
972
+ }
973
+ pcode.recordNop(loc);
970
974
}
971
975
if ($semantic:: containsMultipleSections) {
972
976
$semantic:: sections = pcode.finalNamedSection($semantic:: sections, c);
0 commit comments