Skip to content

Remove AmpCodingConvention.java #28172

@rsimha

Description

@rsimha

Today, the file determines whether an identifier must be exported based on its name and a few special-case rules:

/**
* {@inheritDoc}
* Because AMP objects can travel between compilation units, we consider
* non-private methods exported.
* Should we decide to do full-program compilation (for version bound JS
* delivery), this could go away there.
*/
@Override public boolean isExported(String name, boolean local) {
if (local) {
return false;
}
// This is a special case, of compiler generated super globals.
// Because we otherwise use ES6 modules throughout, we don't
// have any other similar variables.
if (name.startsWith("JSCompiler_")) {
return false;
}
// ES6 generated module names are not exported.
if (name.contains("$")) {
return false;
}
// Starting with _ explicitly exports a name.
if (name.startsWith("_")) {
return true;
}
return !name.endsWith("_") && !name.endsWith("ForTesting");
}
/**
* {@inheritDoc}
* We cannot rename properties we treat as exported, because they may travel
* between compilation unit.
*/
@Override public boolean blockRenamingForProperty(String name) {
return isExported(name, false);
}

In order to remove this file, we'd have to do a combination of changing our codebase to no longer use the special identifiers (like *ForTesting), or replace the special-case rules with babel transforms.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions