/* Ċ Ġ* ĠCopyright Ġ 2 0 1 0 - 2 0 1 8 ĠJetBrains Ġs . r . o . Ġand ĠKotlin ĠProgramming ĠLanguage Ġcontributors . Ċ Ġ* ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe Ġlicense / LICENSE . txt Ġfile . Ċ Ġ*/ Ċ Ċ package Ġorg . jetbrains . kotlin . descriptors Ċ Ċ import Ġorg . jetbrains . kotlin . builtins . Standard Names . CONT IN UATION _ INTERFACE _ FQ _ NAME _ EXPERIMENT AL Ċ import Ġorg . jetbrains . kotlin . builtins . Standard Names . CONT IN UATION _ INTERFACE _ FQ _ NAME _ RELEASE Ċ import Ġorg . jetbrains . kotlin . incremental . components . Lookup Location Ċ import Ġorg . jetbrains . kotlin . incremental . components . No Lookup Location Ċ import Ġorg . jetbrains . kotlin . name . Fq Name Ċ import Ġorg . jetbrains . kotlin . resolve . Descriptor Utils Ċ import Ġorg . jetbrains . kotlin . resolve . descriptor Util . module Ċ import Ġorg . jetbrains . kotlin . types . Kotlin Type Ċ import Ġorg . jetbrains . kotlin . types . Kotlin Type Factory Ċ import Ġorg . jetbrains . kotlin . types . type Util . as Type Projection Ċ import Ġorg . jetbrains . kotlin . utils . sure Ċ import Ġkotlin . contracts . Experimental Contracts Ċ import Ġkotlin . contracts . contract Ċ Ċ fun ĠModule Descriptor . resolve Class By Fq Name ( fq Name : ĠF q Name , Ġlookup Location : ĠLookup Location ): ĠClass Descriptor ? Ġ{ ĊĠĠĠ Ġif Ġ( fq Name . is Root ) Ġreturn Ġnull ĊĊĠĠĠ Ġ( get Package ( fq Name . parent ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. member Scope . get Cont ributed Classifier ( fq Name . short Name (), Ġlookup Location ) Ġas ? ĠClass Descriptor )?. let Ġ{ Ġreturn Ġit Ġ} ĊĊĠĠĠ Ġreturn Ġresolve Class By Fq Name ( fq Name . parent (), Ġlookup Location ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ? . un subst it uted Inner Classes Scope ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ? . get Cont ributed Classifier ( fq Name . short Name (), Ġlookup Location ) Ġas ? ĠClass Descriptor Ċ } Ċ Ċ fun ĠModule Descriptor . find Continuation Class Descriptor OrNull ( lookup Location : ĠLookup Location , Ġrelease Cor outines : ĠBoolean ) Ġ= ĊĠĠĠ Ġif Ġ( release Cor outines ) ĊĠĠĠĠĠĠĠ Ġresolve Class By Fq Name ( CONT IN UATION _ INTERFACE _ FQ _ NAME _ RELEASE , Ġlookup Location ) ĊĠĠĠ Ġelse ĊĠĠĠĠĠĠĠ Ġresolve Class By Fq Name ( CONT IN UATION _ INTERFACE _ FQ _ NAME _ EXPERIMENT AL , Ġlookup Location ) Ċ Ċ fun ĠModule Descriptor . find Continuation Class Descriptor ( lookup Location : ĠLookup Location , Ġrelease Cor outines : ĠBoolean ) Ġ= ĊĠĠĠ Ġfind Continuation Class Descriptor OrNull ( lookup Location , Ġrelease Cor outines ). sure Ġ{ Ġ" Continuation Ġinterface Ġis Ġnot Ġfound " Ġ} Ċ Ċ fun ĠModule Descriptor . get Continuation OfType Or Any ( kotlin Type : ĠKotlin Type , Ġis Release Cor outines : ĠBoolean ) Ġ= ĊĠĠĠ Ġmodule . find Continuation Class Descriptor OrNull ( ĊĠĠĠĠĠĠĠ ĠNo Lookup Location . FROM _ DE SERIAL IZATION , ĊĠĠĠĠĠĠĠ Ġis Release Cor outines ĊĠĠĠ Ġ) ?. default Type ?. let Ġ{ ĊĠĠĠĠĠĠĠ ĠKotlin Type Factory . simple Type ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġit , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġarguments Ġ= ĠlistOf ( kotlin Type . as Type Projection ()) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} Ġ?: Ġmodule . built Ins . nullable Any Type Ċ Ċ fun ĠDeclaration Descriptor . is TopLevel In Package ( name : ĠString , ĠpackageName : ĠString ): ĠBoolean Ġ{ ĊĠĠĠ Ġif Ġ( name Ġ!= Ġthis . name . asString ()) Ġreturn Ġfalse ĊĊĠĠĠ Ġval Ġcontaining Declaration Ġ= Ġcontaining Declaration Ġas ? ĠPackage Fragment Descriptor Ġ?: Ġreturn Ġfalse ĊĠĠĠ Ġval Ġpackage Fq Name Ġ= Ġcontaining Declaration . fq Name . asString () ĊĠĠĠ Ġreturn ĠpackageName Ġ== Ġpackage Fq Name Ċ } Ċ Ċ fun ĠCallable Descriptor . is Supported For Callable Reference () Ġ= Ġthis Ġis ĠProperty Descriptor Ġ|| Ġthis Ġis ĠFunction Descriptor Ċ Ċ @ Opt In ( Experimental Contracts :: class ) Ċ fun ĠDeclaration Descriptor . is Se aled (): ĠBoolean Ġ{ ĊĠĠĠ Ġcontract Ġ{ ĊĠĠĠĠĠĠĠ Ġreturns ( true ) Ġimplies Ġ( this @ is Se aled Ġis ĠClass Descriptor ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn ĠDescriptor Utils . is Se aled Class ( this ) Ċ } Ċ Ċ fun ĠDeclaration Descriptor . containing Package (): ĠF q Name ? Ġ{ ĊĠĠĠ Ġvar Ġcontainer Ġ= Ġcontaining Declaration ĊĠĠĠ Ġwhile Ġ( true ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( container Ġ== Ġnull Ġ|| Ġcontainer Ġis ĠPackage Fragment Descriptor ) Ġbreak ĊĠĠĠĠĠĠĠ Ġcontainer Ġ= Ġcontainer . containing Declaration ĊĠĠĠ Ġ} ĊĠĠĠ Ġrequire ( container Ġis ĠPackage Fragment Descriptor ?) ĊĠĠĠ Ġreturn Ġcontainer ?. fq Name Ċ } Ċ