From f4271d56f09079b9becdf9f6eb5ec43147234400 Mon Sep 17 00:00:00 2001 From: Baptiste Manson Date: Wed, 13 Dec 2017 12:04:00 -0800 Subject: [PATCH] Correction of a few comment typos in the serializers Summary: Hi all, It was a good way to get started on contributing. Closes https://github.com/facebook/prepack/pull/1259 Differential Revision: D6558546 Pulled By: hermanventer fbshipit-source-id: 815380c88aad36a7e1b34928b4eb6927a7c9d461 --- src/serializer/LazyObjectsSerializer.js | 4 ++-- src/serializer/Referentializer.js | 2 +- src/serializer/ResidualHeapSerializer.js | 6 +++--- src/serializer/ResidualHeapValueIdentifiers.js | 2 +- src/serializer/ResidualHeapVisitor.js | 4 ++-- src/serializer/visitors.js | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/serializer/LazyObjectsSerializer.js b/src/serializer/LazyObjectsSerializer.js index 696686a8e..2414bb3b5 100644 --- a/src/serializer/LazyObjectsSerializer.js +++ b/src/serializer/LazyObjectsSerializer.js @@ -44,10 +44,10 @@ const LAZY_OBJECTS_SERIALIZER_BODY_TYPE = "LazyObjectInitializer"; * Objects are serialized into two parts: * 1. All lazy objects are created via lightweight LazyObjectsRuntime.createLazyObject() call. * 2. Lazy objects' property assignments are delayed in a callback function which is registered with the runtime. - * lazy objects rutnime will execute this callback to hydrate the lazy objects. + * lazy objects runtime will execute this callback to hydrate the lazy objects. * * Currently only the raw objects are taking part in the lazy objects feature. - * TODO: suppor for other objects, like array, regex etc... + * TODO: support for other objects, like array, regex etc... */ export class LazyObjectsSerializer extends ResidualHeapSerializer { constructor( diff --git a/src/serializer/Referentializer.js b/src/serializer/Referentializer.js index 227db2ae6..09e9e929a 100644 --- a/src/serializer/Referentializer.js +++ b/src/serializer/Referentializer.js @@ -81,7 +81,7 @@ export class Referentializer { } // Generate a shared function for accessing captured scope bindings. - // TODO: skip generating this function if the captured scope is not shared by multiple residual funcitons. + // TODO: skip generating this function if the captured scope is not shared by multiple residual functions. createCaptureScopeAccessFunction(referentializationScope: ReferentializationScope): BabelNodeStatement { const body = []; const selectorParam = t.identifier("selector"); diff --git a/src/serializer/ResidualHeapSerializer.js b/src/serializer/ResidualHeapSerializer.js index 87f98c100..fb7ca599e 100644 --- a/src/serializer/ResidualHeapSerializer.js +++ b/src/serializer/ResidualHeapSerializer.js @@ -217,7 +217,7 @@ export class ResidualHeapSerializer { // symbols, properties, prototype. // For every created object that corresponds to a value, // this function should be invoked once. - // Thus, as a side effects, we gather statistics here on all emitted objects. + // Thus, as a side effect, we gather statistics here on all emitted objects. _emitObjectProperties( obj: ObjectValue, properties: Map = obj.properties, @@ -1360,7 +1360,7 @@ export class ResidualHeapSerializer { return this._serializeAbstractValueHelper(val); } else { // This abstract value's dependencies should all be declared - // but still need to check it again in case their serialized bodies are in different generator scope. + // but still need to check them again in case their serialized bodies are in different generator scope. this.emitter.emitNowOrAfterWaitingForDependencies(val.args, () => { const serializedValue = this._serializeAbstractValueHelper(val); let uid = this.getSerializeObjectIdentifier(val); @@ -1516,7 +1516,7 @@ export class ResidualHeapSerializer { let nestedFunctions = new Set([...createdObjects].filter(object => object instanceof FunctionValue)); // result -- ignore TODO: return the result from the function somehow // Generator -- visit all entries - // Bindings -- only need to serialize bindings if they're captured by some nested function ?? + // Bindings -- only need to serialize bindings if they're captured by some nested function? // -- need to apply them and maybe need to revisit functions in ancestors to make sure // -- we don't overwrite anything they capture // -- TODO: deal with these properly diff --git a/src/serializer/ResidualHeapValueIdentifiers.js b/src/serializer/ResidualHeapValueIdentifiers.js index e963b7215..a60d19978 100644 --- a/src/serializer/ResidualHeapValueIdentifiers.js +++ b/src/serializer/ResidualHeapValueIdentifiers.js @@ -19,7 +19,7 @@ import * as t from "babel-types"; // This class can optionally track how often such value identifiers are referenced // when pass 1 is activated, which is usually followed by pass 2 in which // unneeded identifiers (those which were only ever referenced once) are -// eliminated as the defining expression can be inlined. +// eliminated as the defining expression can be inlined. export class ResidualHeapValueIdentifiers { constructor(values: Iterator, preludeGenerator: PreludeGenerator) { this.collectValToRefCountOnly = false; diff --git a/src/serializer/ResidualHeapVisitor.js b/src/serializer/ResidualHeapVisitor.js index 8c5b9bffd..5a2f66dc1 100644 --- a/src/serializer/ResidualHeapVisitor.js +++ b/src/serializer/ResidualHeapVisitor.js @@ -52,7 +52,7 @@ import { Environment, To } from "../singletons.js"; export type Scope = FunctionValue | Generator; /* This class visits all values that are reachable in the residual heap. - In particular, this "filters out" values that are... + In particular, this "filters out" values that are: - captured by a DeclarativeEnvironmentRecord, but not actually used by any closure. - Unmodified prototype objects TODO #680: Figure out minimal set of values that need to be kept alive for WeakSet and WeakMap instances. @@ -507,7 +507,7 @@ export class ResidualHeapVisitor { if (this.preProcessValue(val)) this.visitAbstractValue(val); } else if (val.isIntrinsic()) { // All intrinsic values exist from the beginning of time... - // ...except for a few that come into existance as templates for abstract objects (TODO #882). + // ...except for a few that come into existence as templates for abstract objects (TODO #882). if (val.isTemplate) this.preProcessValue(val); else this._withScope(this.commonScope, () => { diff --git a/src/serializer/visitors.js b/src/serializer/visitors.js index 3a26c0d55..84a137afe 100644 --- a/src/serializer/visitors.js +++ b/src/serializer/visitors.js @@ -43,7 +43,7 @@ function shouldVisit(node, data) { return (node: any)._renamedOnce !== data; } -// replaceWith causes the node to be re-analysed, so to prevent double replacement +// replaceWith causes the node to be re-analyzed, so to prevent double replacement // we add this property on the node to mark it such that it does not get replaced // again on this pass // TODO: Make this work when replacing with arbitrary BabelNodeExpressions. Currently