Changeset 12843


Ignore:
Timestamp:
May 21, 2019 6:00:38 PM (7 months ago)
Author:
mjohnsson
Message:

#5771
Fixed a bug regarding searching in sourrounding classes
in one of the simple (source) class lookup methods.

Location:
branches/dev-2154
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-2154/CHANGELOG.txt

    r12841 r12843  
    11================= Unreleased ==================
     2# Fixed ; Minor ; Compiler ; #5771
     3Fixed a bug regarding searching in sourrounding classes
     4in one of the simple (source) class lookup methods.
     5
    26# Feature ; Minor ; Compiler ; #5758
    37Added new option time_events, allows time events to be generated, enabled by default.
  • branches/dev-2154/Compiler/ModelicaFrontEnd/src/jastadd/source/SimpleLookup.jrag

    r12752 r12843  
    9494            cd = simpleLookupGlobalScope(qName.next()).getClassDecl();
    9595        } else {
    96             cd = simpleLookupIncludeImports(qName.next()).getClassDecl();
     96            cd = simpleLookupDefaultScope(qName.next()).getClassDecl();
    9797        }
    9898
     
    340340        return res;
    341341    }
     342    syn ResolvedAccess SrcClassDecl.simpleLookupDefaultScope(String name) = simpleLookupIncludeImports(name);
    342343
    343344    /**
     
    412413     * Lookup in contained classes, components and extended classes.
    413414     * Has to be an unqualified classname.
     415     * Method doesn't lookup in surrounding classes.
    414416     * This method returns the unknown class when the class isn't found.
    415417     */
  • branches/dev-2154/Compiler/ModelicaFrontEnd/test/modelica/SimpleLookup.mo

    r12542 r12843  
    144144SimpleLookup.ClassLookup
    145145->
    146 Unknown
    147 
    148146SimpleLookup.ClassLookup
     147
     148SimpleLookup.ClassLookup
    149149->
    150150SimpleLookup.ClassLookup.Extended
     
    176176SimpleLookup.ClassLookup.Imported.NoneImported
    177177->
    178 Unknown
     178SimpleLookup.ClassLookup.WithComponent.'!quoted!'
    179179
    180180
    181181")})));
    182182end ClassLookup;
     183
     184model SurroundingLookup
     185    model A
     186        model SurroundingTest
     187            annotation(__JModelica(UnitTesting(tests={
     188            SourceMethodTestCase(
     189                name="Relative",
     190                description="External functions: simple func, all default",
     191                methodName="testSimpleClassLookup",
     192                argumentTypes={"[Ljava.lang.String;"},
     193                arguments={{"SimpleLookup.SurroundingLookup.A.SurroundingTest", "SimpleLookup.RelativeLookup",
     194                            "SimpleLookup.SurroundingLookup.A.SurroundingTest", "A",
     195                            "SimpleLookup.SurroundingLookup.A.SurroundingTest", "SimpleLookup.SurroundingLookup",
     196                            "SimpleLookup.SurroundingLookup.A.SurroundingTest", "SurroundingLookup",
     197                            "SimpleLookup.SurroundingLookup.A.SurroundingTest", "ClassLookup"}
     198                },
     199                methodResult="
     200SimpleLookup.SurroundingLookup.A.SurroundingTest
     201->
     202SimpleLookup.RelativeLookup
     203
     204SimpleLookup.SurroundingLookup.A.SurroundingTest
     205->
     206SimpleLookup.SurroundingLookup.A
     207
     208SimpleLookup.SurroundingLookup.A.SurroundingTest
     209->
     210SimpleLookup.SurroundingLookup
     211
     212SimpleLookup.SurroundingLookup.A.SurroundingTest
     213->
     214SimpleLookup.SurroundingLookup
     215
     216SimpleLookup.SurroundingLookup.A.SurroundingTest
     217->
     218SimpleLookup.ClassLookup
     219       
     220        ")})));
     221        end SurroundingTest;
     222    end A;
     223
     224end SurroundingLookup;
    183225
    184226model RelativeLookup
     
    208250SimpleLookup.RelativeLookup.A
    209251->
    210 Unknown
     252SimpleLookup.RelativeLookup.C
    211253
    212254SimpleLookup.RelativeLookup.A
    213255->
    214 Unknown
     256SimpleLookup.RelativeLookup.C
    215257
    216258")})));
Note: See TracChangeset for help on using the changeset viewer.