@@ -214,6 +214,13 @@ class AS3ExternsGenerator {
214214 return true ;
215215 }
216216 if (options != null ) {
217+ if (options .includedSymbols != null ) {
218+ for (includedSymbol in options .includedSymbols ) {
219+ if (qname == includedSymbol ) {
220+ return false ;
221+ }
222+ }
223+ }
217224 if (options .includedPackages != null ) {
218225 final qnameLastDotIndex = qname .lastIndexOf (" ." );
219226 final qnamePack = qnameLastDotIndex != - 1 ? qname .substr (0 , qnameLastDotIndex ).split (" ." ) : [];
@@ -965,10 +972,39 @@ class AS3ExternsGenerator {
965972 return true ;
966973 }
967974 var qname = baseTypeToQname (baseType , []);
968- if (qname .indexOf (" ." ) == - 1 ) {
975+ if (qname .indexOf (" ." ) == - 1 && ALWAYS_ALLOWED_REFERENCE_TYPES . indexOf ( baseType . name ) != - 1 ) {
969976 return true ;
970977 }
971- if (isInPackage (currentPackage , baseType .pack , true )) {
978+ var baseTypePack = baseType .pack ;
979+ var i = 0 ;
980+ if (options != null && options .renameSymbols != null ) {
981+ var renameSymbols = options .renameSymbols ;
982+ while (i < renameSymbols .length ) {
983+ var originalName = renameSymbols [i ];
984+ i ++ ;
985+ var newName = renameSymbols [i ];
986+ i ++ ;
987+ if (baseTypePack .indexOf (originalName ) != - 1 ) {
988+ baseTypePack [baseTypePack .indexOf (originalName )] = newName ;
989+ break ;
990+ }
991+ }
992+ }
993+ if (options != null && options .renamePackages != null ) {
994+ i = 0 ;
995+ var renamePackages = options .renamePackages ;
996+ while (i < renamePackages .length ) {
997+ var originalName = renamePackages [i ];
998+ i ++ ;
999+ var newName = renamePackages [i ];
1000+ i ++ ;
1001+ if (baseTypePack .indexOf (originalName ) != - 1 ) {
1002+ baseTypePack [baseTypePack .indexOf (originalName )] = newName ;
1003+ break ;
1004+ }
1005+ }
1006+ }
1007+ if (isInPackage (currentPackage , baseTypePack , true )) {
9721008 return true ;
9731009 }
9741010 return false ;
@@ -1273,6 +1309,14 @@ typedef AS3GeneratorOptions = {
12731309 **/
12741310 ? includedPackages : Array <String >,
12751311
1312+ /**
1313+ Externs will be generated for symbols specified.
1314+
1315+ Types from other packages may still be referenced by fields or method
1316+ signatures. Use `allowedPackageReferences` to restrict those too.
1317+ **/
1318+ ? includedSymbols : Array <String >,
1319+
12761320 /**
12771321 When `includedPackages` is not empty, `allowedPackageReferences` may
12781322 be used to allow types from other packages to be used for field types,
0 commit comments