/** Builds the Environment. */ public Environment build() { Preconditions.checkArgument(mutability.isMutable()); if (parent != null) { Preconditions.checkArgument(!parent.mutability().isMutable()); } Frame globalFrame = new Frame(mutability, parent); Frame dynamicFrame = new Frame(mutability, null); if (importedExtensions == null) { importedExtensions = ImmutableMap.of(); } return new Environment( globalFrame, dynamicFrame, eventHandler, importedExtensions, isSkylark, fileContentHashCode, isLoadingPhase); }