text
stringlengths 1
22.8M
|
|---|
Gyula Andrássy High School (Andrássy Gyula Gimnázium és Kollégium), formerly Rózsa Ferenc Gimnázium (RFG) or Rózsa for short, is a high school (grammar school) in Békéscsaba, Hungary. The school is the oldest in the city and one of the most renowned in Békés county.
History
The school was founded by the Lutheran church in 1855, as Algimnázium. In 1895 the school was upgraded to Főgimnázium and got the name Rudolf Főgimnázium. After the Communist takeover (1948) the school has been taken into state property and took the name of Ferenc Rózsa. Rózsa was a member of the then-illegal Communist Party of Hungary between the two World Wars, criticised the political system and died in prison under unclear circumstances. During the Communist era he was regarded as a martyr.
Present days
The school moved into its current building in 1994. Rózsa Gimnázium holds steadily its position among the best schools in the county, in 2004 its pupils received 11 awards on different high school contests. Based on school contest results Rózsa Gimnázium was always among the best 20 schools of Hungary between 1986 and 2006. The local government renamed the school in 2008 as Andrássy Gyula Gimnázium és Kollégium. Andrássy was a prime minister of Kingdom of Hungary between 1867 and 1871, and the foreign minister of Austria-Hungary between 1871 and 1879.
Notable students
Endre Bajcsy-Zsilinszky, politician and political columnist
Zoltán Berczik, European Champions table tennis player
Géza Gyóni, poet
Judit Pogány, actress
References
External links
Gymnasiums in Hungary
Békés County
Andrássy family
Educational institutions established in 1855
1850s establishments in Hungary
|
Are You the One? Brasil is a Brazilian reality television series on MTV (Brazil). It is a Brazilian version of the original American series. It follows 20 people who are living together in a tropical destination to find their perfect match. If the 10 men and 10 women are able to correctly choose all ten perfect matches in ten weeks, they will win R$500 thousand to split among them. Each episode the cast will pair up with whoever they believe their perfect match is to compete in a challenge. The winners of the challenge will go on a date, and have a chance to test their match in the truth booth. The cast members will choose one of the winning couples to go to the truth booth to determine if they are a perfect match or not. This is the only way to confirm matches. Each episode ends with a matching ceremony where the couples will be told how many perfect matches they have, but not which matches are correct. It debuted in February 2015 on MTV (Brazil).
Series overview
Season 1
Filmed in Rio de Janeiro, season one premiered on February 1, 2015.
Cast
Progress
Notes
Confirmed Perfect Match
Unconfirmed Perfect Match
Once the truth booths confirms a perfect match, that couple will go to the honeymoon suite and will automatically paired up for the remainder of the match ceremonies.
Truth Booths
Season 2
Filmed in Rio de Janeiro, season 2 premiered on January 17, 2016.
Cast
1 During Episode 6, it was found that Elisabetta was pregnant from a previous relationship. For this reason, she left the program and during the challenge Barbara was announced as a replacement.
Progress
Notes
Confirmed Perfect Match
Unconfirmed Perfect Match
Once the truth booths confirms a perfect match, that couple will go to the honeymoon suite and will automatically paired up for the remainder of the match ceremonies.
Truth Booths
Season 3
Filmed in Trancoso, Bahia, Season three premiered on January 29, 2017.
Cast
Progress
Notes
Confirmed Perfect Match
Unconfirmed Perfect Match
Once the truth booths confirms a perfect match, that couple will go to the honeymoon suite and will automatically paired up for the remainder of the match ceremonies.
Truth Booths
Season 4
Filmed in Búzios, Rio de Janeiro. The new host is Caio Castro. This time, one girl has two matches which means that there will be eleven boys, but only ten girls.
Cast
Progress
Notes
Confirmed Perfect Match Unconfirmed Perfect Match This guy was not chosen in the match-up ceremony
Once the truth booth confirms a perfect match, that couple will go to the honeymoon suite and will automatically be paired up for the remainder of the match ceremonies.
Truth Booths
References
External links
Brazilian reality television series
2015 Brazilian television series debuts
2018 Brazilian television series endings
MTV reality television series
Brasil
Television shows set in Brazil
|
Jaya Simhavarman IV, Mahendravarman, or Chế Chí (制至), son of Chế Mân and first queen Princess Bhaskaradevi, was born in 1284 as Prince Harijitatmaja. He reigned as the king of Champa from 1307 - 1312.
Because Chế Chí's Vietnamese mother refused to die with her husband and Chế Chí's father, Chế Mân, Chế Chí set out to recapture two districts ceded by Champa to Annam in their time of peace brought on by the wedding of his father and mother. He was defeated, however, and died a prisoner in Annam. After his capture, his brother, Che Da A Ba, or Che Nang, was assigned to govern Champa by the Dai Viet.
References
Kings of Champa
Hindu monarchs
14th-century Vietnamese monarchs
Vietnamese monarchs
|
```shell
Shebang `#!` explained
Rapidly invoke an editor to write a long, complex, or tricky command
Clear the terminal instantly
Terminal based browser
Breaking out of a terminal when `ssh` locks
```
|
Vigouroux is a French surname. Notable people with the surname include:
Fulcran Vigouroux (1837–1915), French Catholic priest and scholar
Jacques Vigouroux Duplessis (c. 1680 – 1732), French painter
Lawrence Vigouroux (born 1993), Chilean football player
Paul Vigouroux (1919–1980), French political activist and Nazi collaborator
Pierre Vigouroux (born 1983), French rugby union player
Robert Vigouroux (1923–2017), French politician and writer
See also
Saint-Martin-sous-Vigouroux, a French commune
French-language surnames
|
```yaml
models:
- columns:
- name: id
tests:
- unique
- not_null
- relationships:
field: id
to: ref('node_0')
name: node_276
version: 2
```
|
```javascript
_(function () {
return 1;
});
function foo() {
return 1;
}
foo();
foo();
var bar = function (a) {
return a;
};
bar();
bar();
class A {
foo() {}
}
new A(); // except the ones with side-effects
function a(foo) {
return foo;
}
function b(foo, bar, baz) {
return baz;
}
function c(foo, {
bar
}) {
return bar;
}
function d({
foo
}, {
bar
}) {
return foo;
}
function e({
foo
}, bar = sideEffect()) {
return foo;
}
function e({
foo
}, bar = {}) {
return foo;
}
```
|
```scala
/*
*/
package akka.stream.alpakka.googlecloud.storage
import java.time.OffsetDateTime
import java.util.Optional
import akka.http.scaladsl.model.ContentType
import scala.compat.java8.OptionConverters._
import scala.collection.JavaConverters._
/**
* Represents an object within Google Cloud Storage.
* Refer to path_to_url#resource-representations for more in depth docs
*
* @param kind The kind of item this is, for objects, this is always storage#object.
* @param id The ID of the object, including the bucket name, object name, and generation number.
* @param name The name of the object.
* @param bucket The name of the bucket containing this object.
* @param generation The content generation of this object, used for object versioning.
* @param contentType The Content-Type of the object data, if an object is stored without a Content-Type, it is served as application/octet-stream.
* @param size The Content-Length of the data in bytes.
* @param etag The HTTP 1.1 Entity tag for the object.
* @param md5Hash The MD5 hash of the data; encoded using base64.
* @param crc32c The CRC32c checksum, encoded using base64 in big-endian byte order.
* @param mediaLink The Media download link.
* @param selfLink The link to this object.
* @param timeCreated The creation time of the object in RFC 3339 format.
* @param timeDeleted The deletion time of the object in RFC 3339 format. Returned if and only if this version of the object is no longer a live version, but remains in the bucket as a noncurrent version.
* @param updated The modification time of the object metadata in RFC 3339 format.
* @param storageClass The storage class of the object.
* @param contentDisposition The Content-Disposition of the object data.
* @param contentEncoding The Content Encoding of the object data.
* @param contentLanguage The content language of the objcet data.
* @param metageneration The version of the metadata for this object at this generation.
* @param temporaryHold Whether or not the object is subject to a temporary hold.
* @param eventBasedHold Whether or not the object is subject to an event-based hold.
* @param retentionExpirationTime The earliest time that the object can be deleted, based on a bucket's retention policy, in RFC 3339 format.
* @param timeStorageClassUpdated The time at which the object's storage class was last changed.
* @param cacheControl Cache-Control directive for the object data.
* @param customTime A user-specified date and time represented in the RFC 3339 format.
* @param metadata User-provided metadata, in key/value pairs.
* @param componentCount Number of underlying components that make up a composite object.
* @param kmsKeyName Cloud KMS Key used to encrypt this object, if the object is encrypted by such a key.
* @param customerEncryption Metadata of customer-supplied encryption key, if the object is encrypted by such a key.
* @param owner The owner of the object. This will always be the uploader of the object.
* @param acl Access controls on the object, containing one or more objectAccessControls Resources. If iamConfiguration.uniformBucketLevelAccess.enabled is set to true, this field is omitted in responses, and requests that specify this field fail.
*/
final class StorageObject private (
val kind: String,
val id: String,
val name: String,
val bucket: String,
val generation: Long,
val contentType: ContentType,
val maybeContentType: Option[ContentType],
val size: Long,
val etag: String,
val md5Hash: String,
val maybeMd5Hash: Option[String],
val crc32c: String,
val maybeCrc32c: Option[String],
val mediaLink: String,
val selfLink: String,
val updated: OffsetDateTime,
val timeCreated: OffsetDateTime,
val timeDeleted: Option[OffsetDateTime],
val storageClass: String,
val maybeStorageClass: Option[String],
val contentDisposition: Option[String],
val contentEncoding: Option[String],
val contentLanguage: Option[String],
val metageneration: Long,
val temporaryHold: Option[Boolean],
val eventBasedHold: Option[Boolean],
val retentionExpirationTime: Option[OffsetDateTime],
val timeStorageClassUpdated: OffsetDateTime,
val cacheControl: Option[String],
val customTime: Option[OffsetDateTime],
val metadata: Option[Map[String, String]],
val componentCount: Option[Int],
val kmsKeyName: Option[String],
val customerEncryption: Option[CustomerEncryption],
val owner: Option[Owner],
val acl: Option[List[ObjectAccessControls]]
) {
/** Java API */
def getContentType: akka.http.javadsl.model.ContentType = contentType.asInstanceOf[ContentType]
def getTimeDeleted: Optional[OffsetDateTime] = timeDeleted.asJava
def getContentDisposition: Optional[String] = contentDisposition.asJava
def getContentEncoding: Optional[String] = contentEncoding.asJava
def getContentLanguage: Optional[String] = contentLanguage.asJava
def getTemporaryHold: Optional[Boolean] = temporaryHold.asJava
def getEventBasedHold: Optional[Boolean] = eventBasedHold.asJava
def getRetentionExpirationTime: Optional[OffsetDateTime] = retentionExpirationTime.asJava
def getCacheControl: Optional[String] = cacheControl.asJava
def getMetadata: Optional[java.util.Map[String, String]] = metadata.map(_.asJava).asJava
def getComponentCount: Optional[Integer] = componentCount.map(Int.box).asJava
def getKmsKeyName: Optional[String] = kmsKeyName.asJava
def getCustomerEncryption: Optional[CustomerEncryption] = customerEncryption.asJava
def getOwner: Optional[Owner] = owner.asJava
def getAcl: Optional[java.util.List[ObjectAccessControls]] = acl.map(_.asJava).asJava
def getCustomTime: Optional[OffsetDateTime] = customTime.asJava
def getMaybeMd5Hash: Optional[String] = maybeMd5Hash.asJava
def getMaybeCrc32c: Optional[String] = maybeCrc32c.asJava
def getMaybeStorageClass: Optional[String] = maybeStorageClass.asJava
def withKind(value: String): StorageObject = copy(kind = value)
def withId(value: String): StorageObject = copy(id = value)
def withName(value: String): StorageObject = copy(name = value)
def withBucket(value: String): StorageObject = copy(bucket = value)
def withGeneration(value: Long): StorageObject = copy(generation = value)
/** Scala API */
def withContentType(value: ContentType): StorageObject = copy(contentType = value)
/** Java API */
def withContentType(value: akka.http.javadsl.model.ContentType): StorageObject =
copy(maybeContentType = Option(value.asInstanceOf[ContentType]))
def withSize(value: Long): StorageObject = copy(size = value)
def withEtag(value: String): StorageObject = copy(etag = value)
def withMd5Hash(value: String): StorageObject = copy(maybeMd5Hash = Option(value))
def withCrc32c(value: String): StorageObject = copy(maybeCrc32c = Option(value))
def withMediaLink(value: String): StorageObject = copy(mediaLink = value)
def withSelfLink(value: String): StorageObject = copy(selfLink = value)
def withUpdated(value: OffsetDateTime): StorageObject = copy(updated = value)
def withTimeCreated(value: OffsetDateTime): StorageObject = copy(timeCreated = value)
def withTimeDeleted(value: OffsetDateTime): StorageObject = copy(timeDeleted = Option(value))
def withStorageClass(value: String): StorageObject = copy(maybeStorageClass = Option(value))
def withContentDisposition(value: String): StorageObject = copy(contentDisposition = Option(value))
def withContentEncoding(value: String): StorageObject = copy(contentEncoding = Option(value))
def withContentLanguage(value: String): StorageObject = copy(contentLanguage = Option(value))
def withMetageneration(value: Long): StorageObject = copy(metageneration = value)
def withTemporaryHold(value: Boolean): StorageObject = copy(temporaryHold = Option(value))
def withEventBasedHold(value: Boolean): StorageObject = copy(eventBasedHold = Option(value))
def withRetentionExpirationTime(value: OffsetDateTime): StorageObject = copy(retentionExpirationTime = Option(value))
def withTimeStorageClassUpdated(value: OffsetDateTime): StorageObject = copy(timeStorageClassUpdated = value)
def withCacheControl(value: String): StorageObject = copy(cacheControl = Option(value))
def withCustomTime(value: OffsetDateTime): StorageObject = copy(customTime = Option(value))
def withMetadata(value: Map[String, String]): StorageObject = copy(metadata = Option(value))
def withComponentCount(value: Int): StorageObject = copy(componentCount = Option(value))
def withKmsKeyName(value: String): StorageObject = copy(kmsKeyName = Option(value))
def withCustomerEncryption(value: CustomerEncryption): StorageObject = copy(customerEncryption = Option(value))
def withOwner(value: Owner): StorageObject = copy(owner = Option(value))
def withAcl(value: List[ObjectAccessControls]): StorageObject = copy(acl = Option(value))
private def copy(
kind: String = kind,
id: String = id,
name: String = name,
bucket: String = bucket,
generation: Long = generation,
contentType: ContentType = maybeContentType.getOrElse(null),
maybeContentType: Option[ContentType] = maybeContentType,
size: Long = size,
etag: String = etag,
md5Hash: String = maybeMd5Hash.getOrElse(""),
maybeMd5Hash: Option[String] = maybeMd5Hash,
crc32c: String = maybeCrc32c.getOrElse(""),
maybeCrc32c: Option[String] = maybeCrc32c,
mediaLink: String = mediaLink,
selfLink: String = selfLink,
updated: OffsetDateTime = updated,
timeCreated: OffsetDateTime = timeCreated,
timeDeleted: Option[OffsetDateTime] = timeDeleted,
storageClass: String = maybeStorageClass.getOrElse(""),
maybeStorageClass: Option[String] = maybeStorageClass,
contentDisposition: Option[String] = contentDisposition,
contentEncoding: Option[String] = contentEncoding,
contentLanguage: Option[String] = contentLanguage,
metageneration: Long = metageneration,
temporaryHold: Option[Boolean] = temporaryHold,
eventBasedHold: Option[Boolean] = eventBasedHold,
retentionExpirationTime: Option[OffsetDateTime] = retentionExpirationTime,
timeStorageClassUpdated: OffsetDateTime = timeStorageClassUpdated,
cacheControl: Option[String] = cacheControl,
customTime: Option[OffsetDateTime] = customTime,
metadata: Option[Map[String, String]] = metadata,
componentCount: Option[Int] = componentCount,
kmsKeyName: Option[String] = kmsKeyName,
customerEncryption: Option[CustomerEncryption] = customerEncryption,
owner: Option[Owner] = owner,
acl: Option[List[ObjectAccessControls]] = acl
): StorageObject = new StorageObject(
kind = kind,
id = id,
name = name,
bucket = bucket,
generation = generation,
contentType = contentType,
maybeContentType = Option(contentType),
size = size,
etag = etag,
md5Hash = md5Hash,
maybeMd5Hash = Option(md5Hash),
crc32c = crc32c,
maybeCrc32c = Option(crc32c),
mediaLink = mediaLink,
selfLink = selfLink,
updated = updated,
timeCreated = timeCreated,
timeDeleted = Some(timeCreated),
storageClass = storageClass,
maybeStorageClass = Option(storageClass),
contentDisposition = contentDisposition,
contentEncoding = contentEncoding,
contentLanguage = contentLanguage,
metageneration = metageneration,
temporaryHold = temporaryHold,
eventBasedHold = eventBasedHold,
retentionExpirationTime = retentionExpirationTime,
timeStorageClassUpdated = timeStorageClassUpdated,
cacheControl = cacheControl,
customTime = customTime,
metadata = metadata,
componentCount = componentCount,
kmsKeyName = kmsKeyName,
customerEncryption = customerEncryption,
owner = owner,
acl = acl
)
override def toString =
"StorageObject(" +
s"kind=$kind," +
s"id=$id," +
s"name=$name," +
s"bucket=$bucket," +
s"generation=$generation," +
s"contentType=$contentType," +
s"size=$size," +
s"etag=$etag," +
s"md5Hash=$md5Hash," +
s"crc32c=$crc32c," +
s"mediaLink=$mediaLink," +
s"selfLink=$selfLink," +
s"updated=$updated," +
s"timeCreated=$timeCreated," +
timeDeleted.fold("")(td => s"timeDeleted=$td,") +
s"storageClass=$storageClass," +
s"contentDisposition=$contentDisposition," +
s"contentEncoding=$contentEncoding," +
s"contentLanguage=$contentLanguage" +
s"metageneration = $metageneration," +
s"temporaryHold = $temporaryHold," +
s"eventBasedHold = $eventBasedHold," +
s"retentionExpirationTime = $retentionExpirationTime," +
s"timeStorageClassUpdated = $timeStorageClassUpdated," +
s"cacheControl = $cacheControl," +
s"customTime = $customTime,"
metadata.fold("")(m => s"metadata = $m,") +
componentCount.fold("")(cc => s"componentCount = $cc,") +
kmsKeyName.fold("")(kkn => s"kmsKeyName = $kkn,") +
customerEncryption.fold("")(ce => s"customerEncryption = $ce,") +
owner.fold("")(o => s"owner = $o,") +
acl.fold("")(acls => acls.mkString("[", ",", "],")) +
")"
override def equals(other: Any): Boolean = other match {
case that: StorageObject =>
java.util.Objects.equals(this.kind, that.kind) &&
java.util.Objects.equals(this.id, that.id) &&
java.util.Objects.equals(this.name, that.name) &&
java.util.Objects.equals(this.bucket, that.bucket) &&
java.util.Objects.equals(this.generation, that.generation) &&
java.util.Objects.equals(this.contentType, that.contentType) &&
java.util.Objects.equals(this.size, that.size) &&
java.util.Objects.equals(this.etag, that.etag) &&
java.util.Objects.equals(this.md5Hash, that.md5Hash) &&
java.util.Objects.equals(this.crc32c, that.crc32c) &&
java.util.Objects.equals(this.mediaLink, that.mediaLink) &&
java.util.Objects.equals(this.selfLink, that.selfLink) &&
java.util.Objects.equals(this.updated, that.updated) &&
java.util.Objects.equals(this.timeCreated, that.timeCreated) &&
java.util.Objects.equals(this.timeDeleted, that.timeDeleted) &&
java.util.Objects.equals(this.storageClass, that.storageClass) &&
java.util.Objects.equals(this.contentDisposition, that.contentDisposition) &&
java.util.Objects.equals(this.contentEncoding, that.contentEncoding) &&
java.util.Objects.equals(this.contentLanguage, that.contentLanguage) &&
java.util.Objects.equals(this.metageneration, that.metageneration) &&
java.util.Objects.equals(this.temporaryHold, that.temporaryHold) &&
java.util.Objects.equals(this.eventBasedHold, that.eventBasedHold) &&
java.util.Objects.equals(this.retentionExpirationTime, that.retentionExpirationTime) &&
java.util.Objects.equals(this.timeStorageClassUpdated, that.timeStorageClassUpdated) &&
java.util.Objects.equals(this.cacheControl, that.cacheControl) &&
java.util.Objects.equals(this.customTime, that.customTime) &&
java.util.Objects.equals(this.metadata, that.metadata) &&
java.util.Objects.equals(this.componentCount, that.componentCount) &&
java.util.Objects.equals(this.kmsKeyName, that.kmsKeyName)
java.util.Objects.equals(this.customerEncryption, that.customerEncryption)
java.util.Objects.equals(this.owner, that.owner)
java.util.Objects.equals(this.acl, that.acl)
case _ => false
}
override def hashCode(): Int =
java.util.Objects.hash(
kind,
id,
name,
bucket,
Long.box(generation),
contentType,
Long.box(size),
etag,
md5Hash,
crc32c,
mediaLink,
selfLink,
updated,
timeCreated,
timeDeleted,
storageClass,
contentDisposition,
contentEncoding,
contentLanguage,
Long.box(metageneration),
temporaryHold.map(Boolean.box),
eventBasedHold.map(Boolean.box),
retentionExpirationTime,
timeStorageClassUpdated,
cacheControl,
customTime,
metadata,
componentCount.map(Int.box),
kmsKeyName,
customerEncryption,
owner,
acl
)
}
object StorageObject {
/** Scala API */
def apply(
kind: String,
id: String,
name: String,
bucket: String,
generation: Long,
contentType: ContentType,
size: Long,
etag: String,
md5Hash: String,
maybeMd5Hash: Option[String],
crc32c: String,
maybeCrc32c: Option[String],
mediaLink: String,
selfLink: String,
updated: OffsetDateTime,
timeCreated: OffsetDateTime,
timeDeleted: Option[OffsetDateTime],
storageClass: String,
maybeStorageClass: Option[String],
contentDisposition: Option[String],
contentEncoding: Option[String],
contentLanguage: Option[String],
metageneration: Long,
temporaryHold: Option[Boolean],
eventBasedHold: Option[Boolean],
retentionExpirationTime: Option[OffsetDateTime],
timeStorageClassUpdated: OffsetDateTime,
cacheControl: Option[String],
customTime: Option[OffsetDateTime],
metadata: Option[Map[String, String]],
componentCount: Option[Int],
kmsKeyName: Option[String],
customerEncryption: Option[CustomerEncryption],
owner: Option[Owner],
acl: Option[List[ObjectAccessControls]]
): StorageObject = new StorageObject(
kind,
id,
name,
bucket,
generation,
contentType,
Option(contentType),
size,
etag,
md5Hash,
Option(md5Hash),
crc32c,
Option(crc32c),
mediaLink,
selfLink,
updated,
timeCreated,
timeDeleted,
storageClass,
Option(storageClass),
contentDisposition,
contentEncoding,
contentLanguage,
metageneration,
temporaryHold,
eventBasedHold,
retentionExpirationTime,
timeStorageClassUpdated,
cacheControl,
customTime,
metadata,
componentCount,
kmsKeyName,
customerEncryption,
owner,
acl
)
/** Java API */
def create(
kind: String,
id: String,
name: String,
bucket: String,
generation: Long,
contentType: akka.http.javadsl.model.ContentType,
size: Long,
etag: String,
md5Hash: String,
crc32c: String,
mediaLink: String,
selfLink: String,
updated: OffsetDateTime,
timeCreated: OffsetDateTime,
timeDeleted: Optional[OffsetDateTime],
storageClass: String,
contentDisposition: Optional[String],
contentEncoding: Optional[String],
contentLanguage: Optional[String],
metageneration: Long,
temporaryHold: Optional[Boolean],
eventBasedHold: Optional[Boolean],
retentionExpirationTime: Optional[OffsetDateTime],
timeStorageClassUpdated: OffsetDateTime,
cacheControl: Optional[String],
customTime: Optional[OffsetDateTime],
metadata: Optional[Map[String, String]],
componentCount: Optional[Int],
kmsKeyName: Optional[String],
customerEncryption: Optional[CustomerEncryption],
owner: Optional[Owner],
acl: Optional[List[ObjectAccessControls]]
): StorageObject = new StorageObject(
kind,
id,
name,
bucket,
generation,
contentType.asInstanceOf[ContentType],
contentType.asInstanceOf[Option[ContentType]],
size,
etag,
md5Hash,
Option(md5Hash),
crc32c,
Option(crc32c),
mediaLink,
selfLink,
updated,
timeCreated,
timeDeleted.asScala,
storageClass,
Option(storageClass),
contentDisposition.asScala,
contentEncoding.asScala,
contentLanguage.asScala,
metageneration,
temporaryHold.asScala,
eventBasedHold.asScala,
retentionExpirationTime.asScala,
timeStorageClassUpdated,
cacheControl.asScala,
customTime.asScala,
metadata.asScala,
componentCount.asScala,
kmsKeyName.asScala,
customerEncryption.asScala,
owner.asScala,
acl.asScala
)
}
```
|
```java
package com.stx.xhb.xbanner.transformers;
/**
* Created by jxnk25 on 2016/10/18.
* link path_to_url
* email xhb_199409@163.com
* github: path_to_url
* description
*/
public enum Transformer {
Default,
Alpha,
Rotate,
Cube,
Flip,
Accordion,
ZoomFade,
ZoomCenter,
ZoomStack,
Stack,
Depth,
Zoom,
Scale,
OverLap
}
```
|
```c++
// UpdateCallbackFar.cpp
#include "StdAfx.h"
#ifndef _7ZIP_ST
#include "../../../Windows/Synchronization.h"
#endif
#include "../../../Common/StringConvert.h"
#include "FarUtils.h"
#include "UpdateCallbackFar.h"
using namespace NWindows;
using namespace NFar;
#ifndef _7ZIP_ST
static NSynchronization::CCriticalSection g_CriticalSection;
#define MT_LOCK NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
#else
#define MT_LOCK
#endif
static HRESULT CheckBreak2()
{
return WasEscPressed() ? E_ABORT : S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::ScanProgress(UInt64 numFolders, UInt64 numFiles, UInt64 totalSize, const wchar_t *path, Int32 /* isDir */)
{
MT_LOCK
if (_percent)
{
_percent->FilesTotal = numFolders + numFiles;
_percent->Total = totalSize;
_percent->Command = "Scanning";
_percent->FileName = path;
_percent->Print();
_percent->Print();
}
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::ScanError(const wchar_t *path, HRESULT errorCode)
{
if (ShowSysErrorMessage(errorCode, path) == -1)
return E_ABORT;
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::SetNumFiles(UInt64 numFiles)
{
MT_LOCK
if (_percent)
{
_percent->FilesTotal = numFiles;
_percent->Print();
}
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::SetTotal(const UInt64 * /* files */, const UInt64 * /* bytes */)
{
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::SetCompleted(const UInt64 * /* files */, const UInt64 * /* bytes */)
{
MT_LOCK
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::SetTotal(UInt64 size)
{
MT_LOCK
if (_percent)
{
_percent->Total = size;
_percent->Print();
}
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::SetCompleted(const UInt64 *completeValue)
{
MT_LOCK
if (_percent)
{
if (completeValue)
_percent->Completed = *completeValue;
_percent->Print();
}
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::CompressOperation(const wchar_t *name)
{
MT_LOCK
if (_percent)
{
_percent->Command = "Adding";
_percent->FileName = name;
_percent->Print();
}
return CheckBreak2();;
}
STDMETHODIMP CUpdateCallback100Imp::DeleteOperation(const wchar_t *name)
{
MT_LOCK
if (_percent)
{
_percent->Command = "Deleting";
_percent->FileName = name;
_percent->Print();
}
return CheckBreak2();;
}
STDMETHODIMP CUpdateCallback100Imp::OperationResult(Int32 /* opRes */)
{
MT_LOCK
if (_percent)
{
_percent->Files++;
}
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::UpdateErrorMessage(const wchar_t *message)
{
MT_LOCK
if (g_StartupInfo.ShowErrorMessage(UnicodeStringToMultiByte(message, CP_OEMCP)) == -1)
return E_ABORT;
return CheckBreak2();
}
HRESULT CUpdateCallback100Imp::OpenFileError(const wchar_t *path, HRESULT errorCode)
{
if (ShowSysErrorMessage(errorCode, path) == -1)
return E_ABORT;
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::ReadingFileError(const wchar_t *path, HRESULT errorCode)
{
if (ShowSysErrorMessage(errorCode, path) == -1)
return E_ABORT;
return CheckBreak2();
}
void SetExtractErrorMessage(Int32 opRes, Int32 encrypted, AString &s);
STDMETHODIMP CUpdateCallback100Imp::ReportExtractResult(Int32 opRes, Int32 isEncrypted, const wchar_t *name)
{
MT_LOCK
if (opRes != NArchive::NExtract::NOperationResult::kOK)
{
AString s;
SetExtractErrorMessage(opRes, isEncrypted, s);
if (PrintErrorMessage(s, name) == -1)
return E_ABORT;
}
return CheckBreak2();
}
STDMETHODIMP CUpdateCallback100Imp::ReportUpdateOperation(UInt32 op, const wchar_t *name, Int32 /* isDir */)
{
const char *s;
switch (op)
{
case NUpdateNotifyOp::kAdd: s = "Adding"; break;
case NUpdateNotifyOp::kUpdate: s = "Updating"; break;
case NUpdateNotifyOp::kAnalyze: s = "Analyzing"; break;
case NUpdateNotifyOp::kReplicate: s = "Replicating"; break;
case NUpdateNotifyOp::kRepack: s = "Repacking"; break;
case NUpdateNotifyOp::kSkip: s = "Skipping"; break;
case NUpdateNotifyOp::kHeader: s = "Header creating"; break;
case NUpdateNotifyOp::kDelete: s = "Deleting"; break;
default: s = "Unknown operation";
}
MT_LOCK
if (_percent)
{
_percent->Command = s;
_percent->FileName.Empty();
if (name)
_percent->FileName = name;
_percent->Print();
}
return CheckBreak2();;
}
extern HRESULT GetPassword(UString &password);
STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword(BSTR *password)
{
MT_LOCK
*password = NULL;
if (!PasswordIsDefined)
{
RINOK(GetPassword(Password));
PasswordIsDefined = true;
}
return StringToBstr(Password, password);
}
STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
{
MT_LOCK
*password = NULL;
*passwordIsDefined = BoolToInt(PasswordIsDefined);
if (!PasswordIsDefined)
return S_OK;
return StringToBstr(Password, password);
}
```
|
```python
import weaviate.classes as wvc
from .conftest import CollectionFactory
def test_ref_with_cycle(collection_factory: CollectionFactory) -> None:
col = collection_factory(
properties=[wvc.config.Property(name="name", data_type=wvc.config.DataType.TEXT)],
vectorizer_config=wvc.config.Configure.Vectorizer.none(),
)
col.config.add_reference(wvc.config.ReferenceProperty(name="ref", target_collection=col.name))
a = col.data.insert(properties={"name": "A"})
b = col.data.insert(properties={"name": "B"}, references={"ref": a})
col.data.reference_add(from_uuid=a, from_property="ref", to=b)
ret = col.query.fetch_objects(
return_references=[
wvc.query.QueryReference(
link_on="ref",
return_properties="name",
return_references=[
wvc.query.QueryReference(
link_on="ref",
return_properties="name",
return_metadata=wvc.query.MetadataQuery.full(),
)
],
return_metadata=wvc.query.MetadataQuery.full(),
),
],
).objects
ret = sorted(ret, key=lambda x: x.properties["name"])
assert ret[0].properties["name"] == "A"
assert ret[1].properties["name"] == "B"
assert ret[0].references["ref"].objects[0].properties["name"] == "B"
assert ret[1].references["ref"].objects[0].properties["name"] == "A"
def test_ref_with_multiple_cycle(collection_factory: CollectionFactory) -> None:
col = collection_factory(
properties=[wvc.config.Property(name="name", data_type=wvc.config.DataType.TEXT)],
vectorizer_config=wvc.config.Configure.Vectorizer.none(),
)
col.config.add_reference(wvc.config.ReferenceProperty(name="ref", target_collection=col.name))
# Add objects with two cyclic paths
# c => b => a => c
# c => a => c
a = col.data.insert(properties={"name": "A"})
b = col.data.insert(properties={"name": "B"}, references={"ref": a})
c = col.data.insert(properties={"name": "C"}, references={"ref": [b, a]}) # has two refs
col.data.reference_add(from_uuid=a, from_property="ref", to=c)
ret = col.query.fetch_objects(
return_references=[
wvc.query.QueryReference(
link_on="ref",
return_properties=["name"],
return_references=[
wvc.query.QueryReference(
link_on="ref",
return_properties="name",
return_metadata=wvc.query.MetadataQuery.full(),
return_references=[
wvc.query.QueryReference(
link_on="ref",
return_properties="name",
return_metadata=wvc.query.MetadataQuery.full(),
)
],
)
],
return_metadata=wvc.query.MetadataQuery.full(),
),
],
).objects
# both paths are resolved correctly
ret = sorted(ret, key=lambda x: x.properties["name"])
assert ret[0].properties["name"] == "A"
assert ret[1].properties["name"] == "B"
assert ret[2].properties["name"] == "C"
assert ret[0].references["ref"].objects[0].properties["name"] == "C"
assert ret[1].references["ref"].objects[0].properties["name"] == "A"
ret2_objects = sorted(ret[2].references["ref"].objects, key=lambda x: x.properties["name"])
assert ret2_objects[0].properties["name"] == "A"
assert ret2_objects[1].properties["name"] == "B"
```
|
```xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppCompatAlertDialogStyleLight" parent="Theme.AppCompat.Light.Dialog.Alert">
</style>
<style name="AppCompatAlertDialogStyleDark" parent="Theme.AppCompat.Dialog.Alert">
</style>
<style name="AppCompatDialogStyleLight" parent="Theme.AppCompat.Light.Dialog">
</style>
<style name="AppCompatDialogStyleDark" parent="Theme.AppCompat.Dialog">
</style>
<!-- ActionBar styles -->
<style name="TextSecure.DarkActionBar"
parent="@style/Widget.AppCompat.ActionBar">
<item name="background">@color/gray95</item>
<item name="elevation">4dp</item>
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
<item name="titleTextStyle">@style/TextSecure.TitleTextStyle</item>
<item name="subtitleTextStyle">@style/TextSecure.SubtitleTextStyle</item>
<item name="android:textColorSecondary">@color/white</item>
</style>
<style name="TextSecure.LightActionBar"
parent="@style/Widget.AppCompat.ActionBar">
<item name="background">@color/delta_primary</item>
<item name="elevation">4dp</item>
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
<item name="titleTextStyle">@style/TextSecure.TitleTextStyle</item>
<item name="subtitleTextStyle">@style/TextSecure.SubtitleTextStyle</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColorSecondary">@color/white</item>
</style>
<style name="TextSecure.DarkActionBar.TabBar"
parent="@style/Widget.AppCompat.ActionBar.TabBar">
<item name="background">@color/gray95</item>
<item name="android:background">@color/gray95</item>
<item name="elevation">4dp</item>
</style>
<style name="TextSecure.LightActionBar.TabBar"
parent="@style/Widget.AppCompat.ActionBar.TabBar">
<item name="android:background">@color/delta_primary</item>
<item name="background">@color/delta_primary</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColorSecondary">#BFffffff</item>
<item name="elevation">4dp</item>
</style>
<style name="TextSecure.TitleTextStyle" parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/white</item>
<item name="android:textColorHint">#BFffffff</item>
<item name="android:textSize">20dp</item>
</style>
<style name="TextSecure.SubtitleTextStyle" parent="TextAppearance.AppCompat.Widget.ActionBar.Subtitle">
<item name="android:textColor">#BFffffff</item>
</style>
<!-- For Holo Light Dialog Activity Styling Emulation -->
<style name="ComposeEditText" parent="@style/Signal.Text.Body">
<item name="android:padding">2dp</item>
<item name="android:background">@null</item>
<item name="android:maxLines">5</item>
<item name="android:maxLength">64000</item>
<item name="android:textColor">?conversation_item_outgoing_text_primary_color</item>
<item name="android:capitalize">sentences</item>
<item name="android:autoText">true</item>
<item name="android:gravity">center_vertical</item>
<item name="android:imeOptions">flagNoEnterAction</item>
<item name="android:inputType">textAutoCorrect|textCapSentences|textMultiLine</item>
<item name="android:contentDescription">@string/chat_input_placeholder</item>
</style>
<style name="AttachmentTypeLabel">
<item name="android:textColor">#ff999999</item>
<item name="android:textSize">14sp</item>
</style>
<style name="ButtonPrimary">
<item name="drawableTint">@color/white</item>
<item name="android:textColor">@color/white</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">8dp</item>
<item name="android:background">@drawable/button_background</item>
</style>
<style name="ButtonSecondary">
<item name="drawableTint">?attr/secondary_button_fg</item>
<item name="android:textColor">?attr/secondary_button_fg</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">8dp</item>
<item name="android:background">@drawable/button_secondary_background</item>
</style>
<style name="PreferenceThemeOverlay.Fix" parent="PreferenceThemeOverlay.v14.Material">
</style>
<style name="NoMessagesTextView">
<item name="android:textColor">?attr/conversation_item_update_text_color</item>
<item name="android:textSize">16sp</item>
<item name="android:background">@drawable/conversation_item_update_background</item>
<item name="android:layout_marginLeft">12dp</item>
<item name="android:layout_marginRight">12dp</item>
<item name="android:padding">12dp</item>
</style>
<style name="SwitchTheme" parent="Theme.AppCompat.Light">
<item name="colorControlActivated">#ff2090ea</item>
</style>
<style name="ShapeAppearanceOverlay.App.CornerSize10Percent" parent="">
<item name="cornerSize">7%</item>
</style>
</resources>
```
|
```smalltalk
// The .NET Foundation licenses this file to you under the MIT license.
using Xunit;
namespace Microsoft.TemplateEngine.Utils.UnitTests
{
public class EqualityExtensionsTests
{
[Fact(DisplayName = "AllAreTheSameDefaultComparerTrueTest")]
public void AllAreTheSameDefaultComparerTrueTest()
{
IDictionary<int, string> items = new Dictionary<int, string>()
{
{ 1, "this" },
{ 2, "this" },
{ 3, "this" },
{ 4, "this" }
};
static string Selector(KeyValuePair<int, string> x) => x.Value;
Assert.True(items.AllAreTheSame(Selector));
}
[Fact(DisplayName = "AllAreTheSameDefaultComparerFailsTest")]
public void AllAreTheSameDefaultComparerFailsTest()
{
IDictionary<int, string> items = new Dictionary<int, string>()
{
{ 1, "this" },
{ 2, "that" },
{ 3, "other" },
{ 4, "thing" }
};
static string Selector(KeyValuePair<int, string> x) => x.Value;
Assert.False(items.AllAreTheSame(Selector));
}
[Fact(DisplayName = "AllAreTheSameCustomComparerTest")]
public void AllAreTheSameCustomComparerTest()
{
IDictionary<int, string> items = new Dictionary<int, string>()
{
{ 1, "this" },
{ 2, "that" },
{ 3, "four" },
{ 4, "long" }
};
static string Selector(KeyValuePair<int, string> x) => x.Value;
static bool LengthComparer(string? x, string? y) => x!.Length == y!.Length;
// they're all the same length
Assert.True(items.AllAreTheSame(Selector, LengthComparer));
static bool UpperComparer(string? x, string? y) => x!.ToUpper() == y!.ToUpper();
Assert.False(items.AllAreTheSame(Selector, UpperComparer));
}
}
}
```
|
The Ghana Nurse and Midwife Trainees Association (GNMTA) is the official umbrella association of all nursing students and midwives in the republic of Ghana. It is affiliated to the Ghana Registered Nurses Association (GRNA).
About
The Ghana Nurse and Midwife Trainees Association is the official voice of student nurses and midwives including interns in Ghana. The association covers all issues pertaining to welfare, discipline, and academics. The association is organized under national, zonal and local sectors with responsible executives at each level. GNMTA's membership consists of about three thousand nurses and midwives including students and interns.
History
Though student unions of nurses and midwives have existed from the inception of nursing training in Ghana, GNMTA was officially registered in September 2007 under the provisions of Sections 27 and 28 of the companies code of the republic of Ghana.
References
2007 establishments in Ghana
Nursing organizations
Medical and health organisations based in Ghana
Midwifery organizations
|
The Kingdom of Etruria ( ; ) was an Italian kingdom between 1801 and 1807 that made up a large part of modern Tuscany. It took its name from Etruria, the old Roman name for the land of the Etruscans.
History
The kingdom was created by the Treaty of Aranjuez, signed at Aranjuez, Spain on 21 March 1801. In the context of a larger agreement between Napoleonic France and Spain, the Bourbons of Parma were compensated for the loss of their territory in northern Italy (which had been occupied by French troops since 1796). The King of Spain decided that his cousin Ferdinand, Duke of Parma had to cede his duchy to France, and in return his son Louis I was granted the Kingdom of Etruria (which was created from the Grand Duchy of Tuscany). Shortly after Ferdinand refused to leave, he suddenly died in suspect circumstances. To make way for the Bourbons, the Habsburg Grand Duke of Tuscany Ferdinand III was ousted and compensated with the Electorate of Salzburg by the Treaty of Lunéville.
Outside the Treaty of Aranjuez, Spain also secretly agreed to retrocede the Louisiana territory (over 2 million square kilometers) back to France in order to secure the Kingdom of Etruria as a client state for Spain; Louisiana was first ceded by France to Spain in 1763 at the end of the Seven Years' War. Louisiana was duly transferred to France on 15 October 1802, after the signing of the Treaty of Aranjuez. Napoleon subsequently sold Louisiana to the United States in the Louisiana Purchase on April 30, 1803, in order to pay for his French armies during the War of the Third Coalition.
The first king (Louis I) died young in 1803, and his underage son Charles Louis succeeded him. His mother, Maria Luisa of Spain, was appointed regent. However, since Etruria was troubled with smuggling and espionage, Napoleon annexed the territory, thus it was the last non-Bonaparte Italian kingdom on the Peninsula to be absorbed into the French Empire. Since Spain's only hope of compensation lay in Portugal, co-operation with the emperor became more important.
In 1807, Napoleon dissolved the kingdom and integrated it into France, turning it into three French départements: Arno, Méditerranée and Ombrone. The king and his mother were promised the throne of a new Kingdom of Northern Lusitania (in northern Portugal), but this plan was never realized due to the break between Napoleon and the Spanish Bourbons in 1808. After his downfall in 1814, Tuscany was restored to its Habsburg grand dukes. In 1815, the Duchy of Lucca was carved out of Tuscany, on the lands of the former Republic of Lucca, as compensation for the Bourbons of Parma until they resumed their rule in 1847. As stipulated in the Treaty of Paris of 1817, in execution of the art. 99 of the Final Act of the Congress of Vienna, the Duchy of Lucca was then annexed by the Grand Duchy of Tuscany.
Flags and coats of arms
References
Works cited
Former kingdoms
History of Florence
History of Tuscany
1800s in Italy
1800s in the Grand Duchy of Tuscany
States and territories established in 1801
States and territories disestablished in 1807
1801 establishments in Italy
1807 disestablishments in Italy
1801 establishments in Europe
1807 disestablishments in Europe
19th century in the Grand Duchy of Tuscany
Former monarchies of Europe
|
Street Lights is a 2018 Indian Malayalam-language thriller film directed by cinematographer Shamdat in his directorial debut. The film is produced by Mammootty under his banner Playhouse Motion Pictures and starring himself alongside a different supporting cast in each language. The film features Soubin Shahir, Dharmajan Bolgatty, Hareesh Perumanna, and Lijomol Jose, who play pivotal roles in Malayalam. The film was simultaneously shot in Tamil with Prithvi Rajan, Pandi, Pandiarajan, and Sreeram playing pivotal roles.
The principal photography began on 24 March 2017 and was conducted in Kochi, Pollachi, and Chennai. Malayalam version was released on 26 January 2018.
Plot
This film begins with a chase scene where two security guards are chasing two thieves wearing masks, catching up to them only to be beaten down by a third thief. They return to their hideout to reveal that they were unable to crack the safe but were able to yank off a rare Rs. 5 crore (or $724,000) necklace off of the homeowner’s neck. The homeowners call their nephew James, who is a police detective, investigates it. The thieves are chased by the police and Sachi the second thief hides it in a bag. The bag is later taken by Mani, a boy. Soon after the chase James reveals that Murugan the third thief is a notorious criminal with a grudge on James as he killed Murugan's elder brother Manimaran. Finally the necklace reaches James and James catches Murugan and kills him.
Cast
Malayalam version:
Mammootty as CI James
Soubin Shahir as Subin
Lijomol Jose as Remya
Gayathri Krishnaa as Jenny
Hareesh Perumanna as Raj
Dharmajan Bolgatty as Sachi
Jude Anthany Joseph as Peeyush
Rajendran as Manimaran
Stunt Silva as Murugan/Murugeshan
Adhish Praveen as Mani
Rony David as SI Issac
Rajasekharan as SI Moorthy
Nandhu as Remya's Father
Joy Mathew as Simon Mundakal
Semmalar Annam as Malar, mother of Mani (Aadhish)
Sudhi Koppa as Thotti Sibi
Neena Kurup as Maria
Sohan Seenulal
Daya Ashwathy
Tamil version:
Prithvi Rajan
Lijomol Jose
Pandi
Sree Raam
Pandiarajan
Manobala
Rajendran
Stunt Silva
Rajasekharan
Production
Development
Cinematographer Shamdat is marking his directorial debut. Eager to direct a film, he watched many short films, and one of them led him into contacting its maker Fawaz Mohamed. After Shamdat told his idea to Fawaz, Fawaz developed the content into a story within a week. In 2016, Shamdat narrated the story to Mammootty at the sets of The Great Father, which he agreed to act and to produce. Originally scripted in Malayalam, the story featuring a certain Tamil-speaking characters and portions to be set in Tamil Nadu prompted the makers to make the film in Tamil also. Shamdat's initial idea of different production of film, as first in Malayalam and Tamil thereafter, was advanced to the simultaneous filming of both versions, since Mammootty was ready to finance also the Tamil version. Dialogues for Tamil version were written by Shamdat himself, while Malayalam dialogues along with script are credited to Fawaz Mohamed, who is also debutant. Shamdat does not include the film in any specific genre such as action, crime or suspense, and wants to call it an "entertainment thriller".
Casting and filming
The principal photography began on 24 March 2017 in Kochi, planned to be completed in a single schedule. Shamdat's brother Sadat Sainudeen was the cinematography. Mammootty had allotted his 20 days of date. An accident occurred during filming of a fight sequence held at Mattancherry, causing Vishnu Unnikrishnan an injury to his right hand wrist. He was prescribed two weeks' rest by the doctors and, subsequently, was replaced by Dharmajan Bolgatty. Lijomol Jose was offered a role by Shamdat during the shooting of her film Kattappanayile Rithwik Roshan. In Tamil version, a prominent role is played by Prithvi Rajan, who is placed at the way of a probe conducted by Mammootty, with few collaboration scenes between them, while he also leads a romantic comedy track, paired with Lijomol's character. Rajan's father, Pandiarajan, also plays an important role. Stunt choreographer Stunt Silva was cast for the antagonist, whose real looks and style were retained for the character.
In the case of filming, Tamil scenes were shot first, followed by Malayalam. In order to minimize the production cost and expedite the filming, only perfected shots based on finalized script were taken, and big monitors and crew were avoided. Filming was done with camera hidden at places like bus stands. Sound design was by Renganaath Ravee; sounds taken from day and night were used in the film. Tamil version is based in Chennai. According to the director, both versions were treated differently, in such a way that Malayalam features more humour while Tamil a serious narrative. Filming of both films completed in 35 days. In November 2017, the makers also planned to dub the film into Telugu. Mammootty himself dubbed in three languages.
Release
In November 2017, it was reported that release of the film is rescheduled to January 2018 because of the Telugu dubbing works. Malayalam version was released on 26 January 2018 in India and GCC countries.
Soundtrack
Adarsh Abraham who was a programmer under Ouseppachan debuted as composer in the film, which comprises four songs. Neha Nair and Yakzan Gary Pereira duo composed film's score.
References
External links
(Malayalam)
(Tamil)
2018 films
2010s Tamil-language films
Indian multilingual films
Indian thriller films
Films shot in Kochi
Films shot in Pollachi
Films shot in Chennai
2018 multilingual films
2018 thriller films
2010s Malayalam-language films
|
Prays fraxinella, also known as the ash bud moth, is a moth of the family Plutellidae found in Europe. The larvae are leaf miners, feeding on the leaves and buds of ash trees.
Description
The wingspan is 14–18 mm. The head is white or greyish ochreous. Forewings are white or greyish-ochreous; some blackish dorsal strigulae; a triangular blackish blotch, lighter or mixed with whitish on costa, extending along costa from near base to 2/3; some irregular blackish marks towards termen; sometimes the whole wing is unicolorous dark fuscous. Hind wings are rather dark grey. The larva is greenish, marbled with red -brown above; dorsal line deep green; head pale brown, dark-spotted; 2 with two black spots.
Adults are on wing from May to June and again in August in two generations depending on the location.
Prays fraxinella has two colour forms, the typical white and black colouration and the melanic form f.rustica.
Recently, the form f.rustica, that has an orange head has been separated into an entirely new species, Prays ruficeps.
Ovum
Eggs are laid on the twigs of ash (Fraxinus excelsior) and manna ash (Fraxinus ornus) in June and July.
Larva
When fully fed the larvae are 12 mm long and the body is greenish, with the head brown with black spots. As a juvenile leaf miner, the body is yellowish with a black head and anal plate, and as a bark miner the body is whitish.
The mine consists of an irregular small corridor with dispersed black frass. The corridor can widen into an irregular blotch with less frass. Mines begin at the site of the egg shell, but the larvae can leave this mine and start a new one elsewhere in the leaf. In the latter case the corridor begins with a small round opening. In the autumn, before the leaf is shed, larvae leave the mines and bore into the bark, where it hibernates. After hibernation they live as a bark miner and frass can be seen between the buds. As the larvae hollows out the shoot, it causes the leaves to droop. Sometimes, they feed externally in a loose spinning.
Pupa
The larvae pupate in an open network cocoon and can be found in May or June.
Gallery
References
Bjerkander, C. (1784) Insect-Calender, for år 1784. Kongl. Vetenskaps Academiens nya Handlingar 5: 319–329. Stockholm (Johan Georg Lange).
Millard, P. (2013) Prays fraxinella (Bjerkander) (Lep.: Praydidae) is not monophagous on Ash. The Entomologist's Record and Journal of Variation 125 (5): 171.
Stainton, H. T. (1870) The natural history of the Tineina 11: I-XIII, 1-330, pl. I-VIII. London (John van Voorst) – Paris (Deyrolle) – Berlin (E. S. Mittler und Sohn). as Prays curtisellus.
External links
Swedish Moths
Plutellidae
Leaf miners
Moths described in 1784
Moths of Asia
Moths of Europe
Taxa named by Clas Bjerkander
|
Mokhtar Naili (; born 3 September 1953) is a Tunisian former footballer who played as a goalkeeper for Club Africain and the Tunisia national team. He played in all three of Tunisia's matches at the 1978 FIFA World Cup.
References
1953 births
Living people
Tunisian men's footballers
Men's association football goalkeepers
Tunisia men's international footballers
Club Africain players
1978 FIFA World Cup players
1982 African Cup of Nations players
|
Extremis is a 2016 American short documentary that follows Dr. Jessica Zitter, an ICU and palliative care specialist who leads a team in the Highland Hospital ICU in Oakland, California. She helps families make end-of-life decisions for their loved ones, who are often terminally ill and or on life support. It is directed and produced by Dan Krauss. It was shot at an intensive care unit at Highland Hospital in Oakland, California. The film was funded, in part, by physician and end of life advocate, Dr. Shoshana R. Ungerleider. There are five patients shown in the documentary; however, it only focuses on three patients.
Plot
Dr. Jessica Zitter graduated from Harvard and is an attending physician at Highland Hospital on Oakland, California. Aside from working at the hospital, she has published many articles as well as her own book, "Extreme Measures: Finding a Better Path to the End of Life". Her work is focused on end of life care and how to improve it. The documentary begins as Zitter attempts to communicate with a patient named Donna who has myotonic dystrophy. Because of her breathing tube and other equipment attached to her it is very difficult for Donna to communicate. At that moment, Zitter had to sympathize and try to make the patient as comfortable as possible while trying to figure out a way to help her communicate. As the doctors search for a specialist and other options, Donna's condition deteriorates, and her family decides to take her off the breathing tube. One day later, Donna dies.
After Donna, the film introduces Selena, who stopped breathing on the way to the ER and suffered severe brain damage. Unlike Donna's family, Selena's daughter is not ready to let her go and clings on to hope. In this case the doctors attempt to reason with Selena's daughter to let her know that Selena will not recover. When interviewed, Selena's daughter said that turning off her mother's life support would feel like murder. Selena was kept on life support and regained periods of consciousness, but died six months later.
The next patient shown is a homeless man who had been institutionalized for a long time and the doctors had not yet made a prognosis. This patient did not have any family or friends to make the medical decisions for him if anything happened, and when it comes to this the doctors have to question whether the patient seems stable enough to decide for himself. The film shows the doctors trying to communicate with the patient.
The other two patients are not named. One is a new grandmother, whose family decides to take her off all machines. The other patient is a man who can still communicate but needs to be attached to a life support machine. He expresses his desire not to be kept on the machine and accepts his fate, though his son does not agree with his decision.
Awards
2017: Academy Awards Best Documentary Short Subject Nominated
2016: Tribeca Film Festival - Best Documentary Short - Winner
References
External links
2016 films
2016 short documentary films
American short documentary films
Films directed by Dan Krauss
Netflix original documentary films
2010s English-language films
2010s American films
|
"Hey Baby" is a 1975 rock single from the album Ted Nugent, the first solo release by American guitarist Ted Nugent. The song features lead vocals by rhythm guitarist Derek St. Holmes, and was the only song on the album that St. Holmes wrote and arranged himself.
Charts
See also
1975 in music
Ted Nugent discography
References
1975 songs
1975 singles
Blues rock songs
Epic Records singles
Song recordings produced by Tom Werman
Ted Nugent songs
|
```smalltalk
namespace Ombi.Api.Radarr.Models
{
public class Item
{
public Quality quality { get; set; }
public bool allowed { get; set; }
}
}
```
|
The 1974–75 season was the 60th in the history of the Isthmian League, an English football competition.
Wycombe Wanderers won Division One, while Staines Town won Division Two.
Division One
Division One featured 22 clubs, including 20 clubs from the previous season and two clubs, promoted from Division Two:
Dagenham
Slough Town
League table
Division Two
Division Two expanded up to 18 clubs, including fourteen clubs from the previous season and four new clubs:
Two clubs relegated from Division One:
Corinthian-Casuals
St Albans City
Two clubs switched from the Athenian League:
Boreham Wood
Croydon
League table
References
Isthmian League seasons
I
|
Duban is a crater in the northern hemisphere of Saturn's moon Enceladus. Duban was first seen in Voyager 2 images, though the crater has also been seen in much higher resolution Cassini images. It is located at and is 19 kilometers across. In the Cassini image, evidence for significant tectonic deformation can be seen along the northwest rim of the crater.
Duban is named after a sage who cured King Yunan of leprosy in Arabian Nights.
References
Impact craters on Enceladus
|
```javascript
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
experimental: {
turbo: {
rules: {
'*.test-file.js': {
browser: {
foreign: {
loaders: [
{
loader: require.resolve('./test-file-loader.js'),
options: { browser: true, foreign: true },
},
],
},
default: {
loaders: [
{
loader: require.resolve('./test-file-loader.js'),
options: { browser: true },
},
],
},
},
foreign: false,
default: {
loaders: [
{
loader: require.resolve('./test-file-loader.js'),
options: { default: true },
},
],
},
},
},
},
},
}
module.exports = nextConfig
```
|
```c++
#include <torch/csrc/jit/ir/alias_analysis.h>
#include <ATen/core/interned_strings.h>
#include <c10/util/flat_hash_map.h>
#include <c10/util/irange.h>
#include <torch/csrc/jit/api/function_impl.h>
#include <torch/csrc/jit/jit_log.h>
#include <torch/csrc/jit/passes/inliner.h>
#include <torch/csrc/jit/passes/utils/subgraph_utils.h>
#include <torch/csrc/jit/runtime/operator.h>
#include <fstream>
#include <iostream>
namespace torch::jit {
namespace {
c10::MaybeOwned<TypePtr> toSingleType(const AliasTypeSet& mut_types) {
return mut_types.size() == 1
? c10::MaybeOwned<TypePtr>::borrowed(mut_types[0])
: c10::MaybeOwned<TypePtr>::owned(c10::UnionType::create(mut_types));
}
// This class determines whether a type is mutable, and, if so, it maps
// the type to its "mutable equivalent" (see definition in
// `mapTypeToAliasTypeSet`). It uses a cache of TypePtrs to speed up these
// type lookups
class MutableTypePtrHelper {
public:
explicit MutableTypePtrHelper(
ska::flat_hash_map<TypePtr, AliasTypeSet>* mutable_type_cache)
: mutable_type_cache_(mutable_type_cache) {}
// Map any mutable type to a type such that all other types which the
// mutable type can alias will be mapped to the same type. For
// example, calling this method on `Optional[List[int]]` should be
// the same as calling this method on `List[int]`.
//
// Rules:
// - If the type is not mutable, return `nullopt`
// - If the type is a `Tuple`, that means that it's an immutable
// object that can itself contain mutable objects. We want to make
// sure that the mutable objects are correctly aliased, so we
// remove the immutable objects. (For example,
// `Tuple[int, Tensor]` would become `Tuple[Tensor]`, while
// `Tuple[int, str]` would be returned as `nullopt`.) This is a
// convenience that makes it easy to check if the `Tuple`
// contains only immutable objects, though it's not technically
// necessary
// - For any Tensor type (including Tensor types that are part of
// a larger container, e.g. `List[Tensor]`), return the
// "unshaped" version of that Tensor. An "unshaped" Tensor is a
// Tensor with shape information removed. For example, a Tensor
// of dimension 4 would map to the same type as a Tensor of
// dimension 1. This allows us to treat all subclasses of Tensor
// as a single, homogenous "Tensor" type.
std::optional<AliasTypeSet> mapTypeToAliasTypeSet(const TypePtr& type) {
if (mutable_type_cache_) {
const AliasTypeSet* result = mapTypeToBorrowedAliasTypeSet(type);
if (result) {
return *result;
}
}
return mapTypeToAliasTypeSetImpl(type);
}
const AliasTypeSet* mapTypeToBorrowedAliasTypeSet(const TypePtr& type) {
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(mutable_type_cache_ != nullptr);
auto maybe_type_mapping = mutable_type_cache_->find(type);
if (maybe_type_mapping != mutable_type_cache_->end()) {
return &maybe_type_mapping->second;
}
auto mutable_types = mapTypeToAliasTypeSetImpl(type);
if (mutable_types) {
auto it =
mutable_type_cache_->emplace(type, std::move(*mutable_types)).first;
return &it->second;
} else {
return nullptr;
}
}
private:
std::optional<AliasTypeSet> mapTypeToAliasTypeSetImpl(const TypePtr& type) {
switch (type->kind()) {
case TypeKind::ListType:
case TypeKind::DictType:
case TypeKind::ClassType:
case TypeKind::TensorType:
// TODO: Look up cached contained types. this is kind of tricky
// because a `List[Optional[T]]` should still be
// `List[Optional[Unshaped(T)]]`, but
// `mapTypeToAliasTypeSet(Optional[T])` should be `T`
return AliasTypeSet{unshapedType(type)};
case TypeKind::UnionType: {
AliasTypeSet mutable_types;
for (const TypePtr& inner :
type->expectRef<UnionType>().containedTypes()) {
if (auto maybe_inner_types = mapTypeToAliasTypeSet(inner)) {
mutable_types.insert(
mutable_types.end(),
(*maybe_inner_types).begin(),
(*maybe_inner_types).end());
}
}
if (mutable_types.empty()) {
return std::nullopt;
}
return mutable_types;
}
case TypeKind::OptionalType: {
auto inner = type->castRaw<OptionalType>()->getElementType();
return mapTypeToAliasTypeSet(inner);
}
case TypeKind::AnyType:
return {AliasTypeSet{type}};
case TypeKind::FutureType: {
if (auto maybe_mut_types = mapTypeToAliasTypeSet(
type->castRaw<FutureType>()->getElementType())) {
return {AliasTypeSet{
FutureType::create(*toSingleType(*maybe_mut_types))}};
}
return std::nullopt;
}
case TypeKind::AwaitType: {
if (auto maybe_mut_types = mapTypeToAliasTypeSet(
type->castRaw<AwaitType>()->getElementType())) {
return {
AliasTypeSet{AwaitType::create(*toSingleType(*maybe_mut_types))}};
}
return std::nullopt;
}
case TypeKind::TupleType: {
std::vector<TypePtr> mutable_types;
for (const TypePtr& inner : type->expectRef<TupleType>().elements()) {
if (auto maybe_inner_types = mapTypeToAliasTypeSet(inner)) {
mutable_types.insert(
mutable_types.end(),
(*maybe_inner_types).begin(),
(*maybe_inner_types).end());
}
}
if (mutable_types.empty()) {
return std::nullopt;
}
return {AliasTypeSet{TupleType::create(mutable_types)}};
}
default:
return std::nullopt;
}
}
ska::flat_hash_map<TypePtr, AliasTypeSet>* mutable_type_cache_;
};
bool isMutableTypeImpl(
const TypePtr& type,
ska::flat_hash_map<TypePtr, AliasTypeSet>* mutable_type_cache) {
// Check common cases to avoid recursively constructing type in
// `mapTypeToAliasTypeSetPtrImpl`
auto kind = type->kind();
if (kind == TypeKind::TensorType || kind == TypeKind::ListType ||
kind == TypeKind::ClassType || kind == TypeKind::DictType) {
return true;
}
MutableTypePtrHelper helper(mutable_type_cache);
if (mutable_type_cache) {
return helper.mapTypeToBorrowedAliasTypeSet(type) != nullptr;
} else {
return helper.mapTypeToAliasTypeSet(type).has_value();
}
}
} // namespace
// Static `isMutableType` does not use cache of type -> mutable type equivalent
bool AliasDb::isMutableType(const TypePtr& type) {
return isMutableTypeImpl(type, nullptr);
}
bool AliasDb::isMutableType(const Value* v) {
return isMutableType(v->type());
}
// Make use of type -> mutable cache
bool AliasDb::isMutableTypeInternal(const TypePtr& type) const {
return isMutableTypeImpl(type, &mapped_mutable_types_);
}
bool AliasDb::isMutableTypeInternal(const Value* v) const {
return isMutableTypeInternal(v->type());
}
const AliasTypeSet* AliasDb::mapTypeToAliasTypeSetPtr(
const TypePtr& type) const {
MutableTypePtrHelper helper(&mapped_mutable_types_);
return helper.mapTypeToBorrowedAliasTypeSet(type);
}
AliasDb::~AliasDb() = default;
// Structure used during analysis to keep track of all writes at a high
// level. When the analysis is completed, this will be used to construct
// a more efficient WriteIndex
struct AliasDb::WriteRegistry {
void registerWrite(const Value* v, Node* n) {
writes_[n].emplace_back(v);
}
void registerWriteToAllContained(const Value* v, Node* n) {
containedWrites_[n].emplace_back(v);
}
void registerWriteToAllWildcards(Node* n) {
writesToAllWildcards_.insert(n);
}
std::unordered_map<Node*, std::vector<const Value*>> writes_;
std::unordered_map<Node*, std::vector<const Value*>> containedWrites_;
std::unordered_set<Node*> writesToAllWildcards_;
};
AliasDb::AliasDb(
std::shared_ptr<Graph> graph,
bool isFrozen,
bool descendFunctionCalls)
: graph_(std::move(graph)),
isFrozen_(isFrozen),
descend_function_calls_(descendFunctionCalls),
memoryDAGBuilder_(std::make_unique<MemoryDAGBuilder>()),
writeRegistry_(std::make_unique<AliasDb::WriteRegistry>()) {
analyze(graph_);
memoryDAG_ = std::move(*memoryDAGBuilder_).createMemoryDAG();
// NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
memoryDAGBuilder_ = nullptr; // to make further access a hard error
memoryDAG_->setWildcards(
wildcards_, elementMap_, [&](const Value* v) -> Element* {
return getWildcard(v->type());
});
// Now we build up the various write indices based on information in the write
// registry that we populated during analysis
// Initialize the write index
writeIndex_ = TWriteIndex();
auto& writeIndex = *writeIndex_; // to make operator[] less ugly
// Build the write index
for (const auto& write : writeRegistry_->writes_) {
Node* node = write.first;
const std::vector<const Value*> writtenValues = write.second;
for (const Value* writtenValue : writtenValues) {
auto it = elementMap_.find(writtenValue);
TORCH_INTERNAL_ASSERT(
it != elementMap_.end(), "Tried to write to value not in MemoryDAG");
const auto& writtenMemoryLocations =
memoryDAG_->getMemoryLocations(it->second);
writeIndex[node] |= writtenMemoryLocations;
}
}
for (const auto& write : writeRegistry_->containedWrites_) {
Node* node = write.first;
const std::vector<const Value*>& writtenValues = write.second;
for (const Value* writtenValue : writtenValues) {
auto elem = elementMap_.at(writtenValue);
MemoryLocations writtenMemoryLocations;
memoryDAG_->collectAllContainedMemoryLocations(
elem, writtenMemoryLocations);
writeIndex[node] |= writtenMemoryLocations;
}
}
for (const auto& write : writeRegistry_->writesToAllWildcards_) {
for (const auto& pr : wildcardIndex_) {
writeIndex[write].set(pr.second->index);
}
}
// Now that we've built the write index, we can null out the WriteRegistry to
// make future access an error. In this way we prevent the index from getting
// out of sync (since we have no way of registering new writes)
// NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
writeRegistry_ = nullptr;
// Initialize the write cache
buildWrittenToLocationsIndex();
GRAPH_DEBUG(toString());
}
bool AliasDb::isMutable(Node* n) const {
ValueSet vs;
for (const auto input : n->inputs()) {
vs.insert(input);
}
return writesToAlias(n, vs);
}
bool AliasDb::hasInputWriters(const Node* n) const {
for (const auto input : n->inputs()) {
if (hasWriters(input)) {
return true;
}
}
return false;
}
bool AliasDb::hasOutputWriters(const Node* n) const {
for (const auto output : n->outputs()) {
if (hasWriters(output)) {
return true;
}
}
return false;
}
bool AliasDb::hasWriters(const Node* n) const {
return hasInputWriters(n) || hasOutputWriters(n);
}
bool AliasDb::hasWriters(const Value* v) const {
if (v->mustBeNone()) {
return false;
}
auto it = elementMap_.find(v);
if (it == elementMap_.end()) {
return false;
}
const auto& el = it->second;
return writtenToLocationsIndex_->intersects(
memoryDAG_->getMemoryLocations(el));
}
void AliasDb::getWritesImpl(Node* n, MemoryLocations& ret) const {
if (writeIndex_->count(n)) {
const auto& writes = writeIndex_->at(n);
ret |= writes;
}
for (auto block : n->blocks()) {
for (auto node : block->nodes()) {
getWritesImpl(node, ret);
}
}
}
// Does `n` write to an alias of one of the values in `vs`?
bool AliasDb::writesToAlias(Node* n, const ValueSet& vs) const {
const auto writtenTo = getWrites(n);
if (writtenTo.empty()) {
return false;
}
MemoryLocations locs;
for (const auto v : vs) {
auto it = elementMap_.find(v);
if (it != elementMap_.end()) {
const auto& vlocs = memoryDAG_->getMemoryLocations(it->second);
if (writtenTo.intersects(vlocs)) {
return true;
}
}
}
return false;
}
MemoryLocations AliasDb::getWrites(Node* n) const {
MemoryLocations writes;
getWritesImpl(n, writes);
return writes;
}
void AliasDb::getReadsImpl(Node* n, MemoryLocations& ret) const {
for (const auto input : n->inputs()) {
auto it = elementMap_.find(input);
if (it != elementMap_.end()) {
auto el = it->second;
// Add all memory locations this element may alias and their contained
// elements
memoryDAG_->collectAllContainedMemoryLocations(el, ret);
}
}
for (auto block : n->blocks()) {
for (auto node : block->nodes()) {
getReadsImpl(node, ret);
}
}
}
MemoryLocations AliasDb::getReads(Node* n) const {
MemoryLocations reads;
getReadsImpl(n, reads);
return reads;
}
std::string AliasDb::getElementName(const Element* e) const {
if (e->values.empty()) {
// Not the most efficient way, but given the fact there are
// not too many types and even fewer of them will end up in
// `wildcardIndex_`, we should be fine with a linear search
// each time we hit a Wildcard leaf
for (const auto& ent : wildcardIndex_) {
if (ent.second == e) {
return std::string("WILDCARD for type ") + ent.first->str();
}
}
return "WILDCARD";
} else {
std::ostringstream ss;
if (e->values.size() == 1) {
ss << "%" << (*e->values.begin())->debugName();
return ss.str();
}
ss << "(";
for (const Value* v : e->values) {
ss << "%" << v->debugName() << ", ";
}
ss << ")";
return ss.str();
}
}
void AliasDb::dump() const {
std::cout << toString();
}
std::string AliasDb::toString() const {
std::stringstream ss{};
ss << "\n===1. GRAPH===\n";
ss << graph_->toString();
ss << "\n===2. ALIAS DB===\n";
for (const auto& ptrPair : elementMap_) {
const auto element = ptrPair.second;
int ct = 0;
if (!element->pointsTo.empty()) {
ss << getElementName(element) << " points to: ";
for (const auto pointedTo : element->pointsTo) {
if (ct > 0) {
ss << ", ";
}
++ct;
ss << getElementName(memoryDAG_->fromIndex(pointedTo));
}
ss << "\n";
}
ct = 0;
if (!element->containedElements.empty()) {
ss << getElementName(element) << " contains: ";
for (const auto contained : element->containedElements) {
ss << getElementName(memoryDAG_->fromIndex(contained));
if (ct > 0) {
ss << ", ";
}
++ct;
}
ss << "\n";
}
}
ss << "\n===3. Writes===\n";
for (const auto& pr : *writeIndex_) {
const auto node = pr.first;
const auto& values = pr.second;
ss << *node;
ss << " ";
for (const auto value : values) {
ss << getElementName(memoryDAG_->fromIndex(value)) << ", ";
}
ss << "\n";
}
ss << "\n";
return ss.str();
}
bool AliasDb::dumpToGraphvizFile(const char* filename) const {
std::ofstream dot_file(filename);
if (!dot_file.good()) {
std::cout << "Failed to create Graphviz file: '" << filename << "'\n";
return false;
}
dot_file << toGraphviz();
return true;
}
std::string AliasDb::toGraphviz() const {
std::stringstream dot;
// Local helper to generate a graphviz-friendly name encoding
// See also AliasDb::getElementName()
const auto name = [this](const Element* e) -> std::string {
if (e->values.empty()) {
for (const auto& ent : wildcardIndex_) {
if (ent.second == e) {
return std::string("\"WILDCARD for ") + ent.first->str() + "\"";
}
}
return "\"WILDCARD\"";
} else {
std::ostringstream ss;
if (e->values.size() == 1) {
ss << "\"\\%" << (*e->values.begin())->debugName() << "\"";
return ss.str();
}
ss << "\"(";
for (const Value* v : e->values) {
ss << "\\%" << v->debugName() << ", ";
}
ss << ")\"";
return ss.str();
}
};
// Include the textual representation for reference
dot << "/*\n";
dot << toString();
dot << "*/\n";
dot << "digraph alias_db {\n"
<< " rankdir=LR\n"
<< " node [shape=rect, color=gray];\n"
<< " edge [color=black];\n";
for (const auto& ptrPair : elementMap_) {
const auto element = ptrPair.second;
if (!element->pointsTo.empty()) {
for (const auto pointedTo : element->pointsTo) {
dot << " " << name(element) << " -> "
<< name(memoryDAG_->fromIndex(pointedTo)) << "\n";
}
}
if (!element->containedElements.empty()) {
for (const auto contained : element->containedElements) {
dot << " " << name(element) << " -> "
<< name(memoryDAG_->fromIndex(contained))
<< " [style=dashed, color=blue]\n";
}
}
}
dot << "}\n";
return dot.str();
}
void AliasDb::analyze(const std::shared_ptr<Graph>& graph) {
for (auto input : graph->inputs()) {
setWildcard(input);
}
analyze(graph->block());
}
void AliasDb::analyze(Block* block) {
for (auto node : block->nodes()) {
analyze(node);
}
}
void AliasDb::analyze(Node* node) {
analyzeImpl(node);
}
// Returns true if analysis was run using
// the registered analyzer.
bool AliasDb::tryRegisteredAnalysis(Node* node) {
const Operator& op = node->getOperator();
auto analysis = op.aliasAnalysisKind();
if (AliasAnalysisKind::PURE_FUNCTION == analysis) {
analyzeCreator(node);
return true;
}
return false;
}
// The basic strategy is:
// 1. Retrieve alias information for every input.
// 2. Use the node's schema's alias annotations to propgagate alias/write
// information to the outputs. For unschematized nodes, a special analyzer
// will have to be handwritten.
void AliasDb::analyzeImpl(Node* node) {
auto op = node->maybeOperator();
const bool hasSpecialCase = aliasAnalysisHasSpecialCaseFor(node->kind());
if (op) {
const auto analysis = op->aliasAnalysisKind();
const bool registeredAsSpecialCase =
analysis == AliasAnalysisKind::INTERNAL_SPECIAL_CASE;
if (C10_UNLIKELY(registeredAsSpecialCase && !hasSpecialCase)) {
TORCH_INTERNAL_ASSERT(
false,
"Op ",
node->kind().toDisplayString(),
" is registered with AliasAnalysisKind::INTERNAL_SPECIAL_CASE but doesn't have a special case.");
} else if (C10_UNLIKELY(!registeredAsSpecialCase && hasSpecialCase)) {
TORCH_INTERNAL_ASSERT(
false,
"Op ",
node->kind().toDisplayString(),
" has a special case and should be registered with AliasAnalysisKind::INTERNAL_SPECIAL_CASE but is registered with ",
c10::toString(analysis));
}
} else {
if (!hasSpecialCase) {
std::ostringstream oss;
for (const auto input : node->inputs()) {
oss << input->type()->str() << ", ";
}
oss << "\n\nCandidates:";
const auto& candidates = getAllOperatorsFor(node->kind());
for (const auto& candidate : candidates) {
oss << "\n\t" << candidate->schema();
}
TORCH_INTERNAL_ASSERT(
0,
"We don't have an op for ",
node->kind().toDisplayString(),
" but it isn't a special case. ",
"Argument types: ",
oss.str());
}
}
// These nodes are not schematized, so we need to handle them specially
switch (node->kind()) {
case prim::If:
return analyzeIf(node);
case prim::Loop:
return analyzeLoop(node);
case prim::FusionGroup:
case prim::CudaFusionGroup:
case prim::oneDNNFusionGroup:
case prim::FunctionalGraph:
case prim::DifferentiableGraph:
case prim::FallbackGraph:
return analyzeSubgraph(node);
case prim::fork:
return analyzeFork(node);
case aten::wait:
return analyzeWait(node);
case prim::awaitable:
case prim::awaitable_nowait:
return analyzeAwaitable(node);
case prim::awaitable_wait:
return analyzeAwaitableWait(node);
case prim::rpc_async:
case prim::rpc_sync:
case prim::rpc_remote:
return analyzeRpcAsync(node);
case aten::batch_norm:
return analyzeBatchNorm(node);
case aten::instance_norm:
return analyzeInstanceNorm(node);
case prim::GradOf:
return analyzeGradOf(node);
case prim::BroadcastMKLDNNTensors: {
makePointerTo(node->outputs().at(0), node->inputs().at(0));
makePointerTo(node->outputs().at(1), node->inputs().at(1));
return;
}
// TODO: think more about TensorExpr alias correctness
case prim::TensorExprGroup:
case prim::TensorExprDynamicGroup:
case prim::MKLDNNGroup:
case prim::ConstantMKLDNNTensor:
case prim::StaticSubgraph:
case prim::Constant:
case prim::AutogradZero:
case prim::AutogradAdd:
case prim::FusedConcat:
case prim::MMTreeReduce:
case prim::MMBatchSide:
case prim::BroadcastSizes:
case prim::ChunkSizes:
// this should never be seen outside of initial compilation
// but because of some dependencies with closure invoking alias
// db needs to be handled here
case prim::EmptyListLiteral:
case prim::Closure:
case prim::CreateObject:
case prim::tolist:
case prim::Uninitialized:
return analyzeCreator(node);
case prim::TupleConstruct:
case prim::DictConstruct:
case prim::ListConstruct:
return analyzeContainerConstruct(node);
case prim::TupleUnpack:
case prim::TupleIndex:
case prim::TupleSlice:
case prim::ListUnpack:
case prim::PythonOp:
case prim::GetAttr:
if (isFrozen_ && node->kind() == prim::GetAttr) {
auto& ty = node->input()->type();
if (ty->expectRef<ClassType>().is_module()) {
return analyzeCreator(node);
}
}
return analyzeExtractor(node);
case prim::unchecked_cast:
return makePointerTo(node->output(), node->input());
case prim::ConstantChunk:
return analyzeChunk(node);
case prim::BroadcastingChunk:
return analyzeBroadcastingChunk(node);
case prim::SetAttr:
return analyzeSetAttr(node);
case prim::profile_ivalue:
case prim::profile:
makePointerTo(node->output(), node->inputs().at(0));
return;
case prim::TypeCheck:
case prim::RequiresGradCheck: {
auto num_inputs = node->inputs().size();
for (const auto i : c10::irange(num_inputs)) {
makePointerTo(node->outputs().at(i), node->inputs().at(i));
}
return;
}
case prim::BailOut:
TORCH_INTERNAL_ASSERT(
node->inputs().at(0)->node()->kind() == prim::BailoutTemplate);
makePointerTo(node->output(), node->inputs().at(1));
return;
case prim::Guard:
makePointerTo(node->output(), node->inputs().at(0));
return;
case prim::CallFunction:
case prim::CallMethod: {
// TODO: this can be improved with summarizes of what the function does
// for now we assume the worst
if (!descend_function_calls_) {
return analyzeConservative(node);
}
auto g = tryToGraphFunction(node);
if (!g) {
return analyzeConservative(node);
}
// this is an unoptimized path - we copy the subgraph for each function
// call past the first - so we do not generally enable the recursive
// analysis. use cases for fine-grained alias analysis without inlining
// are very uncommon
auto graph = g->optimized_graph();
// alias analysis will use Value* as mappings for information,
// so for each analysis of a particular function call we need a new graph
// for all copies made, store them for duration of analysis so we do not
// run into lifetime issues with the graph
std::vector<std::shared_ptr<Graph>>& graphs =
function_call_copies_[graph.get()];
if (graphs.empty()) {
graphs.push_back(graph);
analyzeSubgraph(node, graph);
} else {
auto copied_graph = graph->copy();
graphs.push_back(copied_graph);
analyzeSubgraph(node, copied_graph);
}
return;
}
case prim::Enter:
case prim::Exit:
// TODO: this can be improved with summarizes of what the function does
// for now we assume the worst
// NB: update safeToChangeAliasingRelationship if changed
return analyzeConservative(node);
case prim::Print:
case prim::isinstance:
// These ops do nothing
return;
default:
if (tryRegisteredAnalysis(node)) {
return;
}
}
TORCH_INTERNAL_ASSERT(op, "We should have an op schema if we get to here");
const AliasAnalysisKind analysis = op->aliasAnalysisKind();
TORCH_INTERNAL_ASSERT(
analysis != AliasAnalysisKind::INTERNAL_SPECIAL_CASE &&
!aliasAnalysisHasSpecialCaseFor(node->kind()),
"Special cases should be handled already if we're here.");
if (node->kind().is_aten() || node->kind().is_prim() ||
node->kind().is_cuda()) {
// TODO There is nothing in the system that relies on aten:: and prim::
// ops using AliasAnalysisKind::FROM_SCHEMA or
// AliasAnalysisKind::INTERNAL_SPECIAL_CASE, but this is the intended
// behavior for all current ops and a good error check. We can consider
// lifting this constraint later if we have a use case for it.
TORCH_INTERNAL_ASSERT(
analysis == AliasAnalysisKind::FROM_SCHEMA ||
analysis == AliasAnalysisKind::CONSERVATIVE,
"aten:: and prim:: operators should use AliasAnalysisKind::FROM_SCHEMA or "
"AliasAnalysisKind::CONSERVATIVE(if really necessary), but ",
node->kind().toDisplayString(),
" doesn't. Note: Ideally, prim:: operators actually shouldn't have a schema ",
"and then use AliasAnalysisKind::INTERNAL_SPECIAL_CASE instead.");
}
if (analysis == AliasAnalysisKind::CONSERVATIVE) {
// TODO A previous implementation of alias analysis always accessed
// node->schema , which cause the schema caches in the Node class to be
// filled for the full graph. Unfortunately, our JIT passes started relying
// on that, so we need to keep doing this. Details: in
// caffe2/torch/onnx/utils.py, _jit_pass_onnx is called on an invalid JIT
// graph because we called _jit_pass_erase_number_types right before and
// ints are now Tensors instead. So if _jit_pass_onnx tries to look up
// operator schemas, it will crash. However, _jit_pass_constant_propagation,
// which is called before it, runs alias analysis and prefills the schema
// cache in the all Node instances so that _jit_pass_onnx doesn't look up
// operators to get the schemas anymore. We should fix this.
node->schema(); // fill the schema cache in the Node class
return analyzeConservative(node);
}
TORCH_INTERNAL_ASSERT(
analysis == AliasAnalysisKind::FROM_SCHEMA,
"AliasAnalysisKind::CONSERVATIVE/PURE_FUNCTION/INTERNAL_SPECIAL_CASE should already have been handled above");
const auto& schema = node->schema();
// Bind the schema's "formal" alias annotation to the actual values those
// schema arguments represent
std::unordered_map<Symbol, Value*> formalToActual;
for (const auto i : c10::irange(schema.arguments().size())) {
const at::AliasInfo* formal = schema.arguments()[i].alias_info();
const auto& actualValue = node->inputs().at(i);
// Skip if there's no alias annotation
if (!formal) {
continue;
}
// If this type cannot alias, continue. Can occur with a VarType schema
if (!isMutableTypeInternal(actualValue)) {
continue;
}
// Do sanity checks on the alias annotation
TORCH_INTERNAL_ASSERT(
formal->containedTypes().size() <= 1,
"Composite types for alias analysis not yet supported");
TORCH_INTERNAL_ASSERT(
!formal->isWildcardBefore(),
"Doesn't make sense for a input value to begin as a wildcard");
// This is a special case where we have alias info before [] but not after,
// such as `Tensor(a!)[]`
if (formal->containedTypes().size() == 1 && formal->beforeSets().empty()) {
// Use the first containedType in alias info.
formal = &(formal->containedTypes()[0]);
}
const auto& formalAlias = formal->beforeSet();
// skip if we've already bound this alias
if (formalToActual.count(formalAlias) != 0) {
continue;
}
// Bind the formal to the actual
formalToActual[formalAlias] = actualValue;
// Record writes
if (formal->isWrite()) {
registerWrite(actualValue, node);
}
// Now deal with sets after the '->'
if (formal->isWildcardAfter()) {
TORCH_INTERNAL_ASSERT(
formal->afterSets().size() == 1,
"If the after set contains a wildcard, "
"there should be no other alias sets specified.");
setWildcard(actualValue);
} else {
// We don't understand anything else in the after yet, so assert there's
// been no change.
TORCH_INTERNAL_ASSERT(formal->beforeSets() == formal->afterSets());
}
}
// Use the formal-actual mapping to give aliases to the outputs
for (const auto i : c10::irange(schema.returns().size())) {
const auto actual = node->outputs().at(i);
const at::AliasInfo* formal = schema.returns()[i].alias_info();
if (!formal) {
// This is a fresh tensor
giveFreshAlias(actual);
continue;
}
// If this type cannot alias, continue. Can occur with a VarType schema
if (!isMutableType(actual)) {
continue;
}
TORCH_INTERNAL_ASSERT(
formal->containedTypes().size() <= 1,
"Composite types for alias analysis not yet supported");
TORCH_INTERNAL_ASSERT(formal->beforeSets() == formal->afterSets());
if (formal->containedTypes().size() == 1 && formal->beforeSets().empty()) {
// Use the first containedType in alias info.
formal = &(formal->containedTypes()[0]);
}
if (formal->isWildcardBefore()) {
TORCH_INTERNAL_ASSERT(
formal->beforeSets().size() == 1,
"If an output is a wildcard, "
"there should be no other alias sets specified.");
setWildcard(actual);
continue;
}
bool inputs_has_alias = false;
for (const auto& formalAlias : formal->beforeSets()) {
if (formalToActual.count(formalAlias)) {
inputs_has_alias = true;
auto toAlias = formalToActual.at(formalAlias);
makePointerTo(actual, toAlias);
}
}
// If all the alias annotation that we encounter weren't in the inputs:
// e.g. foo(Tensor(a) self) -> Tensor(b)
// or foo(Tensor(a) self) -> Tensor(b|c)
// Otherwise it is the form of a|fresh, which we can ignore, taking the
// conservative assumption that the output must alias `a`, e.g
// aten::cuda(Tensor(a) self) -> Tensor(a|fresh)
if (!inputs_has_alias && !formal->beforeSets().empty()) {
giveFreshAlias(actual);
}
// Record writes
if (formal->isWrite()) {
registerWrite(actual, node);
}
}
}
// Register the fact that `n` writes to `v`.
void AliasDb::registerWrite(const Value* v, Node* n, bool writeToContained) {
if (!isMutableTypeInternal(v)) {
// don't need to register a write if the value isn't mutable
return;
}
if (writeToContained) {
writeRegistry_->registerWriteToAllContained(v, n);
} else {
writeRegistry_->registerWrite(v, n);
}
}
void AliasDb::analyzeIf(Node* node) {
// For if statements, the alias set of an output is the union of the
// alias sets generated by the if and else block
const auto trueBlock = node->blocks().at(0);
const auto falseBlock = node->blocks().at(1);
analyze(trueBlock);
analyze(falseBlock);
for (const auto i : c10::irange(node->outputs().size())) {
const auto nodeOutput = node->outputs()[i];
const auto trueOutput = trueBlock->outputs().at(i);
const auto falseOutput = falseBlock->outputs().at(i);
makePointerTo(nodeOutput, trueOutput);
makePointerTo(nodeOutput, falseOutput);
}
}
void AliasDb::analyzeLoop(Node* node) {
const auto bodyBlock = node->blocks().at(0);
const auto loopCarriedInputs = node->inputs().slice(2); // skip max, cond
const auto blockInputs = bodyBlock->inputs().slice(1); // skip trip
const auto blockOutputs = bodyBlock->outputs().slice(1); // skip trip
TORCH_INTERNAL_ASSERT(loopCarriedInputs.size() == blockInputs.size());
TORCH_INTERNAL_ASSERT(blockOutputs.size() == node->outputs().size());
// Run alias analysis on the loop body, iterating until the block output
// alias info converges. Copy node input aliases to block input
mapAliases(blockInputs, loopCarriedInputs);
// Populate block output alias info by analyzing the body
analyze(bodyBlock);
// Copy the alias info from the block output to the node output
mapAliases(node->outputs(), blockOutputs);
}
void AliasDb::analyzeGradOf(Node* node) {
const auto grad_of_block = node->blocks().at(0);
analyze(grad_of_block);
mapAliases(node->outputs(), grad_of_block->outputs());
}
void AliasDb::analyzeSubgraph(
Node* node,
const std::shared_ptr<Graph>& subgraph) {
const auto subgraphBlock = subgraph->block();
// CallFunction nodes have an extra first parameter
if (node->kind() == prim::CallFunction) {
mapAliases(subgraphBlock->inputs(), node->inputs().slice(1));
} else {
mapAliases(subgraphBlock->inputs(), node->inputs());
}
analyze(subgraphBlock);
// Note: the subgraph outputs and node outputs are NOT NECESSARILY the
// same length. Autodifferentiation maybe capture additional outputs in the
// subgraph block.
TORCH_INTERNAL_ASSERT(
subgraphBlock->outputs().size() >= node->outputs().size());
for (size_t i = 0; i < node->outputs().size(); i++) {
makePointerTo(node->outputs()[i], subgraphBlock->outputs()[i]);
}
}
void AliasDb::analyzeSubgraph(Node* node) {
const auto subgraph = node->g(attr::Subgraph);
return analyzeSubgraph(node, subgraph);
}
// For nodes that generate a fresh value from nothing
void AliasDb::analyzeCreator(Node* node) {
for (Value* output : node->outputs()) {
giveFreshAlias(output);
}
}
// For nodes that extract values from a composite type. Right now, this just
// gives up and creates wildcards for everything.
void AliasDb::analyzeExtractor(Node* node) {
for (const auto output : node->outputs()) {
setWildcard(output);
}
}
// For torch.chunk(), all returned tensors may alias the input tensor
void AliasDb::analyzeChunk(Node* node) {
for (auto output : node->outputs()) {
makePointerTo(output, node->input());
}
}
void AliasDb::analyzeFork(Node* node) {
for (const auto input : node->inputs()) {
setWildcard(input);
}
// Give the future that the fork emits a fresh value
for (const auto output : node->outputs()) {
giveFreshAlias(output);
}
}
void AliasDb::analyzeWait(Node* node) {
TORCH_INTERNAL_ASSERT(node->kind() == aten::wait);
for (const auto output : node->outputs()) {
setWildcard(output);
}
// the forked subgraph that `wait` is waiting on may write to any of its
// inputs. We don't have a reliable way of recovering the fork inputs, so
// for safety we just register a write to every wildcard.
writeRegistry_->registerWriteToAllWildcards(node);
}
void AliasDb::analyzeAwaitable(Node* node) {
for (const auto input : node->inputs()) {
setWildcard(input);
}
for (const auto output : node->outputs()) {
giveFreshAlias(output);
}
}
void AliasDb::analyzeAwaitableWait(Node* node) {
TORCH_INTERNAL_ASSERT(node->kind() == prim::awaitable_wait);
for (const auto output : node->outputs()) {
setWildcard(output);
}
// the awaitable subgraph that `wait` is waiting on may write to any of its
// inputs. We don't have a reliable way of recovering the awaitable inputs, so
// for safety we just register a write to every wildcard.
writeRegistry_->registerWriteToAllWildcards(node);
}
void AliasDb::analyzeRpcAsync(Node* node) {
for (const auto input : node->inputs()) {
setWildcard(input);
}
// Give the future that the rpc_async emits a fresh value
for (const auto output : node->outputs()) {
giveFreshAlias(output);
}
}
namespace {
std::optional<bool> getConstantBooleanInput(
Node* node,
const std::string& inputName) {
TORCH_INTERNAL_ASSERT(
node->hasNamedInput(inputName), inputName + " input is expected");
auto value = node->namedInput(inputName);
TORCH_INTERNAL_ASSERT(
value->type() == BoolType::get(),
inputName + "training input is expected to be a bool");
return constant_as<bool>(value);
}
} // namespace
// custom behavior for batch_norm because (a!)? annotations currently
// aren't supported, and because behavior differs depending on the value of
// training
void AliasDb::analyzeBatchNorm(Node* node) {
// we invoking freezing for inference, so we assume training will be folded to
// a constant false to avoid needing to invoke freezing multiple times in
// order to make batch norm weights constant
for (Value* output : node->outputs()) {
giveFreshAlias(output);
}
if (isFrozen_) {
return;
}
auto isTraining = getConstantBooleanInput(node, "training");
if (!isTraining.has_value() || *isTraining) {
TORCH_INTERNAL_ASSERT(
node->hasNamedInput("running_mean"), "running_mean input is expected");
auto runningMean = node->namedInput("running_mean");
TORCH_INTERNAL_ASSERT(
node->hasNamedInput("running_var"), "running_var input is expected");
auto runningVar = node->namedInput("running_var");
registerWrite(runningMean, node);
registerWrite(runningVar, node);
}
}
// custom behavior for instance_norm, because (a!)? annotations currently
// aren't supported, and because behavior differs depending on the value of
// use_input_stats
void AliasDb::analyzeInstanceNorm(Node* node) {
for (Value* output : node->outputs()) {
giveFreshAlias(output);
}
auto useInputStats = getConstantBooleanInput(node, "use_input_stats");
if (!useInputStats.has_value() || *useInputStats) {
TORCH_INTERNAL_ASSERT(
node->hasNamedInput("running_mean"), "running_mean input is expected");
auto runningMean = node->namedInput("running_mean");
TORCH_INTERNAL_ASSERT(
node->hasNamedInput("running_var"), "running_var input is expected");
auto runningVar = node->namedInput("running_var");
registerWrite(runningMean, node);
registerWrite(runningVar, node);
}
}
// SetAttr: writes to the `self` field
void AliasDb::analyzeSetAttr(Node* node) {
const auto self = node->inputs().at(0);
TORCH_INTERNAL_ASSERT(self->type()->kind() == TypeKind::ClassType);
registerWrite(self, node);
// Also the value being set must become a wildcard.
const auto newValue = node->inputs().at(1);
setWildcard(newValue);
}
// Used for anything where we do not have accurate alias summaries
// may write to any input and produce wildcards
void AliasDb::analyzeConservative(Node* node) {
for (const auto input : node->inputs()) {
if (!isMutableTypeInternal(input)) {
continue;
}
registerWrite(input, node, /*writeToContained=*/true);
setWildcard(input);
}
for (const auto output : node->outputs()) {
setWildcard(output);
}
}
bool AliasDb::functionalNonEscapingListUse(const Use& use) const {
Node* n = use.user;
size_t offset = use.offset;
Value* container = n->inputs().at(offset);
// only consider aten op uses of lists
if (!container->type()->cast<ListType>()) {
return false;
}
/*
in the general case, we consider any Value that enters another container as
entering the heap, and thus aliasing all other heap values of the same type.
the advantage of this approach are:
- there are many composite list/container ops that would be tricky to
schematize if we did something more complicated
- limits the size of the AliasDb, because a container of size 10 only contains
1 memory dag element instead of 10
- we do not need to worry about adding contained elements to the wildcard set
when a container escapes the graph.
The downside of this approach is we are unable to handle the common case of a
list constructed and passed into an aten op. Here, optimize for a set of
common ops where the output does not alias the list or the list elements
*/
// only used in output of graph - no further uses,
// so there will be no use of it where the contained element leaks
if (use.user->kind() == prim::Return) {
return use.user->owningBlock() == graph_->block();
}
switch (use.user->kind()) {
case aten::cat:
case aten::broadcast_tensors:
case aten::stack:
case aten::vstack:
case aten::hstack:
case aten::dstack:
return true;
}
auto op = use.user->maybeOperator();
if (op && op->aliasAnalysisKind() == AliasAnalysisKind::PURE_FUNCTION) {
return true;
}
return false;
}
bool AliasDb::functionalNonEscapingTupleUse(const Use& use) const {
Node* n = use.user;
size_t offset = use.offset;
Value* container = n->inputs().at(offset);
if (!container->type()->cast<TupleType>()) {
return false;
}
// TODO(T97387453): Cover more ops that do not let escape tuples' elements.
bool in_return_outputs = use.user->kind() == prim::Return;
bool not_in_nested_subgraph = use.user->owningBlock() == graph_->block();
return in_return_outputs && not_in_nested_subgraph;
}
// List or dict or tuple construct: create an aliasing element for the actual
// container, then mark all inputs as wildcards, since they've gone inside the
// container. Then, add the wildcard sets of appropriate type to the contained
// elements of the container.
void AliasDb::analyzeContainerConstruct(Node* node) {
TORCH_INTERNAL_ASSERT(
node->kind() == prim::ListConstruct ||
node->kind() == prim::DictConstruct ||
node->kind() == prim::TupleConstruct);
// tuples which contain immutable types are immutable
if (!isMutableTypeInternal(node->output())) {
return;
}
TORCH_INTERNAL_ASSERT(node->outputs().size() == 1);
auto container = node->output();
// optimization:
// if a list is only used once in an aten op, and the op output
// doesn't alias the input, then we can add all inputs to the list's
// contained elements instead of the wildcard set.
if (container->uses().size() == 1 &&
(functionalNonEscapingListUse(container->uses().at(0)) ||
functionalNonEscapingTupleUse(container->uses().at(0)))) {
giveFreshAlias(container, false);
for (Value* v : node->inputs()) {
addToContainedElements(v, container);
}
return;
}
giveFreshAlias(container);
auto container_elem = elementMap_.at(container);
for (auto input : node->inputs()) {
auto maybe_wildcard_elem = setWildcard(input);
if (maybe_wildcard_elem) {
memoryDAGBuilder_->addToContainedElements(
*maybe_wildcard_elem, container_elem);
}
}
}
// BroadcastingChunk: all inputs are broadcasted, and then individually chunked.
// This is an intermediate node used only in the graph fuser.
void AliasDb::analyzeBroadcastingChunk(Node* node) {
auto inputs = node->inputs();
auto outputs = node->outputs();
auto nchunks = node->i(attr::chunks);
for (const auto index : c10::irange(inputs.size())) {
// Each inputs[i] is aliased by exactly `nchunks` distinct output tensors:
// inputs[i] produces chunks outputs[i * nchunks + k] for k in [0..nchunks)
auto output_begin = outputs.begin() + index * nchunks;
for (auto it = output_begin; it != output_begin + nchunks; ++it) {
makePointerTo(*it, inputs.at(index));
}
}
}
bool AliasDb::nonAliasingValue(const Value* elem) const {
// these are values which can point to aliasing types in the graph,
// as with a None value pointing to an optional if node output,
// but will never alias themselves
return elem->mustBeNone() || elem->node()->kind() == prim::Uninitialized;
}
// Register the fact that `from` is a pointer to `to`
void AliasDb::makePointerTo(const Value* from, const Value* to) {
if (nonAliasingValue(from) || nonAliasingValue(to)) {
// if either value is guaranteed to be non-aliasing, we do not need to
// connect the two elements. however, it is invariant that aliasing types
// that are not wildcards have a memory dag element, so we create one if
// needed
giveFreshAlias(from);
giveFreshAlias(to);
return;
}
// The contained types of immutable type containers (`Optional`,
// `Tuple`, `Future`, and `Union`) are unified, so these types can be
// mutable or immutable and point to a type which is mutable or
// immutable. `Any` is mutable but can point to an immutable type
// through refinement
if (isMutableTypeInternal(from) != isMutableTypeInternal(to)) {
return;
}
// both immutable
if (!isMutableTypeInternal(from)) {
return;
}
if (from == to) {
return;
}
// At this point, we are dealing with two mutable types
auto from_el = getOrCreateElement(from);
auto to_el = getOrCreateElement(to);
memoryDAGBuilder_->makePointerTo(from_el, to_el);
}
void AliasDb::addToContainedElements(
const Value* inner,
const Value* container) {
if (!isMutableTypeInternal(inner)) {
return;
}
auto inner_el = getOrCreateElement(inner);
auto cont_el = getOrCreateElement(container);
memoryDAGBuilder_->addToContainedElements(inner_el, cont_el);
}
bool AliasDb::mayAlias(const Value* a, const Value* b) const {
if (!isMutableTypeInternal(a) || !isMutableTypeInternal(b)) {
return false;
}
return memoryDAG_->mayAlias(elementMap_.at(a), elementMap_.at(b));
}
bool AliasDb::mayAlias(const ValueSet& a, const ValueSet& b) const {
if (a.empty() || b.empty()) {
return false;
}
// Record all memory locations from group `a`
MemoryLocations aMemLocs;
for (const auto value : a) {
auto it = elementMap_.find(value);
if (it != elementMap_.end()) {
aMemLocs |= memoryDAG_->getMemoryLocations(it->second);
}
}
// If any of group `b`s memory locations overlap, return true.
for (const auto value : b) {
auto it = elementMap_.find(value);
if (it != elementMap_.end()) {
if (aMemLocs.intersects(memoryDAG_->getMemoryLocations(it->second))) {
return true;
}
}
}
// No overlap, so group `a` and `b` do not share a memory location
return false;
}
bool AliasDb::mayContainAlias(Value* a, Value* b) const {
if (!isMutableTypeInternal(a) || !isMutableTypeInternal(b)) {
return false;
}
return memoryDAG_->mayContainAlias(elementMap_.at(a), elementMap_.at(b));
}
std::vector<Element*> AliasDb::getElements(at::ArrayRef<Value*> vs) const {
std::vector<Element*> elements;
for (const auto& val : vs) {
if (isMutableTypeInternal(val)) {
elements.push_back(elementMap_.at(val));
}
}
return elements;
}
bool AliasDb::mayContainAlias(
const at::ArrayRef<Value*> a,
const at::ArrayRef<Value*> b) const {
auto a_elems = getElements(a);
return a_elems.empty() ? false
: memoryDAG_->mayContainAlias(a_elems, getElements(b));
}
bool AliasDb::mayContainAlias(Value* a, const at::ArrayRef<Value*> b) const {
if (!isMutableTypeInternal(a)) {
return false;
}
auto b_elems = getElements(b);
return b_elems.empty()
? false
: memoryDAG_->mayContainAlias(elementMap_.at(a), b_elems);
}
// Make each value in the `from` list point to its partner in the `to` list
void AliasDb::mapAliases(at::ArrayRef<Value*> from, at::ArrayRef<Value*> to) {
TORCH_INTERNAL_ASSERT(to.size() == from.size());
for (const auto i : c10::irange(to.size())) {
makePointerTo(from[i], to[i]);
}
}
// Should only be called from create_functional_graphs.
// The asserts are to guard against unintentional use.
// FIXME refactor aliasdb construction to be more robust to mutation so this
// hack isn't necessary.
void AliasDb::createValue(const Value* value) {
TORCH_INTERNAL_ASSERT(isMutableTypeInternal(value->type()));
auto new_elem = memoryDAG_->unsafeMakeFreshValue(value);
elementMap_[value] = new_elem;
}
void AliasDb::giveFreshAlias(
const Value* value,
bool add_wildcard_to_contained_elems) {
auto maybe_mut_types = mapTypeToAliasTypeSetPtr(value->type());
if (!maybe_mut_types) {
return;
}
if (elementMap_.count(value)) {
// Inside a loop, we may have given a fresh alias to this value already, so
// skip
return;
}
auto new_elem = memoryDAGBuilder_->makeFreshValue(value);
elementMap_[value] = new_elem;
if (add_wildcard_to_contained_elems) {
if (maybe_mut_types->size() > 1) {
pointUnionTypeElementToAllContainedTypes(new_elem, *maybe_mut_types);
} else {
addContainedTypesToFreshElement(new_elem, *maybe_mut_types);
}
}
}
Element* AliasDb::getOrCreateElement(const Value* value) {
if (!elementMap_.count(value)) {
giveFreshAlias(value);
}
return elementMap_.at(value);
}
void AliasDb::replaceWithNewValue(Value* existing, Value* new_value) {
TORCH_INTERNAL_ASSERT(
*unshapedType(existing->type()) == *unshapedType(new_value->type()),
"Types must be strictly equal if you are replacing aliasing information. ",
"Got existing: '",
existing->type()->repr_str(),
"', new_value: '",
new_value->type()->repr_str(),
"'");
if (!isMutableTypeInternal(existing)) {
return;
}
auto existing_elem = elementMap_.at(existing);
elementMap_[new_value] = existing_elem;
elementMap_.erase(existing);
existing_elem->values = {new_value};
}
void AliasDb::copyValue(Value* from, Value* to) {
TORCH_INTERNAL_ASSERT(
*unshapedType(from->type()) == *unshapedType(to->type()),
"Types must be strictly equal if you are copying aliasing information. ",
"Got from: '",
from->type()->repr_str(),
"', to: '",
to->type()->repr_str(),
"'");
if (!isMutableTypeInternal(to)) {
return;
}
auto origElem = elementMap_.at(from);
elementMap_[to] = origElem;
origElem->values.insert(to);
}
bool AliasDb::moveAfterTopologicallyValid(Node* n, Node* movePoint) {
return tryMove(n, movePoint, MoveSide::AFTER, /*dryRun=*/false);
}
bool AliasDb::couldMoveAfterTopologically(Node* n, Node* movePoint) {
return tryMove(n, movePoint, MoveSide::AFTER, /*dryRun=*/true);
}
bool AliasDb::moveBeforeTopologicallyValid(Node* n, Node* movePoint) {
// We have to distinguish the move side (instead of just moving after
// n->prev()). Consider the following example:
// If the dependency graph looks like
// n -> movePoint -> o
// then moveBefore(o) will end up with
// n, o, movePoint
// but moveAfter(n) will return false.
return tryMove(n, movePoint, MoveSide::BEFORE, /*dryRun=*/false);
}
bool AliasDb::couldMoveBeforeTopologically(Node* n, Node* movePoint) {
return tryMove(n, movePoint, MoveSide::BEFORE, /*dryRun=*/true);
}
bool AliasDb::hasWriters(const at::ArrayRef<Value*>& values) const {
return std::any_of(values.begin(), values.end(), [&](Value* value) {
return hasWriters(value);
});
}
bool AliasDb::escapesScope(const at::ArrayRef<Value*>& vs) const {
return mayContainAlias(graph_->inputs(), vs) ||
mayContainAlias(graph_->outputs(), vs) || mayAliasWildcard(vs);
}
// Correctness conditions:
// no values in either set can have writers, and values in both sets
// cannot escape the current graph scope. Values can escape the current scope
// by aliasing a graph output or input, or by aliasing the wildcard set.
bool AliasDb::safeToChangeAliasingRelationship(
const at::ArrayRef<Value*>& a,
const at::ArrayRef<Value*>& b) const {
if (hasWriters(a) || hasWriters(b)) {
return false;
}
return !(escapesScope(a) && escapesScope(b));
}
// Helper for topologically-safe node moves. See `tryMove()` for details.
class AliasDb::WorkingSet {
public:
explicit WorkingSet(Node* mover, const AliasDb& aliasDb)
: aliasDb_(aliasDb), mover_(mover) {
for (const auto user : getUsersSameBlock(mover_)) {
moverUsers_.insert(user);
}
moverWrites_ |= aliasDb_.getWrites(mover_);
moverReads_ |= aliasDb_.getReads(mover_);
}
// Add `n` to the working set
void add(Node* n) {
nodes_.push_back(n);
node_to_index_[n] = static_cast<int64_t>(nodes_.size()) - 1;
for (const auto user : getUsersSameBlock(n)) {
users_.insert(user);
}
writes_ |= aliasDb_.getWrites(n);
reads_ |= aliasDb_.getReads(n);
}
void eraseMover() {
mover_ = nullptr;
moverWrites_.clear();
moverReads_.clear();
moverUsers_.clear();
}
const std::vector<Node*>& dependentNodes() {
return nodes_;
}
// Does the working set depend on `n`?
bool dependsOn(Node* n) const {
if (!mover_ && nodes_.empty()) {
return false;
}
return hasDataDependency(n) || hasMutabilityDependency(n);
}
private:
bool hasDataDependency(Node* n) const {
if (!mover_ && nodes_.empty()) {
return false;
}
const Node* pivot = mover_ ? mover_ : nodes_.front();
if (n->isAfter(pivot)) {
return producesFor(n);
} else {
return consumesFrom(n);
}
}
bool hasMutabilityDependency(Node* n) const {
// Check that `n` does not write to anything used by the working set
const auto& nWrites = aliasDb_.getWrites(n);
if (reads_.intersects(nWrites)) {
return true;
}
if (mover_ && moverReads_.intersects(nWrites)) {
return true;
}
// Check that the working set doesn't write to anything that `n` uses.
const auto& nReads = aliasDb_.getReads(n);
if (writes_.intersects(nReads)) {
return true;
}
if (mover_ && moverWrites_.intersects(nReads)) {
return true;
}
return false;
}
// Does the working set produce any values consumed by `n`?
bool producesFor(Node* n) const {
// This equivalent to asking: does the total use-set of all the nodes in the
// working set include `n`?
if (mover_ && moverUsers_.count(n)) {
return true;
}
return users_.count(n) != 0;
}
// Does the working set consume any values produced by `n`?
bool consumesFrom(Node* n) const {
const auto users = getUsersSameBlock(n);
if (mover_ && users.count(mover_)) {
return true;
}
return std::any_of(users.begin(), users.end(), [&](Node* user) {
return node_to_index_.find(user) != node_to_index_.end();
});
}
// Get all users of outputs of `n`, in the same block as `n`.
// This means if there is an `if` node that uses an output of `n` in some
// inner sub-block, we will consider the whole `if` node a user of `n`.
std::unordered_set<Node*> getUsersSameBlock(Node* n) const {
std::unordered_set<Node*> users;
for (const auto output : n->outputs()) {
for (const auto& use : output->uses()) {
if (auto sameBlock = findSameBlock(use.user, n)) {
users.insert(sameBlock);
}
}
}
return users;
}
// Traverse `target`'s blockchain upward until we find a node that shares a
// block with `n`.
//
// If one can't be found (say, because `n` is an inner block and target is
// outside), then return nullptr. Since we can only reorder nodes within a
// block, `target` would be irrelevant.
static Node* findSameBlock(Node* target, Node* n) {
TORCH_INTERNAL_ASSERT(target->owningGraph() == n->owningGraph());
if (target->owningBlock() == n->owningBlock()) {
return target;
} else {
// This user is in a sub-block. Traverse the blockchain upward until
// we arrive at a node that shares a block with `this`
auto curNode = target;
while (curNode->owningBlock() != n->owningBlock()) {
curNode = curNode->owningBlock()->owningNode();
if (curNode == nullptr) {
return curNode;
}
}
return curNode;
}
}
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
const AliasDb& aliasDb_;
std::vector<Node*> nodes_;
// Extra data structure for nodes for faster look up
// Since the tryMove method is used a lot, we want to
// make it as fast as possible.
std::unordered_map<Node*, int64_t> node_to_index_;
// Mover dependencies. We track these separately since we may erase the mover
// from the working set.
Node* mover_;
MemoryLocations moverWrites_;
MemoryLocations moverReads_;
std::unordered_set<Node*> moverUsers_;
// users => # of working set nodes it uses
std::unordered_set<Node*> users_;
// Values written to by the working set => number of nodes writing to value
MemoryLocations writes_;
MemoryLocations reads_;
};
// Try to move `toMove` before/after `movePoint` while preserving value
// dependencies. Returns false iff such a move could not be made.
//
// If `dryRun` is set, don't actually execute the move, just check if the move
// is possible
//
// The basic approach is: have a "working set" that we are moving forward, one
// node at a time. When we can't move past a node (because it depends on the
// working set), then add it to the working set and keep moving until we hit
// `moveAfter`.
bool AliasDb::tryMove(
Node* toMove,
Node* movePoint,
MoveSide moveSide,
bool dryRun) {
if (toMove->owningBlock() != movePoint->owningBlock()) {
return false;
}
if (toMove == movePoint) {
return true;
}
// 1. Move from `this` toward movePoint, building up the working set of
// dependencies
WorkingSet workingSet(toMove, *this);
// NOLINTNEXTLINE(cppcoreguidelines-init-variables)
int direction;
if (toMove->isAfter(movePoint)) {
direction = kPrevDirection;
} else {
direction = kNextDirection;
}
auto curNode = toMove->next_in_graph[direction];
bool toMoveIsOnMoveSide =
(moveSide == MoveSide::BEFORE && toMove->isBefore(movePoint)) ||
(moveSide == MoveSide::AFTER && toMove->isAfter(movePoint));
if (toMoveIsOnMoveSide && curNode == movePoint) {
return true;
}
// it is never valid to move reorder a node with side effects
if (toMove->hasSideEffects() ||
(!toMoveIsOnMoveSide && movePoint->hasSideEffects())) {
return false;
}
// Move forward one node at a time
while (curNode != movePoint) {
// never valid to reorder around a node with side effects
if (curNode->hasSideEffects()) {
return false;
}
if (workingSet.dependsOn(curNode)) {
// If we can't move past this node, add it to the working set
workingSet.add(curNode);
}
curNode = curNode->next_in_graph[direction];
}
// 2. Decide whether we can move it all to `movePoint`.
// Say we are moving directly before movePoint and `toMove` starts before
// movePoint in the graph. The move looks like
//
// `toMove` `toMove` |
// <dependencies> -> `movePoint` | `toMove` and deps are split
// `movePoint` <dependencies> |
//
// Contrast with the case where `toMove` starts AFTER movePoint:
//
// `movePoint` <dependencies> |
// <dependencies> -> `toMove` | `toMove` and deps are together
// `toMove` `movePoint` |
//
// In the first case, we need to split `this` off from its dependencies, so we
// can move the dependencies below `movePoint` and keep `toMove` above.
const bool splitToMoveAndDeps =
(moveSide == MoveSide::BEFORE && toMove->isBefore(movePoint)) ||
(moveSide == MoveSide::AFTER && toMove->isAfter(movePoint));
if (splitToMoveAndDeps) {
// remove `this` from dependencies to be moved past `movePoint`
workingSet.eraseMover();
}
// Check if we can move the working set past the move point
if (workingSet.dependsOn(movePoint)) {
// if we can't, then there are intermediate dependencies between the
// `this` and `movePoint`, so we can't do the move
return false;
}
if (dryRun) {
return true;
}
// 3. Execute the move
TORCH_INTERNAL_ASSERT(curNode == movePoint);
if (splitToMoveAndDeps) {
// Move `toMove`
move(toMove, movePoint, moveSide);
// Then move all of its dependencies on the other side of `movePoint`
const auto reversed =
moveSide == MoveSide::BEFORE ? MoveSide::AFTER : MoveSide::BEFORE;
for (auto n : workingSet.dependentNodes()) {
move(n, curNode, reversed);
curNode = n;
}
} else {
// Just append/prepend everything to `movePoint`
move(toMove, curNode, moveSide);
curNode = toMove;
for (auto n : workingSet.dependentNodes()) {
move(n, curNode, moveSide);
curNode = n;
}
}
return true;
}
// Helper function so we can generalize `tryMove`
void AliasDb::move(Node* toMove, Node* movePoint, MoveSide moveSide) {
switch (moveSide) {
case MoveSide::BEFORE:
toMove->moveBefore(movePoint);
break;
case MoveSide::AFTER:
toMove->moveAfter(movePoint);
break;
}
}
bool AliasDb::writesToWildcard(Node* n) const {
if (!writeIndex_->count(n)) {
return false;
}
const auto& writes = writeIndex_->at(n);
// Are any of these memoryLocs a wildcard element?
for (const auto& pr : wildcardIndex_) {
const auto wildcardElement = pr.second;
if (writes.test(wildcardElement->index)) {
return true;
}
}
return false;
}
bool AliasDb::mayAliasWildcard(const Value* v) const {
if (auto e = getWildcard(v->type())) {
return memoryDAG_->mayAlias(elementMap_.at(v), e);
}
// There were no wildcards of this type, so return false.
return false;
}
bool AliasDb::mayAliasWildcard(const at::ArrayRef<Value*> vs) const {
return std::any_of(
vs.begin(), vs.end(), [&](Value* v) { return mayAliasWildcard(v); });
}
std::optional<Element*> AliasDb::tryGetOrCreateWildcard(const TypePtr& type) {
auto maybe_mut_types = mapTypeToAliasTypeSetPtr(type);
if (!maybe_mut_types) {
return std::nullopt;
}
auto mut_type = toSingleType(*maybe_mut_types);
auto existing_wildcard = wildcardIndex_.find(*mut_type);
if (existing_wildcard != wildcardIndex_.end()) {
return existing_wildcard->second;
}
auto wildcard_elem = memoryDAGBuilder_->makeFreshValue(nullptr);
wildcardIndex_.emplace(*std::move(mut_type), wildcard_elem);
if (maybe_mut_types->size() > 1) {
pointUnionTypeElementToAllContainedTypes(wildcard_elem, *maybe_mut_types);
} else {
addContainedTypesToFreshElement(wildcard_elem, *maybe_mut_types);
}
return wildcard_elem;
}
void AliasDb::pointUnionTypeElementToAllContainedTypes(
Element* container_elem,
const AliasTypeSet& mut_types) {
for (const auto& mut_type : mut_types) {
auto maybe_elem = tryGetOrCreateWildcard(mut_type);
if (maybe_elem) {
TORCH_INTERNAL_ASSERT(*maybe_elem != container_elem);
memoryDAGBuilder_->makePointerTo(container_elem, *maybe_elem);
}
}
}
void AliasDb::addContainedTypesToFreshElement(
Element* container_elem,
const AliasTypeSet& mut_types) {
for (const auto& mut_type : mut_types) {
for (const auto& contained : mut_type->containedTypes()) {
auto maybe_elem = tryGetOrCreateWildcard(contained);
if (maybe_elem) {
memoryDAGBuilder_->addToContainedElements(*maybe_elem, container_elem);
}
}
}
}
// Search the wildcard index for an element that corresponds to the given type.
// Const version returns nullptr
Element* AliasDb::getWildcard(const TypePtr& type) const {
auto maybe_mut_types = mapTypeToAliasTypeSetPtr(type);
if (!maybe_mut_types) {
return {};
}
if (maybe_mut_types->size() > 1) {
auto union_type = UnionType::create(*maybe_mut_types);
// Get a <TypePtr, Element*> pair where the TypePtr is this Union
// type and the Element is the corresponding Wildcard
auto maybe_union_pair = wildcardIndex_.find(union_type);
if (maybe_union_pair != wildcardIndex_.end()) {
return (*maybe_union_pair).second;
}
} else {
// Get a <TypePtr, Element*> pair where the TypePtr is the given
// type and the Element is the corresponding Wildcard
auto type_pair = wildcardIndex_.find((*maybe_mut_types)[0]);
if (type_pair != wildcardIndex_.end()) {
return type_pair->second;
}
}
return {};
}
// Register `v` as a wildcard value.
std::optional<Element*> AliasDb::setWildcard(const Value* v) {
std::optional<Element*> maybe_wildcardElement =
tryGetOrCreateWildcard(v->type());
if (!maybe_wildcardElement) {
return std::nullopt;
}
// Ensure that we create a corresponding Element for `v` still, as it is an
// invariant that all mutable values have an Element
getOrCreateElement(v);
wildcards_.insert(v);
return maybe_wildcardElement;
}
void AliasDb::buildWrittenToLocationsIndex() {
MemoryLocations ret;
for (const auto& pr : *writeIndex_) {
const auto& writtenLocs = pr.second;
ret |= writtenLocs;
}
writtenToLocationsIndex_ = ret;
}
void Lint(const AliasDb* db) {
bool failed = false;
std::stringstream ss;
// Every mutable value in the system has a corresponding element.
for (const auto& v : db->graph_->all_values) {
if (!db->isMutableTypeInternal(v)) {
continue;
}
auto it = db->elementMap_.find(v);
if (it == db->elementMap_.end()) {
failed = true;
ss << "Value %" << v->debugName() << " of type " << v->type()->repr_str()
<< " wasn't found in the element map.\n"
<< "It was defined in " << *v->node();
}
}
TORCH_INTERNAL_ASSERT(!failed, ss.str());
// Two checks that we want to add but can't until the mutation API is more
// fully developed.
// - Every mutable value in the aliasdb belongs to the graph
// - All container values have contained elements
}
} // namespace torch::jit
```
|
```xml
import type { Selector } from '@reduxjs/toolkit';
import isDeepEqual from '@proton/shared/lib/helpers/isDeepEqual';
import type {
MaybeOptimisticStateObject,
OptimisticReducersMapObject,
StateFromOptimisticReducersMapObject,
WithOptimisticReducer,
WrappedOptimisticState,
} from '../types';
import { isOptimisticReducer, isOptimisticState } from '../utils/assertions';
import { getReducerMapEntries } from '../utils/combine-optimistic-reducers';
import getWithoutFailed from '../utils/get-without-failed';
import { sanitizeOptimisticReducerMapObject } from '../utils/transformers';
export const asIfNotFailed = <T extends {}, M extends OptimisticReducersMapObject<T>>(
state: T,
reducerMap: M
): StateFromOptimisticReducersMapObject<M> => {
const entries = getReducerMapEntries(sanitizeOptimisticReducerMapObject(reducerMap));
const stateWithOptimistics = state as MaybeOptimisticStateObject;
const newState = {} as any;
for (const [name, maybeReducer] of entries) {
const subState = stateWithOptimistics[name];
if (typeof maybeReducer === 'function') {
if (isOptimisticState(subState) && isOptimisticReducer(maybeReducer)) {
newState[name] = getWithoutFailed(subState, maybeReducer);
} else {
newState[name] = subState;
}
} else {
newState[name] = asIfNotFailed(subState, maybeReducer);
}
}
return newState;
};
export const asIfNotFailedSubSelector =
<T extends {}, Optimistics extends WrappedOptimisticState<T>>(reducer: WithOptimisticReducer<T>) =>
(subState: Optimistics) =>
getWithoutFailed(subState, reducer);
const selectIsFailed =
<T extends object>(state: T) =>
<M extends OptimisticReducersMapObject<T>>(reducerMap: M) =>
(selector: Selector<StateFromOptimisticReducersMapObject<M>>): boolean => {
const stateWithoutFailed = selector(asIfNotFailed(state, reducerMap));
const stateWithOptimistic = selector(state as StateFromOptimisticReducersMapObject<M>);
return !isDeepEqual(stateWithOptimistic, stateWithoutFailed);
};
export default selectIsFailed;
```
|
```php
@include('admin.layouts.components.asset_datatables')
@extends('admin.layouts.index')
@section('title')
<h1>
Data Pertanyaan
</h1>
@endsection
@section('breadcrumb')
<li class="active">Data Pertanyaan </li>
@endsection
@section('content')
@include('admin.layouts.components.notifikasi')
<div class="box box-info">
<div class="box-header with-border">
@if (can('u'))
<a href="{{ ci_route('buku_pertanyaan.form') }}" class="btn btn-social btn-success btn-sm visible-xs-block visible-sm-inline-block visible-md-inline-block visible-lg-inline-block"><i class="fa fa-plus"></i> Tambah</a>
@endif
@if (can('h'))
<a href="#confirm-delete" title="Hapus Data" onclick="deleteAllBox('mainform', '{{ ci_route('buku_pertanyaan.delete') }}')" class="btn btn-social btn-danger btn-sm visible-xs-block visible-sm-inline-block visible-md-inline-block visible-lg-inline-block hapus-terpilih"><i
class='fa fa-trash-o'
></i> Hapus</a>
@endif
</div>
{!! form_open(null, 'id="mainform" name="mainform"') !!}
<div class="box-body">
<div class="table-responsive">
<table class="table table-bordered table-hover" id="tabeldata">
<thead>
<tr>
<th><input type="checkbox" id="checkall" /></th>
<th class="padat">NO</th>
<th class="padat">AKSI</th>
<th>PERTANYAAN</th>
<th class="padat">TAMPIL</th>
</tr>
</thead>
</table>
</div>
</div>
</form>
</div>
@include('admin.layouts.components.konfirmasi_hapus')
@endsection
@push('scripts')
<script>
$(document).ready(function() {
var TableData = $('#tabeldata').DataTable({
responsive: true,
processing: true,
serverSide: true,
ajax: "{{ ci_route('buku_pertanyaan') }}",
columns: [{
data: 'ceklist',
class: 'padat',
searchable: false,
orderable: false
},
{
data: 'DT_RowIndex',
class: 'padat',
searchable: false,
orderable: false
},
{
data: 'aksi',
class: 'aksi',
searchable: false,
orderable: false
},
{
data: 'pertanyaan',
name: 'pertanyaan',
searchable: true,
orderable: true
},
{
data: 'tampil',
name: 'tampil',
class: 'padat',
searchable: false,
orderable: false
},
],
order: [
[3, 'asc']
]
});
if (hapus == 0) {
TableData.column(0).visible(false);
}
if (ubah == 0) {
TableData.column(2).visible(false);
}
});
</script>
@endpush
```
|
```yaml
description: Example binding for a node using a PWM clock
compatible: "test-clock-control-pwm-clock"
include: base.yaml
properties:
clocks:
required: true
description: Clock phandle array
```
|
Water Mill or Watermill, may refer to:
watermill, a mill that uses hydropower.
Milldam, which may include a water mill within the dam
Water wheel, the driving engine of the mill
List of watermills, listing several water mills called Watermill
The Watermill (Ruisdael), a 1660 painting by Jacob van Ruisdael
The Watermill (1958 tune) musical composition by Ronald Binge
Watermill (ballet), a 1972 ballet by Jerome Robbins
Watermill Theatre, a repertory theatre in Bagnor, Newbury, Berkshire, England, UK
Water Mill, New York, USA; a hamlet on Long Island in Suffolk County
Water Mill (LIRR station) of the Long Island Rail Road, in the hamlet of Water Mill
Water Mill (Water Mill, New York), a watermill listed on the National Register of Historic Places
The Watermill Center, a center for arts and the humanities
Watermill Cove, St. Mary's, Isles of Scilly
See also
Waterwheel (disambiguation)
Windmill (disambiguation)
Mill (disambiguation)
|
The Black Riders and Other Lines is a book of poetry written by American author Stephen Crane (1871–1900). It was first published in 1895 by Copeland & Day.
Composition and publication history
In the winter of 1893, Crane borrowed a suit from John Northern Hilliard and visited the critic and editor William Dean Howells, who introduced Crane to the poetry of Emily Dickinson. Crane was inspired by her writing and, within several months, wrote the beginnings of what became his first book of poetry. One friend recalled that he saw Crane's first attempts at poetry in mid-February 1894 and Hamlin Garland claimed in a later reminiscence that Crane brought him a pile of manuscripts the next month. Crane told friends that the poems came to him spontaneously and as pictures, saying, "They came, and I wrote them, that's all."
The Black Riders and Other Lines was published in May 1895 by Copeland & Day and marked Crane's first serious venture into poetry. It was Crane's second published volume, following Maggie: A Girl of the Streets (1893) and predating The Red Badge of Courage (1895). Its first printing was a limited run of 500 copies, with a few issued in vellum. The collection contained sixty-eight short poems written in Crane's sparse, unconventional style. The untitled "lines", as Crane referred to them, were differentiated by Roman numerals and written entirely in small capitals. Crane was 23 years old when the book was published.
Response
Many of the poems in The Black Riders and Other Lines depict a vengeful God inspired by the Old Testament interacting with disrespectful humans. Critics were especially focused on the book's apparent anti-religious themes. Harriet Monroe wrote that the book "is full of wisdom of yesteryear... as old-fashioned as Bob Ingersoll's fiery denunciations. Crane's startling utterances... somehow cease to startle after twenty years." Amy Lowell, however, found these themes reflective of Crane's own struggle with belief: "He disbelieved it and he hated it, but he could not free himself from it... Crane's soul was heaped with bitterness and this bitterness he flung back at the theory of life which had betrayed him". Elbert Hubbard, who had encouraged Crane's unusual poetry, was impressed by their unconventional structure: "The 'Lines' in The Black Riders seem to me wonderful: charged with meaning like a storage battery. But there is a fine defy in the flavour that warns the reader not to take too much or it may strike in. Who wants a meal of horseradish?"
Crane himself thought The Black Riders a superior work to his more famous novel The Red Badge of Courage. As he wrote, "the former is the more ambitious effort. In it, I am to give my ideas of life as a whole, so far as I know it, and the latter is a mere episode,—an amplification".
Poetry
Black riders came from the sea.
Three little birds in a row
In the Desert
Yes, I have a thousand tongues
Once there came a man
God fashioned the ship of the world carefully
Mystic shadow, bending near me,
I looked here
I stood upon a high place,
Should the wide world roll away,
In a lonely place,
"And the sins of the fathers shall be"
If there is a witness to my little life,
There was a crimson clash of war.
"Tell brave deeds of war."
There were many who went in huddled procession
In heaven
A god in wrath
A learned man came to me once
There was, before me
Once I saw mountains angry
Places among the stars
I saw a man pursuing the horizon
Behold, the grave of a wicked man
There was set before me a mighty hill
A youth in apparel that glittered
"Truth," said a traveller
Behold, from the land of the farther suns
Supposing that I should have the courage
Many workmen
Two or three angels
There was one I met upon the road
I stood upon a highway
A man saw a ball of gold in the sky
I met a seer
On the horizon the peaks assembled
The ocean said to me once
The livid lightnings flashed in the clouds
And you love me
Love walked alone
I walked in a desert
There came whisperings in the winds
I was in the darkness
Tradition, thou art for suckling children
Many red devils ran from my heart
"Think as I think," said a man
Once there was a man
I stood musing in a black world
You say you are holy
A man went before a strange God
Why do you strive for greatness, fool?
Blustering God
"It was wrong to do this," said the angel
A man toiled on a burning road
A man feared that he might find an assassin
With eye and with gesture
The sage lectured brilliantly
Walking in the sky
Upon the road of my life
There was a man and a woman
There was a man who lived a life of fire
There was a great cathedral
Friend, your white beard sweeps the ground
Once, I knew a fine song
If I should cast off this tattered coat
God lay dead in heaven
A spirit sped
See also
Stephen Crane bibliography
References
External links
Full text at Project Gutenberg
1895 poetry books
Works by Stephen Crane
American poetry collections
|
```java
/*
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
package org.apache.shardingsphere.test.it.sql.parser.internal.cases.sql.jaxb;
import lombok.Getter;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.LinkedList;
import java.util.List;
/**
* SQL test cases for XML root tag.
*/
@XmlRootElement(name = "sql-cases")
@Getter
public final class RootSQLCases {
@XmlElement(name = "sql-case")
private final List<SQLCase> sqlCases = new LinkedList<>();
}
```
|
The 1990–91 UNLV Runnin' Rebels basketball team represented the University of Nevada, Las Vegas in NCAA Division I men's competition in the 1990–91 season. The Runnin' Rebels, coached by Jerry Tarkanian, entered the season as defending national champions and entered the 1991 NCAA tournament unbeaten, but lost in the national semifinal to eventual champions Duke when Anderson Hunt's desperation three in the final seconds bounced off the backboard and into the hands of a Duke player, Bobby Hurley, ending a 45-game winning streak that dated back to the previous season. They had been the last team to finish the regular season unbeaten before St. Joseph's did it in 2004. They were the last team to enter the NCAA tournament unbeaten until Wichita State did it in 2014, Kentucky in 2015, and Gonzaga in 2021.
The team played its home games in the Thomas & Mack Center, and was a member of the Big West Conference.
UNLV’s semi-final loss in the NCAA tournament brought an end to their astounding 45-game win streak. That is the fourth-longest consecutive-game win streak in NCAA Division 1 basketball history, and the longest win streak since the longest one ever (by UCLA) ended in 1974.
They are often called the greatest college basketball team to not win the championship.
Roster
1990-91 UNLV Roster and Stats
Schedule and results
|-
!colspan=12 style=| Regular Season
|-
!colspan=12 style=| Big West tournament
|-
!colspan=12 style=| NCAA Tournament
Sources 1990-91 UNLV Schedule and Results
Rankings
Awards and honors
Larry Johnson – Naismith College Player of the Year, USBWA College Player of the Year, John R. Wooden Award
Stacey Augmon – NABC Defensive Player of the Year (3)
Team players drafted into the NBA
References
Unlv
UNLV Runnin' Rebels basketball seasons
NCAA Division I men's basketball tournament Final Four seasons
Unlv
Unlv
Unlv
|
Bunnyman (also known as The Bunnyman Massacre in the United Kingdom) is a 2011 American slasher film written, directed and produced by Carl Lindbergh. The film spawned two sequels, Bunnyman 2 released in 2014, and Bunnyman Vengeance which was released on October 20, 2017 on VOD, and November 21st on Blu-ray and DVD.
Plot
The film opens to a snuff film, consisting of 8 mm footage of a handcuffed woman being stabbed to death. The film then switches to six friends, who are driving through a desolate area. They find themselves being harassed by a truck, driven by a man in a rabbit costume who refuses to communicate with them, or show himself to them. He forces them to pull over and parks behind them. After an indeterminate length of time the costumed man drives away and kills a woman he was holding captive by ripping her in half with chains attached to his truck.
Eventually, the Bunnyman returns and causes the group's car to crash, killing Jack a short while later when he rams the vehicle from behind as Jack is working underneath it. The remaining five proceed to travel on foot, encountering a deranged hillbilly, a woman called Melissa, and a man who advises them to seek shelter in a supposedly abandoned cabin nearby, saying they will return for them after a trip to the hospital. In reality, the two are disposing of the bodies of some of the Bunnyman's victims. On route to the cabin, two of the quintet spot the Bunnyman butchering bodies and he kills one of them with a chainsaw.
Chased to the cabin which belongs to the Bunnyman, the group loses two more members when Mike is killed with a chainsaw, and Tiffany is captured and tortured to death by the Bunnyman and his demented, hunchbacked accomplice, Pops. After the Bunnyman hacks Tiffany's body to pieces and sits down to eat her flesh with Pops and Melissa, the remaining two travelers, Rachel and John, are captured while trying to get Melissa's car keys. As Melissa prepares to murder a bound Rachel, John manages to free himself from his restraints, kills Melissa, and takes her keys and car.
As John and Rachel flee, they are chased by the Bunnyman's truck again. Concocting a plan the two pull over and John exits the vehicle carrying an unmoving Rachel who he offers to the Bunnyman. The Bunnyman hesitantly takes Rachel and places her in the cab of his truck, where she springs to life and stabs him in the neck with a pair of scissors, wounding him, and she kicks him out onto the road and driving away after John gets into the truck. As Rachel laments "We're going to need a lot of therapy" the wounded Bunnyman is shown walking off into the sunset. The credits then roll, alongside more 8mm footage depicting what appears to be the young Bunnyman and his family.
Cast
Reception
A score of one out of five was awarded by Vegan Voorhees, which described the film as "idiotic" and concluded the review with, "Despite director/writer/producer/actor Lindbergh's impressive enough camera work and production polish, everything that happens in Bunnyman happens wrong. Like a bitter, out of date Easter egg, it's shiny and pretty on the outside and sickening under the foil". 28 Days Later Analysis called Bunnyman an incompetent and frustrating mess, gave it a "generous" three out of ten, and wrote "atrocious acting, zero character development, no tension, zero sense of pacing, poorly written, continuity errors abound, audio problems, ADR and dubbing, poorly written characters, forced tension, meandering story, etc." Gorepress also gave an overwhelmingly negative critique, stating "The Bunnyman Massacre is literally the worst film I've seen in years. Decades, even. Why? Well – simply put – because it's appallingly made on every single level".
Andy Breslow wrote about Grindhouse Edition of the film as: "Bunnyman: Grindhouse Edition is a fun little romp into exploitation territory…when it isn't getting in its own way".
Bethany Rose of Influx magazine said that "Writer/director Carl Lindbergh actually creates a new villain to entertain audiences".
Horror News Network said that "The Bunnyman Massacre'' is better for what it wants to be and the imagery it leaves behind with its title character. Other than that, it is another forgettable entry into low budget independent horror".
References
External links
2011 films
2011 horror films
2011 independent films
2010s road movies
2010s serial killer films
2010s slasher films
2010s teen horror films
American independent films
American road movies
American serial killer films
American slasher films
American teen horror films
Direct-to-video horror films
Films based on urban legends
Films about snuff films
Films set in California
Films shot in California
Films about cannibalism
Trucker films
2010s American films
|
A punching bag (or British English punchbag) is a sturdy bag designed to be repeatedly punched. A punching bag is usually cylindrical and filled with various materials of suitable hardness.
History
Punching bags have been used in martial arts and swordplay for the entire written history of military training. Similar apparatus in Asian martial arts include the Okinawan makiwara and the Chinese mook jong, which may have padded striking surfaces attached to them.
In martial arts and combat sports—such as karate, taekwondo, and Muay Thai—"heavy" bags, standing bags, and similar apparatuses have been adapted for practicing kicking and other striking maneuvers in addition to developing punching technique.
Construction
Punching bags are often filled with grains, sand, rags, or other material, and are usually hung from the ceiling or affixed to a stand. Other bags have an internal bladder to allow them to be filled with air or water. The design of a punching bag allows it to take repeated and constant physical abuse without breaking. The bag must also absorb the impact of blows without causing harm to the user.
Types
There are different types of punching bags, with different names based on their size, use and mounting method. Almost all punching bags are covered with either leather or synthetic materials such as vinyl which resist abrasion and mildew. Canvas can also be used as a bag material where there is lower use and humidity.
Speed bags (AKA, speedballs) are small, air-filled bags anchored at the top to a rebound platform parallel to the ground. Speed bags help a fighter learn to keep their hands up, improve hand-eye coordination, and learn to shift weight between feet when punching. They are also known as speedballs or speed ball bags. They are generally filled with air and fitted around a tight PU-based or leather material. They come in various sizes, ranging from the large and , midsize , and , to the small , and . Generally the larger the bag, the slower it is and the more force is required to keep it going. Large bags are used more for building strength and endurance, while smaller bags allow the training athlete to focus on faster hand speed, timing and coordination. Beginners might view this bag more as a "control bag", not a speed bag, for they will not be able to punch both quickly and repetitively until they gain control over their swinging force and speed.
A boxer normally hits the speed bag from the front with his or her fists, but it is also possible to use fists and elbows to hit the bag from all around it, including the front, back and sides. In this method the user may perform many diverse punching combinations that create improvised rhythmic accents.
Although speed bags are normally hung vertically, recently the additional method of hanging a bag horizontally on a wall has regained popularity. This was very popular during the early twentieth century, specifically the 1920s–1940s era. The same punching skills may be used on the horizontal bag that are used when it hangs vertically. A coordination bag is a new type of speed bag that moves unpredictably rather than rhythmically. Additionally, due to the tedious mounting and anchoring necessary when installing a traditional speed bag platform, a portable speed bag platform that installs in a doorway has been created. Designed so that downward pressure stabilizes this portable speed bag platform, it can be installed and removed through a tension system that allows for use in any doorway.
Swerve balls/floor-to-ceiling balls/double-end bags are almost the same as speed bags, with the only differences being that the bag' size, shape and material may be different, and that the cable system is attached to both the ceiling and a clip on the floor — when the boxer makes any strike on the ball, it reacts by swinging fast towards them, the object being to swerve, punch, dodge and improve co-ordination. The harder and faster these bags are hit, the more they rebound and react in different motions and angles, thus giving broader practice to the fighter. Double-floor to ceiling balls which allow for training body-head combinations also exist.
Maize bags or slip bags are not punched with great force, but are used in boxing training to improve the athlete's head motion and ability to evade an opponent's punch, their name deriving from the fact that traditionally they are filled with maize.
A heavy bag is a larger, cylindrical bag, usually suspended by chains or ropes and used for practicing powerful body punches, and can be used to toughen hands or any other limb used to hit the bag. Heavy bags are for developing power; technique is best learned on the punch mitts or pads. Some variants of heavy bag are a Banana Bag used in Muay Thai, which is longer than a regular heavy bag and is used to train low kicks and knee strikes, and a slim line bag that is thinner than a heavy bag.
Freestanding heavy bags are heavy bags mounted on a weighted pedestal rather than being hung from above. The base is typically filled with sand or water to give more stability to the bag and prevent it from moving around. While they serve the same purpose as hanging heavy bags, they can also be toppled over and used for ground-and-pound practice. Other variations on the standard heavy bag include horizontal suspension from both ends to practice uppercut punches, and non-cylindrical shapes. Freestanding reflex bags (freestanding speed bags) also exist.
Uppercut bags began to appear towards the beginning of the 21st century. With so many different variations of bags and training equipment for boxing taking off, the uppercut bag was and is still a common sight in clubs and gyms.
Designed for uppercut practice, jabbing, curl punching and quick bursts of high and low punching practice, it allows the fighter to punch at different lengths, different speeds and different forces compared to the standard average 4-foot straight PU (polyurethane) punching bags. Some types of uppercut bags: An angle bag a variant of uppercut bag used for training hooks and uppercuts; an uppercut horizontal punching tag, teardrop bag, body snatcher/wrecking ball bag or bowling pin bag are used for training knees and uppercuts.
A wall bag is a type of bag that is attached to a wall and can be used for training hooks and uppercuts.
Body-shaped training aids such as the modern "body opponent bag" are made primarily of synthetic materials, and punching bags are sometimes mounted on a weighted pedestal rather than hanging from above. These bags try to simulate a live opponent while providing an opportunity to practice vital area strikes which are generally unsafe to perform on a sparring partner. These are not considered punching bags in the strict sense, but modern versions of apparatus such as the wooden man apparatus of Chinese Wing Chun, the medieval quintain, and target dummies used in modern bayonet training. Large inflatable balloons with weighted bases are another kind of punching bag, often painted with a picture and sold as a children's toy.
Safety precautions
Heavy bags are typically filled with dense material which have little "give" (e.g., packed sand, grains, etc.); in order to avoid injury, hand protection (boxing gloves, bag gloves, training gloves, hand wraps, etc.) is used during practice.
Powerful strikes to the heavy bag are not recommended for inexperienced, or younger athletes (<18 female, <21 male), as risk of sprain, strain, or bone-plate damage may adversely affect bone structures. It is highly recommended to carefully focus strikes to reduce chance of injury (such as boxer's fracture).
See also
Strength tester machine – some of these machines utilize a punching bag
References
Articles containing video clips
Boxing
Exercise equipment
Martial arts equipment
|
```go
/*
path_to_url
Unless required by applicable law or agreed to in writing, software
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
package util
import (
"context"
"time"
"k8c.io/kubermatic/v2/pkg/kubernetes"
"k8c.io/kubermatic/v2/pkg/resources"
appsv1 "k8s.io/api/apps/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/util/wait"
ctrlruntimeclient "sigs.k8s.io/controller-runtime/pkg/client"
)
// WaitForDeploymentRollout queries k8s until a deployment with the supplied version exists and
// has been rolled out, or until the timeout is reached.
func WaitForDeploymentRollout(ctx context.Context, client ctrlruntimeclient.Client, deployment *appsv1.Deployment, version string, timeout time.Duration) error {
return wait.PollUntilContextTimeout(ctx, 1*time.Second, timeout, true, func(ctx context.Context) (bool, error) {
dep := &appsv1.Deployment{}
if err := client.Get(ctx, ctrlruntimeclient.ObjectKeyFromObject(deployment), dep); err != nil {
if apierrors.IsNotFound(err) {
return false, nil
}
return false, err
}
if dep.Labels[resources.VersionLabel] != version {
return false, nil
}
return kubernetes.IsDeploymentRolloutComplete(dep, 0)
})
}
```
|
Schliessler is a surname. Notable people with the surname include:
Martin Schliessler (1929–2008), German adventurer, cinematographer, and sculptor
Tobias A. Schliessler (born 1958), German cinematographer
|
```java
package com.airbnb.epoxy;
import android.view.View;
import androidx.annotation.Dimension;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.PluralsRes;
import androidx.annotation.StringRes;
import java.lang.Boolean;
import java.lang.CharSequence;
import java.lang.Integer;
import java.lang.Number;
import java.lang.Object;
import java.lang.String;
import java.util.List;
import kotlin.jvm.functions.Function2;
@EpoxyBuildScope
public interface TestManyTypesViewModelBuilder {
TestManyTypesViewModelBuilder onBind(
OnModelBoundListener<TestManyTypesViewModel_, TestManyTypesView> listener);
TestManyTypesViewModelBuilder onUnbind(
OnModelUnboundListener<TestManyTypesViewModel_, TestManyTypesView> listener);
TestManyTypesViewModelBuilder onVisibilityStateChanged(
OnModelVisibilityStateChangedListener<TestManyTypesViewModel_, TestManyTypesView> listener);
TestManyTypesViewModelBuilder onVisibilityChanged(
OnModelVisibilityChangedListener<TestManyTypesViewModel_, TestManyTypesView> listener);
TestManyTypesViewModelBuilder enabled(boolean enabled);
TestManyTypesViewModelBuilder stringValue(@NonNull String stringValue);
TestManyTypesViewModelBuilder functionType(
@NonNull Function2<? super String, ? super String, Integer> functionType);
TestManyTypesViewModelBuilder listOfDataClass(@NonNull List<SomeDataClass> listOfDataClass);
TestManyTypesViewModelBuilder listOfEnumClass(@NonNull List<SomeEnumClass> listOfEnumClass);
TestManyTypesViewModelBuilder nullableStringValue(@Nullable String nullableStringValue);
TestManyTypesViewModelBuilder intValue(int intValue);
TestManyTypesViewModelBuilder intValueWithDefault(int intValueWithDefault);
TestManyTypesViewModelBuilder intValueWithAnnotation(@StringRes int intValueWithAnnotation);
TestManyTypesViewModelBuilder intValueWithRangeAnnotation(
@IntRange(from = 0, to = 200) int intValueWithRangeAnnotation);
TestManyTypesViewModelBuilder intValueWithDimenTypeAnnotation(
@Dimension(unit = 0) int intValueWithDimenTypeAnnotation);
TestManyTypesViewModelBuilder intWithMultipleAnnotations(
@IntRange(from = 0, to = 200) @Dimension(unit = 0) int intWithMultipleAnnotations);
TestManyTypesViewModelBuilder integerValue(int integerValue);
TestManyTypesViewModelBuilder boolValue(boolean boolValue);
TestManyTypesViewModelBuilder models(@NonNull List<? extends EpoxyModel<?>> models);
TestManyTypesViewModelBuilder booleanValue(@Nullable Boolean booleanValue);
TestManyTypesViewModelBuilder arrayValue(@Nullable String[] arrayValue);
TestManyTypesViewModelBuilder listValue(@Nullable List<String> listValue);
TestManyTypesViewModelBuilder clickListener(
@Nullable final OnModelClickListener<TestManyTypesViewModel_, TestManyTypesView> clickListener);
TestManyTypesViewModelBuilder clickListener(@Nullable View.OnClickListener clickListener);
TestManyTypesViewModelBuilder customClickListener(
@Nullable CustomClickListenerSubclass customClickListener);
TestManyTypesViewModelBuilder title(@Nullable CharSequence title);
TestManyTypesViewModelBuilder title(@StringRes int stringRes);
TestManyTypesViewModelBuilder title(@StringRes int stringRes, Object... formatArgs);
TestManyTypesViewModelBuilder titleQuantityRes(@PluralsRes int pluralRes, int quantity,
Object... formatArgs);
TestManyTypesViewModelBuilder myProperty(int myProperty);
TestManyTypesViewModelBuilder myNullableProperty(@Nullable Integer myNullableProperty);
TestManyTypesViewModelBuilder delegatedProperty(int delegatedProperty);
TestManyTypesViewModelBuilder id(long p0);
TestManyTypesViewModelBuilder id(@Nullable Number... p0);
TestManyTypesViewModelBuilder id(long p0, long p1);
TestManyTypesViewModelBuilder id(@Nullable CharSequence p0);
TestManyTypesViewModelBuilder id(@Nullable CharSequence p0, @Nullable CharSequence... p1);
TestManyTypesViewModelBuilder id(@Nullable CharSequence p0, long p1);
TestManyTypesViewModelBuilder spanSizeOverride(@Nullable EpoxyModel.SpanSizeOverrideCallback p0);
}
```
|
```java
/*
*/
package azureactivedirectoryauthentication.src.main.java;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import com.microsoft.sqlserver.jdbc.SQLServerDataSource;
/**
* Sample application that demonstrates how to establidh secure connection to Azure Database, Azure Data Warehouse and
* any other cloud database. Users can use 'ActiveDirectoryPassword' or 'ActiveDirectoryIntegrated' Authentication modes
* as per their needs.
*
* This test can be used to establish connection by both modes on any operating system, if required setup is provided
* for Active Directory Integrated Authentication.
*
* For testing 'ActiveDirectoryIntegrated' Authentication, do one of the following:
*
* 1. Generate Kerberos Ticket and validate its availability with klist tool, or
*
* 2. Place mssql-jdbc_auth in the same directory as the pom.xml file. (Only applicable for Windows OS)
*
* For testing 'ActiveDirectoryPassword' Authentication, none of the above setup is required.
*
*/
public class AzureActiveDirectoryAuthentication {
public static void main(String[] args) {
String serverName = null;
String portNumber = null;
String databaseName = null;
String username = null;
String password = null;
String authentication = null;
String hostNameInCertificate = null;
try (InputStreamReader in = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(in)) {
System.out.println("For testing 'ActiveDirectoryIntegrated' Authentication, do one of the following:");
System.out.println(" 1. Generate Kerberos Ticket and validate its availability with klist tool, or");
System.out.println(" 2. Place mssql-jdbc_auth-${version}.${JVMBitness}.dll in the same directory as the pom.xml file.");
System.out.println(
"For testing 'ActiveDirectoryPassword' Authentication, none of the above setup is not required.");//
System.out.println();
// Start capturing database info
System.out.print("Enter server name: ");
serverName = br.readLine();
System.out.print("Enter port number: ");
portNumber = br.readLine();
System.out.print("Enter database name: ");
databaseName = br.readLine();
System.out.print("Enter username: ");
username = br.readLine();
System.out.print("Enter password: ");
password = br.readLine();
System.out.print("Enter authentication: "); // e.g. ActiveDirectoryPassword / ActiveDirectoryIntegrated
authentication = br.readLine();
System.out.print("Enter host name in certificate: "); // e.g. *.database.windows.net
hostNameInCertificate = br.readLine();
// Establish the connection.
SQLServerDataSource ds = new SQLServerDataSource();
ds.setServerName(serverName);
ds.setPortNumber(Integer.parseInt(portNumber));
ds.setDatabaseName(databaseName);
ds.setUser(username);
ds.setPassword(password);
ds.setAuthentication(authentication);
ds.setHostNameInCertificate(hostNameInCertificate);
try (Connection con = ds.getConnection(); Statement stmt = con.createStatement();) {
System.out.println();
System.out.println("Connection established successfully.");
// Create and execute an SQL statement that returns user name.
String SQL = "SELECT SUSER_SNAME()";
try (ResultSet rs = stmt.executeQuery(SQL)) {
// Iterate through the data in the result set and display it.
while (rs.next()) {
System.out.println("user name: " + rs.getString(1));
}
}
}
}
// Handle any errors that may have occurred.
catch (Exception e) {
e.printStackTrace();
}
}
}
```
|
Henryetta is a city in Okmulgee County, Oklahoma, United States. The population was 5,640 at the 2020 census.
History
Hugh Henry established a ranch on Creek Nation land in 1885. He soon found a deposit of coal, which he began using to fuel the forge at his ranch. Discovery of more coal deposits in the large Henryetta Coal Formation attracted several railroads to develop these mines. A settlement named Furrs grew up around the mines. The name changed to Henryetta when a post office opened on August 28, 1900.
At statehood in 1907, Henryetta had 1,051 residents. The economy was based on agriculture, coal, natural gas and oil. In 1909, the area had 14 coal mines, producing 65,000 tons per month. By 1910, the population had grown to 1,671. The town added a broom factory, several brick factories and a bottling plant during the 1920s. By the time of the 36th annual report of the Department of Mines and Minerals in 1943, combined yearly production by Acme Coal Company, Atlas Coal Company, Ben Hurr Coal Company, Starr Coal Company, and Wardin-Pullen Coal Company—all of Henryetta—was over 600,000 tons.
Henryetta's manufacturing base continued to expand. Pittsburgh Plate Glass (PPG) built a plate glass window plant in Henryetta in 1929–30, employing 900 people and claiming to be the largest west of the Mississippi River. The factory closed in 1974, but was purchased and refitted for making glass containers, and continues in operation by Anchor Glass Container.
Eagle-Picher placed a massive zinc smelting facility in the Spelter City area of town, which continued through the 1960’s. The company also employed more than 700 people at its plant that extracted the rare metal germanium. The plant has since closed and become a Superfund cleanup site.
Besides Anchor Glass, current employers include the international oilfield-services company Shawcor; Henryetta Pallet, a regional wood pallet manufacturer; and, G&H Decoy, a waterfowl decoy manufacturer since 1934.
On May 1, 2023, six people were killed in a
mass murder in Henryetta,
allegedly by Jesse McFadden.
Geography
According to the United States Census Bureau, the city has a total area of , of which is land and (0.66%) is water.
Demographics
As of the census of 2000, there were 6,096 people, 2,460 households, and 1,589 families residing in the city. The population density was . There were 2,844 housing units at an average density of . The racial makeup of the city was 79.69% White, 0.57% African American, 12.30% Native American, 0.33% Asian, 0.02% Pacific Islander, 0.79% from other races, and 6.30% from two or more races. Hispanic or Latino of any race were 2.20% of the population.
There were 2,460 households, out of which 14.8% had a female householder with no husband present, and 35.4% were non-families. 31.9% of all households were made up of individuals, and 17.3% had someone living alone who was 65 years of age or older. The average household size was 2.39 and the average family size was 3.00.
In the city, the population was spread out, with 25.9% under the age of 18, 8.3% from 18 to 24, 23.6% from 25 to 44, 22.5% from 45 to 64, and 19.7% who were 65 years of age or older. The median age was 39 years. For every 100 females, there were 86.3 males. For every 100 females age 18 and over, there were 80.1 males.
The median income for a household in the city was $20,115, and the median income for a family was $24,760. Males had a median income of $28,661 versus $14,268 for females. The per capita income for the city was $11,908. About 19.9% of families and 22.8% of the population were below the poverty line, including 29.8% of those under age 18 and 17.8% of those age 65 or over.
Government
Henryetta has a council-manager form of government with an elected mayor.
Transportation
Henryetta is at the crossroads of Interstate 40, being a major east–west interstate highway through the south-central portion of the United States, and U.S. Route 75, being a major north–south highway currently extending from Noyes, Minnesota on the Canada–United States border south to Dallas, Texas. Henryetta is also served by US Route 266 and Oklahoma State Highway 124.
Henryetta Municipal Airport (FAA ID: F10), owned by the City of Henryetta, is located about 3 miles southwest and offers a 3501 x 50 ft. (1067 x 15 m) paved runway.
Commercial air transportation is available out of Tulsa International Airport, about 60 miles to the north.
Henryetta is served by the KI BOIS Area Transit System ("KATS"), a low-cost public bus/van service established in 1983 to help communities, primarily in southeast Oklahoma, by providing access to Senior Citizen centers, groceries, medical services, and jobs. Their service includes transportation to Okmulgee and Tulsa.
Notable people
Troy Aikman: NFL Hall of Fame quarterback
Alice Ghostley: actress (Bewitched, Grease, Designing Women),
Mark Ryal: former Major League baseball player.
Jim Shoulders: rodeo favorite
Steven W. Taylor: Oklahoma Supreme Court Chief Justice
Events
Henryetta has two large annual rodeos, being the Jim Shoulders Spring Roundup Rodeo in June and the Living Legends Rodeo over Labor Day Weekend.
Parks and recreation
Just south of town is Nichols Park, developed between 1938 and 1941 by the Civilian Conservation Corps and the National Park Service, which is over 300 acres in size, and includes the 17 acre Nichols Lake offering fishing opportunities.
The park hosts many outdoor activities such as disc golf, baseball, all terrain vehicle off road trails, hiking trails, several playgrounds, multiple covered shelters for picnicking, primitive campsites, and large open fields for events. In June 2022, Nichol's park was the site of the town's Highway to Henryetta event. This event was a charity event planned, to bring much needed revenue to the town and Henryetta schools.
Jim Hall Lake, also known as Lake Henryetta, is 450 surface acres southeast of town. Amenities include boat ramps, docks, primitive campsites, picnic areas, and outdoor grills.
Lake Henryetta is the town's source of public drinking water.
Historic locations
The Henryetta Historical Museum is housed in what was the town's first schoolhouse, and later what was the town's first courthouse.
The Henryetta Golf Course and Country Club was established in the 1920s. It is open year-round and usually does not require advance tee-time reservations.
Both the Hugh Henry House on N. 3rd St., and Nichols Park located 1.9 miles south of the junction of Lake Rd. and Main St., are included on the National Register of Historic Places listings in Okmulgee County, Oklahoma.
Cultural
Both the Henryetta Free-Lance and TheHenryettan.com offer news services to the community.
Henryetta's school teams were known for their unusual nickname, the "Mud Hens" (later "Hens" and "Fighting Hens"), until a student petition led to a name change (to "Knights") in 1989.
Henryetta is notable in its theatrical performances, most of which is done by the drama team of its local high school. A showcase of over 15 musical songs was performed in February 2023, which was labeled "a success".
References
External links
Encyclopedia of Oklahoma History and Culture - Henryetta
Cities in Oklahoma
Cities in Okmulgee County, Oklahoma
Muscogee (Creek) Nation
Tulsa metropolitan area
Sundown towns in Oklahoma
|
The 2016 FIFA U-17 Women's World Cup was the fifth edition of the FIFA U-17 Women's World Cup, the biennial international women's youth football championship contested by the under-17 national teams of the member associations of FIFA. The tournament was held in Jordan from 30 September to 21 October 2016.
While the role of women in sport was regarded as controversial due to cultural and religious conservatism in some countries of the Middle East, this tournament was the first female FIFA tournament held in the region.
Host selection
The following countries submitted a bid to host the tournament by the May 2013 deadline:
On 5 December 2013, the FIFA Executive Committee announced that the tournament would be held in Jordan.
Qualified teams
A total of 16 teams qualified for the final tournament. In addition to Jordan who qualified automatically as hosts, the other 15 teams qualified from six separate continental competitions. The slot allocation was published in June 2014.
1.Teams that made their debut.
Venues
The three host cities were Amman, Irbid, and Zarqa. The infrastructure of the stadiums and surrounding areas in the host cities was developed. Greater Amman Municipality and the Higher Council for Youth were responsible for developing the infrastructure, with 30% under the responsibility of the municipality and 70% under the responsibility of the council.
Emblem
The official emblem was unveiled on 3 May 2015, which was designed to showcase Jordan's most iconic symbols. Visual aspects of the Jordanian culture can be seen on the emblem that has the traditional shape of the FIFA U-17 Women's World Cup Trophy, which include; the distinctive pattern of the Jordanian Keffieh, the Jordanian national flower Black Iris, Pan Arab colors and a star from the Jordanian flag.
Mascot
In a FIFA press conference on 28 May 2016, the tournament mascot, "Aseela", was introduced. Aseela is an Arabian oryx, which is a rare animal that happens to be the national animal of Jordan. The Arabian Oryx was chosen for being a symbol of " strength, gentleness, and athleticism", resembling female football players. The mascot is expected to inspire young women across Jordan and the region to participate in watching the tournament.
Theme Song
The Official song for the 2016 FIFA Women U-17 World Cup is 'Jordan our Playground' Composed by Lebanese Singer Carole Samaha and her Jordanian counterpart Hussein Al Salman
Squads
Each team named a squad of 21 players (three of whom must be goalkeepers) by the FIFA deadline. All players must be born on or after 1 January 1999, and on or before 31 December 2001. The official squads were announced on 23 September 2016.
Match officials
A total of 16 referees, 1 reserve referee, and 28 assistant referees were appointed by FIFA for the tournament.
Draw
The official draw was held on 30 May 2016, 18:00 EEST (UTC+3), at the Al Hussein Cultural Centre in Amman. The teams were seeded based on their performances in previous U-17 Women's World Cups and confederation tournaments, with the hosts Jordan automatically seeded and assigned to position A1. Teams of the same confederation could not meet in the group stage.
Group stage
The match schedule was approved by the FIFA Executive Committee on 25 May 2015, and officially announced on 10 August 2015.
The top two teams of each group advance to the quarter-finals. The rankings of teams in each group are determined as follows:
If two or more teams are equal on the basis of the above three criteria, their rankings are determined as follows:
All times are local, EEST (UTC+3).
Group A
Group B
Group C
Group D
Knockout stage
In the knockout stages, if a match is level at the end of normal playing time, a penalty shoot-out is used to determine the winner (no extra time is played).
Quarter-finals
Semi-finals
Third place match
Final
Winners
Goalscorers
8 goals
Lorena Navarro
5 goals
Ri Hae-yon
Deyna Castellanos
4 goals
Riko Ueki
3 goals
Georgia Stanway
Giulia Gwinn
Jun Endo
Sakura Nojima
Hana Takahashi
Hannah Blake
Kim Pom-ui
Eva Navarro
Civana Kuhlmann
Ashley Sanchez
2 goals
Lena Oberdorf
Gifty Acheampong
Sandra Owusu-Ansah
Saori Takarada
Jazmín Enrigue
Daniela Espinosa
Lizbeth Ovalle
Sam Tawharu
Ja Un-yong
Clàudia Pina
Frankie Tagliaferri
1 goal
Kerolin
Micaelly
Claudia Dabda
Soline Djoubi
Alexandra Takounda
Jordyn Huitema
Deanne Rose
Sarah Stratigakis
Hannah Taylor
Ellie Brazil
Alessia Russo
Klara Bühl
Remina Chiba
Oto Kanno
Hinata Miyazawa
Sarah Abu-Sabbah
Verónica Avalos
Dayana Cázares
Gabriela Juárez
Jimena López
Celiana Torres
Ko Kyong-hui
Sung Hyang-sim
Limpia Fretes
Laia Aleixandri
Natalia Ramos
Kiara Pickett
Maria Cazorla
Yerliane Moreno
Own goal
Lucía Rodríguez (against Japan)
Awards
The following awards were given for the tournament:
References
External links
FIFA U-17 Women's World Cup Jordan 2016, FIFA.com
FIFA Technical Report
2016 in Jordanian sport
2016 in women's association football
2016 in youth sport
2016
2016 FIFA U-17 Women's World Cup
October 2016 sports events in Asia
September 2016 sports events in Asia
2016 in youth association football
|
```c++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
* This Source Code Form is subject to the terms of the Mozilla Public
* file, You can obtain one at path_to_url */
/*
* JS parser.
*
* This is a recursive-descent parser for the JavaScript language specified by
* "The JavaScript 1.5 Language Specification". It uses lexical and semantic
* feedback to disambiguate non-LL(1) structures. It generates trees of nodes
* induced by the recursive parsing (not precise syntax trees, see Parser.h).
* After tree construction, it rewrites trees to fold constants and evaluate
* compile-time expressions.
*
* This parser attempts no error recovery.
*/
#include "frontend/Parser-inl.h"
#include "jsapi.h"
#include "jsatom.h"
#include "jscntxt.h"
#include "jsfun.h"
#include "jsobj.h"
#include "jsopcode.h"
#include "jsscript.h"
#include "jstypes.h"
#include "asmjs/AsmJSValidate.h"
#include "frontend/BytecodeCompiler.h"
#include "frontend/FoldConstants.h"
#include "frontend/ParseMaps.h"
#include "frontend/TokenStream.h"
#include "vm/Shape.h"
#include "jsatominlines.h"
#include "jsscriptinlines.h"
#include "frontend/ParseNode-inl.h"
using namespace js;
using namespace js::gc;
using mozilla::Maybe;
using JS::AutoGCRooter;
namespace js {
namespace frontend {
typedef Rooted<StaticBlockObject*> RootedStaticBlockObject;
typedef Handle<StaticBlockObject*> HandleStaticBlockObject;
typedef Rooted<NestedScopeObject*> RootedNestedScopeObject;
typedef Handle<NestedScopeObject*> HandleNestedScopeObject;
/* Read a token. Report an error and return null() if that token isn't of type tt. */
#define MUST_MATCH_TOKEN(tt, errno) \
JS_BEGIN_MACRO \
TokenKind token; \
if (!tokenStream.getToken(&token)) \
return null(); \
if (token != tt) { \
report(ParseError, false, null(), errno); \
return null(); \
} \
JS_END_MACRO
static const unsigned BlockIdLimit = 1 << ParseNode::NumBlockIdBits;
template <typename ParseHandler>
bool
GenerateBlockId(TokenStream& ts, ParseContext<ParseHandler>* pc, uint32_t& blockid)
{
if (pc->blockidGen == BlockIdLimit) {
ts.reportError(JSMSG_NEED_DIET, "program");
return false;
}
MOZ_ASSERT(pc->blockidGen < BlockIdLimit);
blockid = pc->blockidGen++;
return true;
}
template bool
GenerateBlockId(TokenStream& ts, ParseContext<SyntaxParseHandler>* pc, uint32_t& blockid);
template bool
GenerateBlockId(TokenStream& ts, ParseContext<FullParseHandler>* pc, uint32_t& blockid);
template <typename ParseHandler>
static void
PushStatementPC(ParseContext<ParseHandler>* pc, StmtInfoPC* stmt, StmtType type)
{
stmt->blockid = pc->blockid();
PushStatement(pc, stmt, type);
}
template <>
bool
ParseContext<FullParseHandler>::checkLocalsOverflow(TokenStream& ts)
{
if (vars_.length() + bodyLevelLexicals_.length() >= LOCALNO_LIMIT) {
ts.reportError(JSMSG_TOO_MANY_LOCALS);
return false;
}
return true;
}
static void
MarkUsesAsHoistedLexical(ParseNode* pn)
{
MOZ_ASSERT(pn->isDefn());
Definition* dn = (Definition*)pn;
ParseNode** pnup = &dn->dn_uses;
ParseNode* pnu;
unsigned start = pn->pn_blockid;
// In ES6, lexical bindings cannot be accessed until initialized.
// Distinguish hoisted uses as a different JSOp for easier compilation.
while ((pnu = *pnup) != nullptr && pnu->pn_blockid >= start) {
MOZ_ASSERT(pnu->isUsed());
pnu->pn_dflags |= PND_LEXICAL;
pnup = &pnu->pn_link;
}
}
// See comment on member function declaration.
template <>
bool
ParseContext<FullParseHandler>::define(TokenStream& ts,
HandlePropertyName name, ParseNode* pn, Definition::Kind kind)
{
MOZ_ASSERT(!pn->isUsed());
MOZ_ASSERT_IF(pn->isDefn(), pn->isPlaceholder());
Definition* prevDef = nullptr;
if (kind == Definition::LET || kind == Definition::CONST)
prevDef = decls_.lookupFirst(name);
else
MOZ_ASSERT(!decls_.lookupFirst(name));
if (!prevDef)
prevDef = lexdeps.lookupDefn<FullParseHandler>(name);
if (prevDef) {
ParseNode** pnup = &prevDef->dn_uses;
ParseNode* pnu;
unsigned start = (kind == Definition::LET || kind == Definition::CONST) ? pn->pn_blockid
: bodyid;
while ((pnu = *pnup) != nullptr && pnu->pn_blockid >= start) {
MOZ_ASSERT(pnu->pn_blockid >= bodyid);
MOZ_ASSERT(pnu->isUsed());
pnu->pn_lexdef = (Definition*) pn;
pn->pn_dflags |= pnu->pn_dflags & PND_USE2DEF_FLAGS;
pnup = &pnu->pn_link;
}
if (!pnu || pnu != prevDef->dn_uses) {
*pnup = pn->dn_uses;
pn->dn_uses = prevDef->dn_uses;
prevDef->dn_uses = pnu;
if (!pnu && prevDef->isPlaceholder())
lexdeps->remove(name);
}
pn->pn_dflags |= prevDef->pn_dflags & PND_CLOSED;
}
MOZ_ASSERT_IF(kind != Definition::LET && kind != Definition::CONST, !lexdeps->lookup(name));
pn->setDefn(true);
pn->pn_dflags &= ~PND_PLACEHOLDER;
if (kind == Definition::CONST)
pn->pn_dflags |= PND_CONST;
Definition* dn = (Definition*)pn;
switch (kind) {
case Definition::ARG:
MOZ_ASSERT(sc->isFunctionBox());
dn->setOp((js_CodeSpec[dn->getOp()].format & JOF_SET) ? JSOP_SETARG : JSOP_GETARG);
dn->pn_blockid = bodyid;
dn->pn_dflags |= PND_BOUND;
if (!dn->pn_cookie.set(ts, staticLevel, args_.length()))
return false;
if (!args_.append(dn))
return false;
if (args_.length() >= ARGNO_LIMIT) {
ts.reportError(JSMSG_TOO_MANY_FUN_ARGS);
return false;
}
if (name == ts.names().empty)
break;
if (!decls_.addUnique(name, dn))
return false;
break;
case Definition::GLOBALCONST:
case Definition::VAR:
if (sc->isFunctionBox()) {
dn->setOp((js_CodeSpec[dn->getOp()].format & JOF_SET) ? JSOP_SETLOCAL : JSOP_GETLOCAL);
dn->pn_blockid = bodyid;
dn->pn_dflags |= PND_BOUND;
if (!dn->pn_cookie.set(ts, staticLevel, vars_.length()))
return false;
if (!vars_.append(dn))
return false;
if (!checkLocalsOverflow(ts))
return false;
}
if (!decls_.addUnique(name, dn))
return false;
break;
case Definition::LET:
case Definition::CONST:
dn->setOp(JSOP_INITLEXICAL);
dn->pn_dflags |= (PND_LEXICAL | PND_BOUND);
MOZ_ASSERT(dn->pn_cookie.level() == staticLevel); /* see bindLet */
if (atBodyLevel()) {
if (!bodyLevelLexicals_.append(dn))
return false;
if (!checkLocalsOverflow(ts))
return false;
}
// In ES6, lexical bindings cannot be accessed until initialized. If
// the definition has existing uses, they need to be marked so that we
// emit dead zone checks.
MarkUsesAsHoistedLexical(pn);
if (!decls_.addShadow(name, dn))
return false;
break;
default:
MOZ_CRASH("unexpected kind");
}
return true;
}
template <>
bool
ParseContext<SyntaxParseHandler>::checkLocalsOverflow(TokenStream& ts)
{
return true;
}
template <>
bool
ParseContext<SyntaxParseHandler>::define(TokenStream& ts, HandlePropertyName name, Node pn,
Definition::Kind kind)
{
MOZ_ASSERT(!decls_.lookupFirst(name));
if (lexdeps.lookupDefn<SyntaxParseHandler>(name))
lexdeps->remove(name);
// Keep track of the number of arguments in args_, for fun->nargs.
if (kind == Definition::ARG) {
if (!args_.append((Definition*) nullptr))
return false;
if (args_.length() >= ARGNO_LIMIT) {
ts.reportError(JSMSG_TOO_MANY_FUN_ARGS);
return false;
}
}
return decls_.addUnique(name, kind);
}
template <typename ParseHandler>
void
ParseContext<ParseHandler>::prepareToAddDuplicateArg(HandlePropertyName name, DefinitionNode prevDecl)
{
MOZ_ASSERT(decls_.lookupFirst(name) == prevDecl);
decls_.remove(name);
}
template <typename ParseHandler>
void
ParseContext<ParseHandler>::updateDecl(JSAtom* atom, Node pn)
{
Definition* oldDecl = decls_.lookupFirst(atom);
pn->setDefn(true);
Definition* newDecl = (Definition*)pn;
decls_.updateFirst(atom, newDecl);
if (!sc->isFunctionBox()) {
MOZ_ASSERT(newDecl->isFreeVar());
return;
}
MOZ_ASSERT(oldDecl->isBound());
MOZ_ASSERT(!oldDecl->pn_cookie.isFree());
newDecl->pn_cookie = oldDecl->pn_cookie;
newDecl->pn_dflags |= PND_BOUND;
if (IsArgOp(oldDecl->getOp())) {
newDecl->setOp(JSOP_GETARG);
MOZ_ASSERT(args_[oldDecl->pn_cookie.slot()] == oldDecl);
args_[oldDecl->pn_cookie.slot()] = newDecl;
} else {
MOZ_ASSERT(IsLocalOp(oldDecl->getOp()));
newDecl->setOp(JSOP_GETLOCAL);
MOZ_ASSERT(vars_[oldDecl->pn_cookie.slot()] == oldDecl);
vars_[oldDecl->pn_cookie.slot()] = newDecl;
}
}
template <typename ParseHandler>
void
ParseContext<ParseHandler>::popLetDecl(JSAtom* atom)
{
MOZ_ASSERT(ParseHandler::getDefinitionKind(decls_.lookupFirst(atom)) == Definition::LET ||
ParseHandler::getDefinitionKind(decls_.lookupFirst(atom)) == Definition::CONST);
decls_.remove(atom);
}
template <typename ParseHandler>
static void
AppendPackedBindings(const ParseContext<ParseHandler>* pc, const DeclVector& vec, Binding* dst,
uint32_t* numUnaliased = nullptr)
{
for (size_t i = 0; i < vec.length(); ++i, ++dst) {
Definition* dn = vec[i];
PropertyName* name = dn->name();
Binding::Kind kind;
switch (dn->kind()) {
case Definition::LET:
// Treat body-level let declarations as var bindings by falling
// through. The fact that the binding is in fact a let declaration
// is reflected in the slot. All body-level lets go after the
// vars.
case Definition::VAR:
kind = Binding::VARIABLE;
break;
case Definition::CONST:
case Definition::GLOBALCONST:
kind = Binding::CONSTANT;
break;
case Definition::ARG:
kind = Binding::ARGUMENT;
break;
default:
MOZ_CRASH("unexpected dn->kind");
}
/*
* Bindings::init does not check for duplicates so we must ensure that
* only one binding with a given name is marked aliased. pc->decls
* maintains the canonical definition for each name, so use that.
*/
MOZ_ASSERT_IF(dn->isClosed(), pc->decls().lookupFirst(name) == dn);
bool aliased = dn->isClosed() ||
(pc->sc->allLocalsAliased() &&
pc->decls().lookupFirst(name) == dn);
*dst = Binding(name, kind, aliased);
if (!aliased && numUnaliased)
++*numUnaliased;
}
}
template <typename ParseHandler>
bool
ParseContext<ParseHandler>::generateFunctionBindings(ExclusiveContext* cx, TokenStream& ts,
LifoAlloc& alloc,
InternalHandle<Bindings*> bindings) const
{
MOZ_ASSERT(sc->isFunctionBox());
MOZ_ASSERT(args_.length() < ARGNO_LIMIT);
MOZ_ASSERT(vars_.length() + bodyLevelLexicals_.length() < LOCALNO_LIMIT);
/*
* Avoid pathological edge cases by explicitly limiting the total number of
* bindings to what will fit in a uint32_t.
*/
if (UINT32_MAX - args_.length() <= vars_.length() + bodyLevelLexicals_.length())
return ts.reportError(JSMSG_TOO_MANY_LOCALS);
// Fix up the slots of body-level lets to come after the vars now that we
// know how many vars there are.
for (size_t i = 0; i < bodyLevelLexicals_.length(); i++) {
Definition* dn = bodyLevelLexicals_[i];
if (!dn->pn_cookie.set(ts, dn->pn_cookie.level(), vars_.length() + i))
return false;
}
uint32_t count = args_.length() + vars_.length() + bodyLevelLexicals_.length();
Binding* packedBindings = alloc.newArrayUninitialized<Binding>(count);
if (!packedBindings) {
js_ReportOutOfMemory(cx);
return false;
}
uint32_t numUnaliasedVars = 0;
uint32_t numUnaliasedBodyLevelLexicals = 0;
AppendPackedBindings(this, args_, packedBindings);
AppendPackedBindings(this, vars_, packedBindings + args_.length(), &numUnaliasedVars);
AppendPackedBindings(this, bodyLevelLexicals_,
packedBindings + args_.length() + vars_.length(), &numUnaliasedBodyLevelLexicals);
return Bindings::initWithTemporaryStorage(cx, bindings, args_.length(), vars_.length(),
bodyLevelLexicals_.length(), blockScopeDepth,
numUnaliasedVars, numUnaliasedBodyLevelLexicals,
packedBindings);
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::reportHelper(ParseReportKind kind, bool strict, uint32_t offset,
unsigned errorNumber, va_list args)
{
bool result = false;
switch (kind) {
case ParseError:
result = tokenStream.reportCompileErrorNumberVA(offset, JSREPORT_ERROR, errorNumber, args);
break;
case ParseWarning:
result =
tokenStream.reportCompileErrorNumberVA(offset, JSREPORT_WARNING, errorNumber, args);
break;
case ParseExtraWarning:
result = tokenStream.reportStrictWarningErrorNumberVA(offset, errorNumber, args);
break;
case ParseStrictError:
result = tokenStream.reportStrictModeErrorNumberVA(offset, strict, errorNumber, args);
break;
}
return result;
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::report(ParseReportKind kind, bool strict, Node pn, unsigned errorNumber, ...)
{
uint32_t offset = (pn ? handler.getPosition(pn) : pos()).begin;
va_list args;
va_start(args, errorNumber);
bool result = reportHelper(kind, strict, offset, errorNumber, args);
va_end(args);
return result;
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::reportNoOffset(ParseReportKind kind, bool strict, unsigned errorNumber, ...)
{
va_list args;
va_start(args, errorNumber);
bool result = reportHelper(kind, strict, TokenStream::NoOffset, errorNumber, args);
va_end(args);
return result;
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::reportWithOffset(ParseReportKind kind, bool strict, uint32_t offset,
unsigned errorNumber, ...)
{
va_list args;
va_start(args, errorNumber);
bool result = reportHelper(kind, strict, offset, errorNumber, args);
va_end(args);
return result;
}
template <>
bool
Parser<FullParseHandler>::abortIfSyntaxParser()
{
handler.disableSyntaxParser();
return true;
}
template <>
bool
Parser<SyntaxParseHandler>::abortIfSyntaxParser()
{
abortedSyntaxParse = true;
return false;
}
template <typename ParseHandler>
Parser<ParseHandler>::Parser(ExclusiveContext* cx, LifoAlloc* alloc,
const ReadOnlyCompileOptions& options,
const char16_t* chars, size_t length, bool foldConstants,
Parser<SyntaxParseHandler>* syntaxParser,
LazyScript* lazyOuterFunction)
: AutoGCRooter(cx, PARSER),
context(cx),
alloc(*alloc),
tokenStream(cx, options, chars, length, thisForCtor()),
traceListHead(nullptr),
pc(nullptr),
sct(nullptr),
ss(nullptr),
keepAtoms(cx->perThreadData),
foldConstants(foldConstants),
#ifdef DEBUG
checkOptionsCalled(false),
#endif
abortedSyntaxParse(false),
isUnexpectedEOF_(false),
handler(cx, *alloc, tokenStream, syntaxParser, lazyOuterFunction)
{
{
AutoLockForExclusiveAccess lock(cx);
cx->perThreadData->addActiveCompilation();
}
// The Mozilla specific JSOPTION_EXTRA_WARNINGS option adds extra warnings
// which are not generated if functions are parsed lazily. Note that the
// standard "use strict" does not inhibit lazy parsing.
if (options.extraWarningsOption)
handler.disableSyntaxParser();
tempPoolMark = alloc->mark();
}
template<typename ParseHandler>
bool
Parser<ParseHandler>::checkOptions()
{
#ifdef DEBUG
checkOptionsCalled = true;
#endif
if (!tokenStream.checkOptions())
return false;
return true;
}
template <typename ParseHandler>
Parser<ParseHandler>::~Parser()
{
MOZ_ASSERT(checkOptionsCalled);
alloc.release(tempPoolMark);
/*
* The parser can allocate enormous amounts of memory for large functions.
* Eagerly free the memory now (which otherwise won't be freed until the
* next GC) to avoid unnecessary OOMs.
*/
alloc.freeAllIfHugeAndUnused();
{
AutoLockForExclusiveAccess lock(context);
context->perThreadData->removeActiveCompilation();
}
}
template <typename ParseHandler>
ObjectBox*
Parser<ParseHandler>::newObjectBox(NativeObject* obj)
{
MOZ_ASSERT(obj && !IsPoisonedPtr(obj));
/*
* We use JSContext.tempLifoAlloc to allocate parsed objects and place them
* on a list in this Parser to ensure GC safety. Thus the tempLifoAlloc
* arenas containing the entries must be alive until we are done with
* scanning, parsing and code generation for the whole script or top-level
* function.
*/
ObjectBox* objbox = alloc.new_<ObjectBox>(obj, traceListHead);
if (!objbox) {
js_ReportOutOfMemory(context);
return nullptr;
}
traceListHead = objbox;
return objbox;
}
template <typename ParseHandler>
FunctionBox::FunctionBox(ExclusiveContext* cx, ObjectBox* traceListHead, JSFunction* fun,
ParseContext<ParseHandler>* outerpc, Directives directives,
bool extraWarnings, GeneratorKind generatorKind)
: ObjectBox(fun, traceListHead),
SharedContext(cx, directives, extraWarnings),
bindings(),
bufStart(0),
bufEnd(0),
length(0),
generatorKindBits_(GeneratorKindAsBits(generatorKind)),
inWith(false), // initialized below
inGenexpLambda(false),
hasDestructuringArgs(false),
useAsm(false),
insideUseAsm(outerpc && outerpc->useAsmOrInsideUseAsm()),
usesArguments(false),
usesApply(false),
usesThis(false),
funCxFlags()
{
// Functions created at parse time may be set singleton after parsing and
// baked into JIT code, so they must be allocated tenured. They are held by
// the JSScript so cannot be collected during a minor GC anyway.
MOZ_ASSERT(fun->isTenured());
if (!outerpc) {
inWith = false;
} else if (outerpc->parsingWith) {
// This covers cases that don't involve eval(). For example:
//
// with (o) { (function() { g(); })(); }
//
// In this case, |outerpc| corresponds to global code, and
// outerpc->parsingWith is true.
inWith = true;
} else if (outerpc->sc->isGlobalSharedContext()) {
// This covers the case where a function is nested within an eval()
// within a |with| statement.
//
// with (o) { eval("(function() { g(); })();"); }
//
// In this case, |outerpc| corresponds to the eval(),
// outerpc->parsingWith is false because the eval() breaks the
// ParseContext chain, and |parent| is nullptr (again because of the
// eval(), so we have to look at |outerpc|'s scopeChain.
//
JSObject* scope = outerpc->sc->asGlobalSharedContext()->scopeChain();
while (scope) {
if (scope->is<DynamicWithObject>())
inWith = true;
scope = scope->enclosingScope();
}
} else if (outerpc->sc->isFunctionBox()) {
// This is like the above case, but for more deeply nested functions.
// For example:
//
// with (o) { eval("(function() { (function() { g(); })(); })();"); } }
//
// In this case, the inner anonymous function needs to inherit the
// setting of |inWith| from the outer one.
FunctionBox* parent = outerpc->sc->asFunctionBox();
if (parent && parent->inWith)
inWith = true;
}
}
template <typename ParseHandler>
FunctionBox*
Parser<ParseHandler>::newFunctionBox(Node fn, JSFunction* fun, ParseContext<ParseHandler>* outerpc,
Directives inheritedDirectives, GeneratorKind generatorKind)
{
MOZ_ASSERT(fun && !IsPoisonedPtr(fun));
/*
* We use JSContext.tempLifoAlloc to allocate parsed objects and place them
* on a list in this Parser to ensure GC safety. Thus the tempLifoAlloc
* arenas containing the entries must be alive until we are done with
* scanning, parsing and code generation for the whole script or top-level
* function.
*/
FunctionBox* funbox =
alloc.new_<FunctionBox>(context, traceListHead, fun, outerpc,
inheritedDirectives, options().extraWarningsOption,
generatorKind);
if (!funbox) {
js_ReportOutOfMemory(context);
return nullptr;
}
traceListHead = funbox;
if (fn)
handler.setFunctionBox(fn, funbox);
return funbox;
}
template <typename ParseHandler>
void
Parser<ParseHandler>::trace(JSTracer* trc)
{
traceListHead->trace(trc);
}
void
MarkParser(JSTracer* trc, AutoGCRooter* parser)
{
static_cast<Parser<FullParseHandler>*>(parser)->trace(trc);
}
/*
* Parse a top-level JS script.
*/
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::parse(JSObject* chain)
{
MOZ_ASSERT(checkOptionsCalled);
/*
* Protect atoms from being collected by a GC activation, which might
* - nest on this thread due to out of memory (the so-called "last ditch"
* GC attempted within js_NewGCThing), or
* - run for any reason on another thread if this thread is suspended on
* an object lock before it finishes generating bytecode into a script
* protected from the GC by a root or a stack frame reference.
*/
Directives directives(options().strictOption);
GlobalSharedContext globalsc(context, chain, directives, options().extraWarningsOption);
ParseContext<ParseHandler> globalpc(this, /* parent = */ nullptr, ParseHandler::null(),
&globalsc, /* newDirectives = */ nullptr,
/* staticLevel = */ 0, /* bodyid = */ 0,
/* blockScopeDepth = */ 0);
if (!globalpc.init(tokenStream))
return null();
Node pn = statements();
if (pn) {
TokenKind tt;
if (!tokenStream.getToken(&tt))
return null();
if (tt != TOK_EOF) {
report(ParseError, false, null(), JSMSG_GARBAGE_AFTER_INPUT,
"script", TokenKindToDesc(tt));
return null();
}
if (foldConstants) {
if (!FoldConstants(context, &pn, this))
return null();
}
}
return pn;
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::reportBadReturn(Node pn, ParseReportKind kind,
unsigned errnum, unsigned anonerrnum)
{
JSAutoByteString name;
JSAtom* atom = pc->sc->asFunctionBox()->function()->atom();
if (atom) {
if (!AtomToPrintableString(context, atom, &name))
return false;
} else {
errnum = anonerrnum;
}
return report(kind, pc->sc->strict, pn, errnum, name.ptr());
}
/*
* Check that assigning to lhs is permitted. Assigning to 'eval' or
* 'arguments' is banned in strict mode.
*/
template <typename ParseHandler>
bool
Parser<ParseHandler>::checkStrictAssignment(Node lhs)
{
if (!pc->sc->needStrictChecks())
return true;
JSAtom* atom = handler.isName(lhs);
if (!atom)
return true;
if (atom == context->names().eval || atom == context->names().arguments) {
JSAutoByteString name;
if (!AtomToPrintableString(context, atom, &name))
return false;
if (!report(ParseStrictError, pc->sc->strict, lhs, JSMSG_BAD_STRICT_ASSIGN, name.ptr()))
return false;
}
return true;
}
/*
* Check that it is permitted to introduce a binding for atom. Strict mode
* forbids introducing new definitions for 'eval', 'arguments', or for any
* strict mode reserved keyword. Use pn for reporting error locations, or use
* pc's token stream if pn is nullptr.
*/
template <typename ParseHandler>
bool
Parser<ParseHandler>::checkStrictBinding(PropertyName* name, Node pn)
{
if (!pc->sc->needStrictChecks())
return true;
if (name == context->names().eval || name == context->names().arguments || IsKeyword(name)) {
JSAutoByteString bytes;
if (!AtomToPrintableString(context, name, &bytes))
return false;
return report(ParseStrictError, pc->sc->strict, pn,
JSMSG_BAD_BINDING, bytes.ptr());
}
return true;
}
template <>
ParseNode*
Parser<FullParseHandler>::standaloneFunctionBody(HandleFunction fun, const AutoNameVector& formals,
GeneratorKind generatorKind,
Directives inheritedDirectives,
Directives* newDirectives)
{
MOZ_ASSERT(checkOptionsCalled);
Node fn = handler.newFunctionDefinition();
if (!fn)
return null();
ParseNode* argsbody = handler.newList(PNK_ARGSBODY);
if (!argsbody)
return null();
fn->pn_body = argsbody;
FunctionBox* funbox = newFunctionBox(fn, fun, /* outerpc = */ nullptr, inheritedDirectives,
generatorKind);
if (!funbox)
return null();
funbox->length = fun->nargs() - fun->hasRest();
handler.setFunctionBox(fn, funbox);
ParseContext<FullParseHandler> funpc(this, pc, fn, funbox, newDirectives,
/* staticLevel = */ 0, /* bodyid = */ 0,
/* blockScopeDepth = */ 0);
if (!funpc.init(tokenStream))
return null();
for (unsigned i = 0; i < formals.length(); i++) {
if (!defineArg(fn, formals[i]))
return null();
}
ParseNode* pn = functionBody(Statement, StatementListBody);
if (!pn)
return null();
TokenKind tt;
if (!tokenStream.getToken(&tt))
return null();
if (tt != TOK_EOF) {
report(ParseError, false, null(), JSMSG_GARBAGE_AFTER_INPUT,
"function body", TokenKindToDesc(tt));
return null();
}
if (!FoldConstants(context, &pn, this))
return null();
InternalHandle<Bindings*> funboxBindings =
InternalHandle<Bindings*>::fromMarkedLocation(&funbox->bindings);
if (!funpc.generateFunctionBindings(context, tokenStream, alloc, funboxBindings))
return null();
MOZ_ASSERT(fn->pn_body->isKind(PNK_ARGSBODY));
fn->pn_body->append(pn);
fn->pn_body->pn_pos = pn->pn_pos;
return fn;
}
template <>
bool
Parser<FullParseHandler>::checkFunctionArguments()
{
/*
* Non-top-level functions use JSOP_DEFFUN which is a dynamic scope
* operation which means it aliases any bindings with the same name.
*/
if (FuncStmtSet* set = pc->funcStmts) {
for (FuncStmtSet::Range r = set->all(); !r.empty(); r.popFront()) {
PropertyName* name = r.front()->asPropertyName();
if (Definition* dn = pc->decls().lookupFirst(name))
dn->pn_dflags |= PND_CLOSED;
}
}
/* Time to implement the odd semantics of 'arguments'. */
HandlePropertyName arguments = context->names().arguments;
/*
* As explained by the ContextFlags::funArgumentsHasLocalBinding comment,
* create a declaration for 'arguments' if there are any unbound uses in
* the function body.
*/
for (AtomDefnRange r = pc->lexdeps->all(); !r.empty(); r.popFront()) {
if (r.front().key() == arguments) {
Definition* dn = r.front().value().get<FullParseHandler>();
pc->lexdeps->remove(arguments);
dn->pn_dflags |= PND_IMPLICITARGUMENTS;
if (!pc->define(tokenStream, arguments, dn, Definition::VAR))
return false;
pc->sc->asFunctionBox()->usesArguments = true;
break;
}
}
/*
* Report error if both rest parameters and 'arguments' are used. Do this
* check before adding artificial 'arguments' below.
*/
Definition* maybeArgDef = pc->decls().lookupFirst(arguments);
bool argumentsHasBinding = !!maybeArgDef;
// ES6 9.2.13.17 says that a lexical binding of 'arguments' shadows the
// arguments object.
bool argumentsHasLocalBinding = maybeArgDef && (maybeArgDef->kind() != Definition::ARG &&
maybeArgDef->kind() != Definition::LET &&
maybeArgDef->kind() != Definition::CONST);
bool hasRest = pc->sc->asFunctionBox()->function()->hasRest();
if (hasRest && argumentsHasLocalBinding) {
report(ParseError, false, nullptr, JSMSG_ARGUMENTS_AND_REST);
return false;
}
/*
* Even if 'arguments' isn't explicitly mentioned, dynamic name lookup
* forces an 'arguments' binding. The exception is that functions with rest
* parameters are free from 'arguments'.
*/
if (!argumentsHasBinding && pc->sc->bindingsAccessedDynamically() && !hasRest) {
ParseNode* pn = newName(arguments);
if (!pn)
return false;
if (!pc->define(tokenStream, arguments, pn, Definition::VAR))
return false;
argumentsHasBinding = true;
argumentsHasLocalBinding = true;
}
/*
* Now that all possible 'arguments' bindings have been added, note whether
* 'arguments' has a local binding and whether it unconditionally needs an
* arguments object. (Also see the flags' comments in ContextFlags.)
*/
if (argumentsHasLocalBinding) {
FunctionBox* funbox = pc->sc->asFunctionBox();
funbox->setArgumentsHasLocalBinding();
/*
* If a script has both explicit mentions of 'arguments' and dynamic
* name lookups which could access the arguments, an arguments object
* must be created eagerly. The SSA analysis used for lazy arguments
* cannot cope with dynamic name accesses, so any 'arguments' accessed
* via a NAME opcode must force construction of the arguments object.
*/
if (pc->sc->bindingsAccessedDynamically() && maybeArgDef)
funbox->setDefinitelyNeedsArgsObj();
/*
* If a script contains the debugger statement either directly or
* within an inner function, the arguments object must be created
* eagerly. The debugger can walk the scope chain and observe any
* values along it.
*/
if (pc->sc->hasDebuggerStatement())
funbox->setDefinitelyNeedsArgsObj();
/*
* Check whether any parameters have been assigned within this
* function. In strict mode parameters do not alias arguments[i], and
* to make the arguments object reflect initial parameter values prior
* to any mutation we create it eagerly whenever parameters are (or
* might, in the case of calls to eval) be assigned.
*/
if (pc->sc->needStrictChecks()) {
for (AtomDefnListMap::Range r = pc->decls().all(); !r.empty(); r.popFront()) {
DefinitionList& dlist = r.front().value();
for (DefinitionList::Range dr = dlist.all(); !dr.empty(); dr.popFront()) {
Definition* dn = dr.front<FullParseHandler>();
if (dn->kind() == Definition::ARG && dn->isAssigned())
funbox->setDefinitelyNeedsArgsObj();
}
}
/* Watch for mutation of arguments through e.g. eval(). */
if (pc->sc->bindingsAccessedDynamically())
funbox->setDefinitelyNeedsArgsObj();
}
}
return true;
}
template <>
bool
Parser<SyntaxParseHandler>::checkFunctionArguments()
{
bool hasRest = pc->sc->asFunctionBox()->function()->hasRest();
if (pc->lexdeps->lookup(context->names().arguments)) {
pc->sc->asFunctionBox()->usesArguments = true;
if (hasRest) {
report(ParseError, false, null(), JSMSG_ARGUMENTS_AND_REST);
return false;
}
} else if (hasRest) {
DefinitionNode maybeArgDef = pc->decls().lookupFirst(context->names().arguments);
if (maybeArgDef && handler.getDefinitionKind(maybeArgDef) != Definition::ARG) {
report(ParseError, false, null(), JSMSG_ARGUMENTS_AND_REST);
return false;
}
}
return true;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::functionBody(FunctionSyntaxKind kind, FunctionBodyType type)
{
MOZ_ASSERT(pc->sc->isFunctionBox());
MOZ_ASSERT(!pc->funHasReturnExpr && !pc->funHasReturnVoid);
#ifdef DEBUG
uint32_t startYieldOffset = pc->lastYieldOffset;
#endif
Node pn;
if (type == StatementListBody) {
pn = statements();
if (!pn)
return null();
} else {
MOZ_ASSERT(type == ExpressionBody);
Node kid = assignExpr();
if (!kid)
return null();
pn = handler.newReturnStatement(kid, null(), handler.getPosition(kid));
if (!pn)
return null();
}
switch (pc->generatorKind()) {
case NotGenerator:
MOZ_ASSERT(pc->lastYieldOffset == startYieldOffset);
break;
case LegacyGenerator:
// FIXME: Catch these errors eagerly, in yieldExpression().
MOZ_ASSERT(pc->lastYieldOffset != startYieldOffset);
if (kind == Arrow) {
reportWithOffset(ParseError, false, pc->lastYieldOffset,
JSMSG_YIELD_IN_ARROW, js_yield_str);
return null();
}
if (type == ExpressionBody) {
reportBadReturn(pn, ParseError,
JSMSG_BAD_GENERATOR_RETURN,
JSMSG_BAD_ANON_GENERATOR_RETURN);
return null();
}
break;
case StarGenerator:
MOZ_ASSERT(kind != Arrow);
MOZ_ASSERT(type == StatementListBody);
break;
}
if (pc->isGenerator()) {
MOZ_ASSERT(type == StatementListBody);
Node generator = newName(context->names().dotGenerator);
if (!generator)
return null();
if (!pc->define(tokenStream, context->names().dotGenerator, generator, Definition::VAR))
return null();
if (pc->isStarGenerator()) {
Node genrval = newName(context->names().dotGenRVal);
if (!genrval)
return null();
if (!pc->define(tokenStream, context->names().dotGenRVal, genrval, Definition::VAR))
return null();
}
generator = newName(context->names().dotGenerator);
if (!generator)
return null();
if (!noteNameUse(context->names().dotGenerator, generator))
return null();
if (!handler.prependInitialYield(pn, generator))
return null();
}
/* Define the 'arguments' binding if necessary. */
if (!checkFunctionArguments())
return null();
return pn;
}
/* See comment for use in Parser::functionDef. */
template <>
bool
Parser<FullParseHandler>::makeDefIntoUse(Definition* dn, ParseNode* pn, JSAtom* atom)
{
/* Turn pn into a definition. */
pc->updateDecl(atom, pn);
/* Change all uses of dn to be uses of pn. */
for (ParseNode* pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) {
MOZ_ASSERT(pnu->isUsed());
MOZ_ASSERT(!pnu->isDefn());
pnu->pn_lexdef = (Definition*) pn;
pn->pn_dflags |= pnu->pn_dflags & PND_USE2DEF_FLAGS;
}
pn->pn_dflags |= dn->pn_dflags & PND_USE2DEF_FLAGS;
pn->dn_uses = dn;
/*
* A PNK_FUNCTION node must be a definition, so convert shadowed function
* statements into nops. This is valid since all body-level function
* statement initialization happens at the beginning of the function
* (thus, only the last statement's effect is visible). E.g., in
*
* function outer() {
* function g() { return 1 }
* assertEq(g(), 2);
* function g() { return 2 }
* assertEq(g(), 2);
* }
*
* both asserts are valid.
*/
if (dn->getKind() == PNK_FUNCTION) {
MOZ_ASSERT(dn->functionIsHoisted());
pn->dn_uses = dn->pn_link;
handler.prepareNodeForMutation(dn);
dn->setKind(PNK_NOP);
dn->setArity(PN_NULLARY);
dn->setDefn(false);
return true;
}
/*
* If dn is in [var, const, let] and has an initializer, then we
* must rewrite it to be an assignment node, whose freshly allocated
* left-hand side becomes a use of pn.
*/
if (dn->canHaveInitializer()) {
if (ParseNode* rhs = dn->expr()) {
ParseNode* lhs = handler.makeAssignment(dn, rhs);
if (!lhs)
return false;
pn->dn_uses = lhs;
dn->pn_link = nullptr;
dn = (Definition*) lhs;
}
}
/* Turn dn into a use of pn. */
MOZ_ASSERT(dn->isKind(PNK_NAME));
MOZ_ASSERT(dn->isArity(PN_NAME));
MOZ_ASSERT(dn->pn_atom == atom);
dn->setOp((js_CodeSpec[dn->getOp()].format & JOF_SET) ? JSOP_SETNAME : JSOP_GETNAME);
dn->setDefn(false);
dn->setUsed(true);
dn->pn_lexdef = (Definition*) pn;
dn->pn_cookie.makeFree();
dn->pn_dflags &= ~PND_BOUND;
return true;
}
/*
* Parameter block types for the several Binder functions. We use a common
* helper function signature in order to share code among destructuring and
* simple variable declaration parsers. In the destructuring case, the binder
* function is called indirectly from the variable declaration parser by way
* of checkDestructuring and its friends.
*/
template <typename ParseHandler>
struct BindData
{
explicit BindData(ExclusiveContext* cx) : let(cx) {}
typedef bool
(*Binder)(BindData* data, HandlePropertyName name, Parser<ParseHandler>* parser);
/* name node for definition processing and error source coordinates */
typename ParseHandler::Node pn;
JSOp op; /* prolog bytecode or nop */
Binder binder; /* binder, discriminates u */
bool isConst; /* const binding? */
struct LetData {
explicit LetData(ExclusiveContext* cx) : blockObj(cx) {}
VarContext varContext;
RootedStaticBlockObject blockObj;
unsigned overflow;
} let;
void initLexical(VarContext varContext, StaticBlockObject* blockObj, unsigned overflow,
bool isConst = false) {
this->pn = ParseHandler::null();
this->op = JSOP_INITLEXICAL;
this->isConst = isConst;
this->binder = Parser<ParseHandler>::bindLexical;
this->let.varContext = varContext;
this->let.blockObj = blockObj;
this->let.overflow = overflow;
}
void initVarOrGlobalConst(JSOp op) {
this->op = op;
this->isConst = op == JSOP_DEFCONST;
this->binder = Parser<ParseHandler>::bindVarOrGlobalConst;
}
};
template <typename ParseHandler>
JSFunction*
Parser<ParseHandler>::newFunction(HandleAtom atom, FunctionSyntaxKind kind, HandleObject proto)
{
MOZ_ASSERT_IF(kind == Statement, atom != nullptr);
RootedFunction fun(context);
JSFunction::Flags flags = (kind == Expression)
? JSFunction::INTERPRETED_LAMBDA
: (kind == Arrow)
? JSFunction::INTERPRETED_LAMBDA_ARROW
: JSFunction::INTERPRETED;
gc::AllocKind allocKind = JSFunction::FinalizeKind;
if (kind == Arrow)
allocKind = JSFunction::ExtendedFinalizeKind;
fun = NewFunctionWithProto(context, NullPtr(), nullptr, 0, flags, NullPtr(), atom, proto,
allocKind, MaybeSingletonObject);
if (!fun)
return nullptr;
if (options().selfHostingMode)
fun->setIsSelfHostedBuiltin();
return fun;
}
static bool
MatchOrInsertSemicolon(TokenStream& ts)
{
TokenKind tt;
if (!ts.peekTokenSameLine(&tt, TokenStream::Operand))
return false;
if (tt != TOK_EOF && tt != TOK_EOL && tt != TOK_SEMI && tt != TOK_RC) {
/* Advance the scanner for proper error location reporting. */
ts.consumeKnownToken(tt);
ts.reportError(JSMSG_SEMI_BEFORE_STMNT);
return false;
}
bool ignored;
return ts.matchToken(&ignored, TOK_SEMI);
}
template <typename ParseHandler>
typename ParseHandler::DefinitionNode
Parser<ParseHandler>::getOrCreateLexicalDependency(ParseContext<ParseHandler>* pc, JSAtom* atom)
{
AtomDefnAddPtr p = pc->lexdeps->lookupForAdd(atom);
if (p)
return p.value().get<ParseHandler>();
DefinitionNode dn = handler.newPlaceholder(atom, pc->blockid(), pos());
if (!dn)
return ParseHandler::nullDefinition();
DefinitionSingle def = DefinitionSingle::new_<ParseHandler>(dn);
if (!pc->lexdeps->add(p, atom, def))
return ParseHandler::nullDefinition();
return dn;
}
static bool
ConvertDefinitionToNamedLambdaUse(TokenStream& ts, ParseContext<FullParseHandler>* pc,
FunctionBox* funbox, Definition* dn)
{
dn->setOp(JSOP_CALLEE);
if (!dn->pn_cookie.set(ts, pc->staticLevel, 0))
return false;
dn->pn_dflags |= PND_BOUND;
MOZ_ASSERT(dn->kind() == Definition::NAMED_LAMBDA);
/*
* Since 'dn' is a placeholder, it has not been defined in the
* ParseContext and hence we must manually flag a closed-over
* callee name as needing a dynamic scope (this is done for all
* definitions in the ParseContext by generateFunctionBindings).
*
* If 'dn' has been assigned to, then we also flag the function
* scope has needing a dynamic scope so that dynamic scope
* setter can either ignore the set (in non-strict mode) or
* produce an error (in strict mode).
*/
if (dn->isClosed() || dn->isAssigned())
funbox->setNeedsDeclEnvObject();
return true;
}
static bool
IsNonDominatingInScopedSwitch(ParseContext<FullParseHandler>* pc, HandleAtom name,
Definition* dn)
{
MOZ_ASSERT(dn->isLexical());
StmtInfoPC* stmt = LexicalLookup(pc, name, nullptr, (StmtInfoPC*)nullptr);
if (stmt && stmt->type == STMT_SWITCH)
return dn->pn_cookie.slot() < stmt->firstDominatingLexicalInCase;
return false;
}
static void
AssociateUsesWithOuterDefinition(ParseNode* pnu, Definition* dn, Definition* outer_dn,
bool markUsesAsLexical)
{
uint32_t dflags = markUsesAsLexical ? PND_LEXICAL : 0;
while (true) {
pnu->pn_lexdef = outer_dn;
pnu->pn_dflags |= dflags;
if (!pnu->pn_link)
break;
pnu = pnu->pn_link;
}
pnu->pn_link = outer_dn->dn_uses;
outer_dn->dn_uses = dn->dn_uses;
dn->dn_uses = nullptr;
}
/*
* Beware: this function is called for functions nested in other functions or
* global scripts but not for functions compiled through the Function
* constructor or JSAPI. To always execute code when a function has finished
* parsing, use Parser::functionBody.
*/
template <>
bool
Parser<FullParseHandler>::leaveFunction(ParseNode* fn, ParseContext<FullParseHandler>* outerpc,
FunctionSyntaxKind kind)
{
outerpc->blockidGen = pc->blockidGen;
bool bodyLevel = outerpc->atBodyLevel();
FunctionBox* funbox = fn->pn_funbox;
MOZ_ASSERT(funbox == pc->sc->asFunctionBox());
/* Propagate unresolved lexical names up to outerpc->lexdeps. */
if (pc->lexdeps->count()) {
for (AtomDefnRange r = pc->lexdeps->all(); !r.empty(); r.popFront()) {
JSAtom* atom = r.front().key();
Definition* dn = r.front().value().get<FullParseHandler>();
MOZ_ASSERT(dn->isPlaceholder());
if (atom == funbox->function()->name() && kind == Expression) {
if (!ConvertDefinitionToNamedLambdaUse(tokenStream, pc, funbox, dn))
return false;
continue;
}
Definition* outer_dn = outerpc->decls().lookupFirst(atom);
/*
* Make sure to deoptimize lexical dependencies that are polluted
* by eval and function statements (which both flag the function as
* having an extensible scope) or any enclosing 'with'.
*/
if (funbox->hasExtensibleScope() || outerpc->parsingWith)
handler.deoptimizeUsesWithin(dn, fn->pn_pos);
if (!outer_dn) {
/*
* Create a new placeholder for our outer lexdep. We could
* simply re-use the inner placeholder, but that introduces
* subtleties in the case where we find a later definition
* that captures an existing lexdep. For example:
*
* function f() { function g() { x; } let x; }
*
* Here, g's TOK_UPVARS node lists the placeholder for x,
* which must be captured by the 'let' declaration later,
* since 'let's are hoisted. Taking g's placeholder as our
* own would work fine. But consider:
*
* function f() { x; { function g() { x; } let x; } }
*
* Here, the 'let' must not capture all the uses of f's
* lexdep entry for x, but it must capture the x node
* referred to from g's TOK_UPVARS node. Always turning
* inherited lexdeps into uses of a new outer definition
* allows us to handle both these cases in a natural way.
*/
outer_dn = getOrCreateLexicalDependency(outerpc, atom);
if (!outer_dn)
return false;
}
/*
* Insert dn's uses list at the front of outer_dn's list.
*
* Without loss of generality or correctness, we allow a dn to
* be in inner and outer lexdeps, since the purpose of lexdeps
* is one-pass coordination of name use and definition across
* functions, and if different dn's are used we'll merge lists
* when leaving the inner function.
*
* The dn == outer_dn case arises with generator expressions
* (see LegacyCompExprTransplanter::transplant, the PN_CODE/PN_NAME
* case), and nowhere else, currently.
*/
if (dn != outer_dn) {
if (ParseNode* pnu = dn->dn_uses) {
// In ES6, lexical bindings cannot be accessed until
// initialized. If we are parsing a body-level function,
// it is hoisted to the top, so we conservatively mark all
// uses linked to an outer lexical binding as needing TDZ
// checks. e.g.,
//
// function outer() {
// inner2();
// function inner() { use(x); }
// function inner2() { inner(); }
// let x;
// }
//
// The use of 'x' inside 'inner' needs to be marked.
//
// Note that to not be fully conservative requires a call
// graph analysis of all body-level functions to compute
// the transitive closure of which hoisted body level use
// of which function forces TDZ checks on which uses. This
// is unreasonably difficult to do in a single pass parser
// like ours.
//
// Similarly, if we are closing over a lexical binding
// from another case in a switch, those uses also need to
// be marked as needing dead zone checks.
RootedAtom name(context, atom);
bool markUsesAsLexical = outer_dn->isLexical() &&
(bodyLevel ||
IsNonDominatingInScopedSwitch(outerpc, name, outer_dn));
AssociateUsesWithOuterDefinition(pnu, dn, outer_dn, markUsesAsLexical);
}
outer_dn->pn_dflags |= dn->pn_dflags & ~PND_PLACEHOLDER;
}
/* Mark the outer dn as escaping. */
outer_dn->pn_dflags |= PND_CLOSED;
}
}
InternalHandle<Bindings*> bindings =
InternalHandle<Bindings*>::fromMarkedLocation(&funbox->bindings);
return pc->generateFunctionBindings(context, tokenStream, alloc, bindings);
}
template <>
bool
Parser<SyntaxParseHandler>::leaveFunction(Node fn, ParseContext<SyntaxParseHandler>* outerpc,
FunctionSyntaxKind kind)
{
outerpc->blockidGen = pc->blockidGen;
FunctionBox* funbox = pc->sc->asFunctionBox();
return addFreeVariablesFromLazyFunction(funbox->function(), outerpc);
}
/*
* defineArg is called for both the arguments of a regular function definition
* and the arguments specified by the Function constructor.
*
* The 'disallowDuplicateArgs' bool indicates whether the use of another
* feature (destructuring or default arguments) disables duplicate arguments.
* (ECMA-262 requires us to support duplicate parameter names, but, for newer
* features, we consider the code to have "opted in" to higher standards and
* forbid duplicates.)
*
* If 'duplicatedArg' is non-null, then DefineArg assigns to it any previous
* argument with the same name. The caller may use this to report an error when
* one of the abovementioned features occurs after a duplicate.
*/
template <typename ParseHandler>
bool
Parser<ParseHandler>::defineArg(Node funcpn, HandlePropertyName name,
bool disallowDuplicateArgs, Node* duplicatedArg)
{
SharedContext* sc = pc->sc;
/* Handle duplicate argument names. */
if (DefinitionNode prevDecl = pc->decls().lookupFirst(name)) {
Node pn = handler.getDefinitionNode(prevDecl);
/*
* Strict-mode disallows duplicate args. We may not know whether we are
* in strict mode or not (since the function body hasn't been parsed).
* In such cases, report will queue up the potential error and return
* 'true'.
*/
if (sc->needStrictChecks()) {
JSAutoByteString bytes;
if (!AtomToPrintableString(context, name, &bytes))
return false;
if (!report(ParseStrictError, pc->sc->strict, pn,
JSMSG_DUPLICATE_FORMAL, bytes.ptr()))
{
return false;
}
}
if (disallowDuplicateArgs) {
report(ParseError, false, pn, JSMSG_BAD_DUP_ARGS);
return false;
}
if (duplicatedArg)
*duplicatedArg = pn;
/* ParseContext::define assumes and asserts prevDecl is not in decls. */
MOZ_ASSERT(handler.getDefinitionKind(prevDecl) == Definition::ARG);
pc->prepareToAddDuplicateArg(name, prevDecl);
}
Node argpn = newName(name);
if (!argpn)
return false;
if (!checkStrictBinding(name, argpn))
return false;
handler.addFunctionArgument(funcpn, argpn);
return pc->define(tokenStream, name, argpn, Definition::ARG);
}
template <typename ParseHandler>
/* static */ bool
Parser<ParseHandler>::bindDestructuringArg(BindData<ParseHandler>* data,
HandlePropertyName name, Parser<ParseHandler>* parser)
{
ParseContext<ParseHandler>* pc = parser->pc;
MOZ_ASSERT(pc->sc->isFunctionBox());
if (pc->decls().lookupFirst(name)) {
parser->report(ParseError, false, null(), JSMSG_BAD_DUP_ARGS);
return false;
}
if (!parser->checkStrictBinding(name, data->pn))
return false;
return pc->define(parser->tokenStream, name, data->pn, Definition::VAR);
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::functionArguments(FunctionSyntaxKind kind, FunctionType type, Node* listp,
Node funcpn, bool* hasRest)
{
FunctionBox* funbox = pc->sc->asFunctionBox();
*hasRest = false;
bool parenFreeArrow = false;
if (kind == Arrow) {
TokenKind tt;
if (!tokenStream.peekToken(&tt))
return false;
if (tt == TOK_NAME)
parenFreeArrow = true;
}
if (!parenFreeArrow) {
TokenKind tt;
if (!tokenStream.getToken(&tt))
return false;
if (tt != TOK_LP) {
report(ParseError, false, null(),
kind == Arrow ? JSMSG_BAD_ARROW_ARGS : JSMSG_PAREN_BEFORE_FORMAL);
return false;
}
// Record the start of function source (for FunctionToString). If we
// are parenFreeArrow, we will set this below, after consuming the NAME.
funbox->setStart(tokenStream);
}
Node argsbody = handler.newList(PNK_ARGSBODY);
if (!argsbody)
return false;
handler.setFunctionBody(funcpn, argsbody);
bool hasArguments = false;
if (parenFreeArrow) {
hasArguments = true;
} else {
bool matched;
if (!tokenStream.matchToken(&matched, TOK_RP))
return false;
if (!matched)
hasArguments = true;
}
if (hasArguments) {
bool hasDefaults = false;
Node duplicatedArg = null();
Node list = null();
bool disallowDuplicateArgs = kind == Arrow || kind == Method;
if (type == Getter) {
report(ParseError, false, null(), JSMSG_ACCESSOR_WRONG_ARGS, "getter", "no", "s");
return false;
}
while (true) {
if (*hasRest) {
report(ParseError, false, null(), JSMSG_PARAMETER_AFTER_REST);
return false;
}
TokenKind tt;
if (!tokenStream.getToken(&tt))
return false;
MOZ_ASSERT_IF(parenFreeArrow, tt == TOK_NAME);
switch (tt) {
case TOK_LB:
case TOK_LC:
{
/* See comment below in the TOK_NAME case. */
disallowDuplicateArgs = true;
if (duplicatedArg) {
report(ParseError, false, duplicatedArg, JSMSG_BAD_DUP_ARGS);
return false;
}
if (hasDefaults) {
report(ParseError, false, null(), JSMSG_NONDEFAULT_FORMAL_AFTER_DEFAULT);
return false;
}
funbox->hasDestructuringArgs = true;
/*
* A destructuring formal parameter turns into one or more
* local variables initialized from properties of a single
* anonymous positional parameter, so here we must tweak our
* binder and its data.
*/
BindData<ParseHandler> data(context);
data.pn = ParseHandler::null();
data.op = JSOP_DEFVAR;
data.binder = bindDestructuringArg;
Node lhs = destructuringExprWithoutYield(&data, tt, JSMSG_YIELD_IN_DEFAULT);
if (!lhs)
return false;
/*
* Synthesize a destructuring assignment from the single
* anonymous positional parameter into the destructuring
* left-hand-side expression and accumulate it in list.
*/
HandlePropertyName name = context->names().empty;
Node rhs = newName(name);
if (!rhs)
return false;
if (!pc->define(tokenStream, name, rhs, Definition::ARG))
return false;
Node item = handler.newBinary(PNK_ASSIGN, lhs, rhs);
if (!item)
return false;
if (list) {
handler.addList(list, item);
} else {
list = handler.newList(PNK_VAR, item);
if (!list)
return false;
*listp = list;
}
break;
}
case TOK_YIELD:
if (!checkYieldNameValidity())
return false;
goto TOK_NAME;
case TOK_TRIPLEDOT:
{
if (type == Setter) {
report(ParseError, false, null(),
JSMSG_ACCESSOR_WRONG_ARGS, "setter", "one", "");
return false;
}
*hasRest = true;
if (!tokenStream.getToken(&tt))
return false;
if (tt != TOK_NAME) {
report(ParseError, false, null(), JSMSG_NO_REST_NAME);
return false;
}
disallowDuplicateArgs = true;
if (duplicatedArg) {
// Has duplicated args before the rest parameter.
report(ParseError, false, duplicatedArg, JSMSG_BAD_DUP_ARGS);
return false;
}
goto TOK_NAME;
}
TOK_NAME:
case TOK_NAME:
{
if (parenFreeArrow)
funbox->setStart(tokenStream);
RootedPropertyName name(context, tokenStream.currentName());
if (!defineArg(funcpn, name, disallowDuplicateArgs, &duplicatedArg))
return false;
bool matched;
if (!tokenStream.matchToken(&matched, TOK_ASSIGN))
return false;
if (matched) {
// A default argument without parentheses would look like:
// a = expr => body, but both operators are right-associative, so
// that would have been parsed as a = (expr => body) instead.
// Therefore it's impossible to get here with parenFreeArrow.
MOZ_ASSERT(!parenFreeArrow);
if (*hasRest) {
report(ParseError, false, null(), JSMSG_REST_WITH_DEFAULT);
return false;
}
disallowDuplicateArgs = true;
if (duplicatedArg) {
report(ParseError, false, duplicatedArg, JSMSG_BAD_DUP_ARGS);
return false;
}
if (!hasDefaults) {
hasDefaults = true;
// The Function.length property is the number of formals
// before the first default argument.
funbox->length = pc->numArgs() - 1;
}
Node def_expr = assignExprWithoutYield(JSMSG_YIELD_IN_DEFAULT);
if (!def_expr)
return false;
handler.setLastFunctionArgumentDefault(funcpn, def_expr);
}
break;
}
default:
report(ParseError, false, null(), JSMSG_MISSING_FORMAL);
return false;
}
if (parenFreeArrow || type == Setter)
break;
bool matched;
if (!tokenStream.matchToken(&matched, TOK_COMMA))
return false;
if (!matched)
break;
}
if (!parenFreeArrow) {
TokenKind tt;
if (!tokenStream.getToken(&tt))
return false;
if (tt != TOK_RP) {
if (type == Setter) {
report(ParseError, false, null(),
JSMSG_ACCESSOR_WRONG_ARGS, "setter", "one", "");
return false;
}
report(ParseError, false, null(), JSMSG_PAREN_AFTER_FORMAL);
return false;
}
}
if (!hasDefaults)
funbox->length = pc->numArgs() - *hasRest;
} else if (type == Setter) {
report(ParseError, false, null(), JSMSG_ACCESSOR_WRONG_ARGS, "setter", "one", "");
return false;
}
return true;
}
template <>
bool
Parser<FullParseHandler>::checkFunctionDefinition(HandlePropertyName funName,
ParseNode** pn_, FunctionSyntaxKind kind,
bool* pbodyProcessed)
{
ParseNode*& pn = *pn_;
*pbodyProcessed = false;
/* Function statements add a binding to the enclosing scope. */
bool bodyLevel = pc->atBodyLevel();
if (kind == Statement) {
/*
* Handle redeclaration and optimize cases where we can statically bind the
* function (thereby avoiding JSOP_DEFFUN and dynamic name lookup).
*/
if (Definition* dn = pc->decls().lookupFirst(funName)) {
MOZ_ASSERT(!dn->isUsed());
MOZ_ASSERT(dn->isDefn());
bool throwRedeclarationError = dn->kind() == Definition::GLOBALCONST ||
dn->kind() == Definition::CONST ||
dn->kind() == Definition::LET;
if (options().extraWarningsOption || throwRedeclarationError) {
JSAutoByteString name;
ParseReportKind reporter = throwRedeclarationError
? ParseError
: ParseExtraWarning;
if (!AtomToPrintableString(context, funName, &name) ||
!report(reporter, false, nullptr, JSMSG_REDECLARED_VAR,
Definition::kindString(dn->kind()), name.ptr()))
{
return false;
}
}
/*
* Body-level function statements are effectively variable
* declarations where the initialization is hoisted to the
* beginning of the block. This means that any other variable
* declaration with the same name is really just an assignment to
* the function's binding (which is mutable), so turn any existing
* declaration into a use.
*/
if (bodyLevel) {
if (dn->kind() == Definition::ARG) {
// The exception to the above comment is when the function
// has the same name as an argument. Then the argument node
// remains a definition. But change the function node pn so
// that it knows where the argument is located.
pn->setOp(JSOP_GETARG);
pn->setDefn(true);
pn->pn_cookie = dn->pn_cookie;
pn->pn_dflags |= PND_BOUND;
dn->markAsAssigned();
} else {
if (!makeDefIntoUse(dn, pn, funName))
return false;
}
}
} else if (bodyLevel) {
/*
* If this function was used before it was defined, claim the
* pre-created definition node for this function that primaryExpr
* put in pc->lexdeps on first forward reference, and recycle pn.
*/
if (Definition* fn = pc->lexdeps.lookupDefn<FullParseHandler>(funName)) {
MOZ_ASSERT(fn->isDefn());
fn->setKind(PNK_FUNCTION);
fn->setArity(PN_CODE);
fn->pn_pos.begin = pn->pn_pos.begin;
fn->pn_pos.end = pn->pn_pos.end;
fn->pn_body = nullptr;
fn->pn_cookie.makeFree();
pc->lexdeps->remove(funName);
handler.freeTree(pn);
pn = fn;
}
if (!pc->define(tokenStream, funName, pn, Definition::VAR))
return false;
}
if (bodyLevel) {
MOZ_ASSERT(pn->functionIsHoisted());
MOZ_ASSERT_IF(pc->sc->isFunctionBox(), !pn->pn_cookie.isFree());
MOZ_ASSERT_IF(!pc->sc->isFunctionBox(), pn->pn_cookie.isFree());
} else {
/*
* As a SpiderMonkey-specific extension, non-body-level function
* statements (e.g., functions in an "if" or "while" block) are
* dynamically bound when control flow reaches the statement.
*/
MOZ_ASSERT(!pc->sc->strict);
MOZ_ASSERT(pn->pn_cookie.isFree());
if (pc->sc->isFunctionBox()) {
FunctionBox* funbox = pc->sc->asFunctionBox();
funbox->setMightAliasLocals();
funbox->setHasExtensibleScope();
}
pn->setOp(JSOP_DEFFUN);
/*
* Instead of setting bindingsAccessedDynamically, which would be
* overly conservative, remember the names of all function
* statements and mark any bindings with the same as aliased at the
* end of functionBody.
*/
if (!pc->funcStmts) {
pc->funcStmts = alloc.new_<FuncStmtSet>(alloc);
if (!pc->funcStmts || !pc->funcStmts->init())
return false;
}
if (!pc->funcStmts->put(funName))
return false;
/*
* Due to the implicit declaration mechanism, 'arguments' will not
* have decls and, even if it did, they will not be noted as closed
* in the emitter. Thus, in the corner case of function statements
* overridding arguments, flag the whole scope as dynamic.
*/
if (funName == context->names().arguments)
pc->sc->setBindingsAccessedDynamically();
}
/* No further binding (in BindNameToSlot) is needed for functions. */
pn->pn_dflags |= PND_BOUND;
} else {
/* A function expression does not introduce any binding. */
pn->setOp(kind == Arrow ? JSOP_LAMBDA_ARROW : JSOP_LAMBDA);
}
// When a lazily-parsed function is called, we only fully parse (and emit)
// that function, not any of its nested children. The initial syntax-only
// parse recorded the free variables of nested functions and their extents,
// so we can skip over them after accounting for their free variables.
if (LazyScript* lazyOuter = handler.lazyOuterFunction()) {
JSFunction* fun = handler.nextLazyInnerFunction();
MOZ_ASSERT(!fun->isLegacyGenerator());
FunctionBox* funbox = newFunctionBox(pn, fun, pc, Directives(/* strict = */ false),
fun->generatorKind());
if (!funbox)
return false;
if (!addFreeVariablesFromLazyFunction(fun, pc))
return false;
// The position passed to tokenStream.advance() is an offset of the sort
// returned by userbuf.offset() and expected by userbuf.rawCharPtrAt(),
// while LazyScript::{begin,end} offsets are relative to the outermost
// script source.
uint32_t userbufBase = lazyOuter->begin() - lazyOuter->column();
if (!tokenStream.advance(fun->lazyScript()->end() - userbufBase))
return false;
*pbodyProcessed = true;
return true;
}
return true;
}
template <class T, class U>
static inline void
PropagateTransitiveParseFlags(const T* inner, U* outer)
{
if (inner->bindingsAccessedDynamically())
outer->setBindingsAccessedDynamically();
if (inner->hasDebuggerStatement())
outer->setHasDebuggerStatement();
if (inner->hasDirectEval())
outer->setHasDirectEval();
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::addFreeVariablesFromLazyFunction(JSFunction* fun,
ParseContext<ParseHandler>* pc)
{
// Update any definition nodes in this context according to free variables
// in a lazily parsed inner function.
bool bodyLevel = pc->atBodyLevel();
LazyScript* lazy = fun->lazyScript();
LazyScript::FreeVariable* freeVariables = lazy->freeVariables();
for (size_t i = 0; i < lazy->numFreeVariables(); i++) {
JSAtom* atom = freeVariables[i].atom();
// 'arguments' will be implicitly bound within the inner function.
if (atom == context->names().arguments)
continue;
DefinitionNode dn = pc->decls().lookupFirst(atom);
if (!dn) {
dn = getOrCreateLexicalDependency(pc, atom);
if (!dn)
return false;
}
// In ES6, lexical bindings are unaccessible before initialization. If
// the inner function closes over a placeholder definition, we need to
// mark the variable as maybe needing a dead zone check when we emit
// bytecode.
//
// Note that body-level function declaration statements are always
// hoisted to the top, so all accesses to free let variables need the
// dead zone check.
//
// Subtlety: we don't need to check for closing over a non-dominating
// lexical binding in a switch, as lexical declarations currently
// disable syntax parsing. So a non-dominating but textually preceding
// lexical declaration would have aborted syntax parsing, and a
// textually following declaration would return true for
// handler.isPlaceholderDefinition(dn) below.
if (handler.isPlaceholderDefinition(dn) || bodyLevel)
freeVariables[i].setIsHoistedUse();
/* Mark the outer dn as escaping. */
handler.setFlag(handler.getDefinitionNode(dn), PND_CLOSED);
}
PropagateTransitiveParseFlags(lazy, pc->sc);
return true;
}
template <>
bool
Parser<SyntaxParseHandler>::checkFunctionDefinition(HandlePropertyName funName,
Node* pn, FunctionSyntaxKind kind,
bool* pbodyProcessed)
{
*pbodyProcessed = false;
/* Function statements add a binding to the enclosing scope. */
bool bodyLevel = pc->atBodyLevel();
if (kind == Statement) {
/*
* Handle redeclaration and optimize cases where we can statically bind the
* function (thereby avoiding JSOP_DEFFUN and dynamic name lookup).
*/
if (DefinitionNode dn = pc->decls().lookupFirst(funName)) {
if (dn == Definition::GLOBALCONST ||
dn == Definition::CONST ||
dn == Definition::LET)
{
JSAutoByteString name;
if (!AtomToPrintableString(context, funName, &name) ||
!report(ParseError, false, null(), JSMSG_REDECLARED_VAR,
Definition::kindString(dn), name.ptr()))
{
return false;
}
}
} else if (bodyLevel) {
if (pc->lexdeps.lookupDefn<SyntaxParseHandler>(funName))
pc->lexdeps->remove(funName);
if (!pc->define(tokenStream, funName, *pn, Definition::VAR))
return false;
}
if (!bodyLevel && funName == context->names().arguments)
pc->sc->setBindingsAccessedDynamically();
}
if (kind == Arrow) {
/* Arrow functions cannot yet be parsed lazily. */
return abortIfSyntaxParser();
}
return true;
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::addExprAndGetNextTemplStrToken(Node nodeList, TokenKind* ttp)
{
Node pn = expr();
if (!pn)
return false;
handler.addList(nodeList, pn);
TokenKind tt;
if (!tokenStream.getToken(&tt))
return false;
if (tt != TOK_RC) {
report(ParseError, false, null(), JSMSG_TEMPLSTR_UNTERM_EXPR);
return false;
}
return tokenStream.getToken(ttp, TokenStream::TemplateTail);
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::taggedTemplate(Node nodeList, TokenKind tt)
{
Node callSiteObjNode = handler.newCallSiteObject(pos().begin, pc->blockidGen);
if (!callSiteObjNode)
return false;
handler.addList(nodeList, callSiteObjNode);
while (true) {
if (!appendToCallSiteObj(callSiteObjNode))
return false;
if (tt != TOK_TEMPLATE_HEAD)
break;
if (!addExprAndGetNextTemplStrToken(nodeList, &tt))
return false;
}
handler.setEndPosition(nodeList, callSiteObjNode);
return true;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::templateLiteral()
{
Node pn = noSubstitutionTemplate();
if (!pn)
return null();
Node nodeList = handler.newList(PNK_TEMPLATE_STRING_LIST, pn);
TokenKind tt;
do {
if (!addExprAndGetNextTemplStrToken(nodeList, &tt))
return null();
pn = noSubstitutionTemplate();
if (!pn)
return null();
handler.addList(nodeList, pn);
} while (tt == TOK_TEMPLATE_HEAD);
return nodeList;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::functionDef(HandlePropertyName funName,
FunctionType type, FunctionSyntaxKind kind,
GeneratorKind generatorKind, InvokedPrediction invoked)
{
MOZ_ASSERT_IF(kind == Statement, funName);
/* Make a TOK_FUNCTION node. */
Node pn = handler.newFunctionDefinition();
if (!pn)
return null();
if (invoked)
pn = handler.setLikelyIIFE(pn);
bool bodyProcessed;
if (!checkFunctionDefinition(funName, &pn, kind, &bodyProcessed))
return null();
if (bodyProcessed)
return pn;
RootedObject proto(context);
if (generatorKind == StarGenerator) {
// If we are off the main thread, the generator meta-objects have
// already been created by js::StartOffThreadParseScript, so cx will not
// be necessary.
JSContext* cx = context->maybeJSContext();
proto = GlobalObject::getOrCreateStarGeneratorFunctionPrototype(cx, context->global());
if (!proto)
return null();
}
RootedFunction fun(context, newFunction(funName, kind, proto));
if (!fun)
return null();
// Speculatively parse using the directives of the parent parsing context.
// If a directive is encountered (e.g., "use strict") that changes how the
// function should have been parsed, we backup and reparse with the new set
// of directives.
Directives directives(pc);
Directives newDirectives = directives;
TokenStream::Position start(keepAtoms);
tokenStream.tell(&start);
while (true) {
if (functionArgsAndBody(pn, fun, type, kind, generatorKind, directives, &newDirectives))
break;
if (tokenStream.hadError() || directives == newDirectives)
return null();
// Assignment must be monotonic to prevent reparsing iloops
MOZ_ASSERT_IF(directives.strict(), newDirectives.strict());
MOZ_ASSERT_IF(directives.asmJS(), newDirectives.asmJS());
directives = newDirectives;
tokenStream.seek(start);
// functionArgsAndBody may have already set pn->pn_body before failing.
handler.setFunctionBody(pn, null());
}
return pn;
}
template <>
bool
Parser<FullParseHandler>::finishFunctionDefinition(ParseNode* pn, FunctionBox* funbox,
ParseNode* prelude, ParseNode* body)
{
pn->pn_pos.end = pos().end;
/*
* If there were destructuring formal parameters, prepend the initializing
* comma expression that we synthesized to body. If the body is a return
* node, we must make a special PNK_SEQ node, to prepend the destructuring
* code without bracing the decompilation of the function body.
*/
if (prelude) {
if (!body->isArity(PN_LIST)) {
ParseNode* block;
block = handler.newList(PNK_SEQ, body);
if (!block)
return false;
body = block;
}
ParseNode* item = handler.new_<UnaryNode>(PNK_SEMI, JSOP_NOP,
TokenPos(body->pn_pos.begin, body->pn_pos.begin),
prelude);
if (!item)
return false;
body->prepend(item);
body->pn_xflags |= PNX_DESTRUCT;
}
MOZ_ASSERT(pn->pn_funbox == funbox);
MOZ_ASSERT(pn->pn_body->isKind(PNK_ARGSBODY));
pn->pn_body->append(body);
return true;
}
template <>
bool
Parser<SyntaxParseHandler>::finishFunctionDefinition(Node pn, FunctionBox* funbox,
Node prelude, Node body)
{
// The LazyScript for a lazily parsed function needs to be constructed
// while its ParseContext and associated lexdeps and inner functions are
// still available.
if (funbox->inWith)
return abortIfSyntaxParser();
size_t numFreeVariables = pc->lexdeps->count();
size_t numInnerFunctions = pc->innerFunctions.length();
RootedFunction fun(context, funbox->function());
LazyScript* lazy = LazyScript::CreateRaw(context, fun, numFreeVariables, numInnerFunctions,
versionNumber(), funbox->bufStart, funbox->bufEnd,
funbox->startLine, funbox->startColumn);
if (!lazy)
return false;
LazyScript::FreeVariable* freeVariables = lazy->freeVariables();
size_t i = 0;
for (AtomDefnRange r = pc->lexdeps->all(); !r.empty(); r.popFront())
freeVariables[i++] = LazyScript::FreeVariable(r.front().key());
MOZ_ASSERT(i == numFreeVariables);
HeapPtrFunction* innerFunctions = lazy->innerFunctions();
for (size_t i = 0; i < numInnerFunctions; i++)
innerFunctions[i].init(pc->innerFunctions[i]);
if (pc->sc->strict)
lazy->setStrict();
lazy->setGeneratorKind(funbox->generatorKind());
if (funbox->usesArguments && funbox->usesApply && funbox->usesThis)
lazy->setUsesArgumentsApplyAndThis();
PropagateTransitiveParseFlags(funbox, lazy);
fun->initLazyScript(lazy);
return true;
}
template <>
bool
Parser<FullParseHandler>::functionArgsAndBody(ParseNode* pn, HandleFunction fun,
FunctionType type, FunctionSyntaxKind kind,
GeneratorKind generatorKind,
Directives inheritedDirectives,
Directives* newDirectives)
{
ParseContext<FullParseHandler>* outerpc = pc;
// Create box for fun->object early to protect against last-ditch GC.
FunctionBox* funbox = newFunctionBox(pn, fun, pc, inheritedDirectives, generatorKind);
if (!funbox)
return false;
// Try a syntax parse for this inner function.
do {
// If we're assuming this function is an IIFE, always perform a full
// parse to avoid the overhead of a lazy syntax-only parse. Although
// the prediction may be incorrect, IIFEs are common enough that it
// pays off for lots of code.
if (pn->isLikelyIIFE() && !funbox->isGenerator())
break;
Parser<SyntaxParseHandler>* parser = handler.syntaxParser;
if (!parser)
break;
{
// Move the syntax parser to the current position in the stream.
TokenStream::Position position(keepAtoms);
tokenStream.tell(&position);
if (!parser->tokenStream.seek(position, tokenStream))
return false;
ParseContext<SyntaxParseHandler> funpc(parser, outerpc, SyntaxParseHandler::null(), funbox,
newDirectives, outerpc->staticLevel + 1,
outerpc->blockidGen, /* blockScopeDepth = */ 0);
if (!funpc.init(tokenStream))
return false;
if (!parser->functionArgsAndBodyGeneric(SyntaxParseHandler::NodeGeneric,
fun, type, kind))
{
if (parser->hadAbortedSyntaxParse()) {
// Try again with a full parse.
parser->clearAbortedSyntaxParse();
MOZ_ASSERT_IF(parser->context->isJSContext(),
!parser->context->asJSContext()->isExceptionPending());
break;
}
return false;
}
outerpc->blockidGen = funpc.blockidGen;
// Advance this parser over tokens processed by the syntax parser.
parser->tokenStream.tell(&position);
if (!tokenStream.seek(position, parser->tokenStream))
return false;
// Update the end position of the parse node.
pn->pn_pos.end = tokenStream.currentToken().pos.end;
}
if (!addFreeVariablesFromLazyFunction(fun, pc))
return false;
pn->pn_blockid = outerpc->blockid();
PropagateTransitiveParseFlags(funbox, outerpc->sc);
return true;
} while (false);
// Continue doing a full parse for this inner function.
ParseContext<FullParseHandler> funpc(this, pc, pn, funbox, newDirectives,
outerpc->staticLevel + 1, outerpc->blockidGen,
/* blockScopeDepth = */ 0);
if (!funpc.init(tokenStream))
return false;
if (!functionArgsAndBodyGeneric(pn, fun, type, kind))
return false;
if (!leaveFunction(pn, outerpc, kind))
return false;
pn->pn_blockid = outerpc->blockid();
/*
* Fruit of the poisonous tree: if a closure contains a dynamic name access
* (eval, with, etc), we consider the parent to do the same. The reason is
* that the deoptimizing effects of dynamic name access apply equally to
* parents: any local can be read at runtime.
*/
PropagateTransitiveParseFlags(funbox, outerpc->sc);
return true;
}
template <>
bool
Parser<SyntaxParseHandler>::functionArgsAndBody(Node pn, HandleFunction fun,
FunctionType type, FunctionSyntaxKind kind,
GeneratorKind generatorKind,
Directives inheritedDirectives,
Directives* newDirectives)
{
ParseContext<SyntaxParseHandler>* outerpc = pc;
// Create box for fun->object early to protect against last-ditch GC.
FunctionBox* funbox = newFunctionBox(pn, fun, pc, inheritedDirectives, generatorKind);
if (!funbox)
return false;
// Initialize early for possible flags mutation via destructuringExpr.
ParseContext<SyntaxParseHandler> funpc(this, pc, handler.null(), funbox, newDirectives,
outerpc->staticLevel + 1, outerpc->blockidGen,
/* blockScopeDepth = */ 0);
if (!funpc.init(tokenStream))
return false;
if (!functionArgsAndBodyGeneric(pn, fun, type, kind))
return false;
if (!leaveFunction(pn, outerpc, kind))
return false;
// This is a lazy function inner to another lazy function. Remember the
// inner function so that if the outer function is eventually parsed we do
// not need any further parsing or processing of the inner function.
MOZ_ASSERT(fun->lazyScript());
return outerpc->innerFunctions.append(fun);
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::appendToCallSiteObj(Node callSiteObj)
{
Node cookedNode = noSubstitutionTemplate();
if (!cookedNode)
return false;
JSAtom* atom = tokenStream.getRawTemplateStringAtom();
if (!atom)
return false;
Node rawNode = handler.newTemplateStringLiteral(atom, pos());
if (!rawNode)
return false;
return handler.addToCallSiteObject(callSiteObj, rawNode, cookedNode);
}
template <>
ParseNode*
Parser<FullParseHandler>::standaloneLazyFunction(HandleFunction fun, unsigned staticLevel,
bool strict, GeneratorKind generatorKind)
{
MOZ_ASSERT(checkOptionsCalled);
Node pn = handler.newFunctionDefinition();
if (!pn)
return null();
// Our tokenStream has no current token, so pn's position is garbage.
// Substitute the position of the first token in our source.
if (!tokenStream.peekTokenPos(&pn->pn_pos))
return null();
Directives directives(/* strict = */ strict);
FunctionBox* funbox = newFunctionBox(pn, fun, /* outerpc = */ nullptr, directives,
generatorKind);
if (!funbox)
return null();
funbox->length = fun->nargs() - fun->hasRest();
Directives newDirectives = directives;
ParseContext<FullParseHandler> funpc(this, /* parent = */ nullptr, pn, funbox,
&newDirectives, staticLevel, /* bodyid = */ 0,
/* blockScopeDepth = */ 0);
if (!funpc.init(tokenStream))
return null();
if (!functionArgsAndBodyGeneric(pn, fun, Normal, Statement)) {
MOZ_ASSERT(directives == newDirectives);
return null();
}
if (fun->isNamedLambda()) {
if (AtomDefnPtr p = pc->lexdeps->lookup(fun->name())) {
Definition* dn = p.value().get<FullParseHandler>();
if (!ConvertDefinitionToNamedLambdaUse(tokenStream, pc, funbox, dn))
return nullptr;
}
}
InternalHandle<Bindings*> bindings =
InternalHandle<Bindings*>::fromMarkedLocation(&funbox->bindings);
if (!pc->generateFunctionBindings(context, tokenStream, alloc, bindings))
return null();
if (!FoldConstants(context, &pn, this))
return null();
return pn;
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::functionArgsAndBodyGeneric(Node pn, HandleFunction fun, FunctionType type,
FunctionSyntaxKind kind)
{
// Given a properly initialized parse context, try to parse an actual
// function without concern for conversion to strict mode, use of lazy
// parsing and such.
Node prelude = null();
bool hasRest;
if (!functionArguments(kind, type, &prelude, pn, &hasRest))
return false;
FunctionBox* funbox = pc->sc->asFunctionBox();
fun->setArgCount(pc->numArgs());
if (hasRest)
fun->setHasRest();
if (kind == Arrow) {
bool matched;
if (!tokenStream.matchToken(&matched, TOK_ARROW))
return false;
if (!matched) {
report(ParseError, false, null(), JSMSG_BAD_ARROW_ARGS);
return false;
}
}
// Parse the function body.
FunctionBodyType bodyType = StatementListBody;
TokenKind tt;
if (!tokenStream.getToken(&tt, TokenStream::Operand))
return false;
if (tt != TOK_LC) {
if (funbox->isStarGenerator()) {
report(ParseError, false, null(), JSMSG_CURLY_BEFORE_BODY);
return false;
}
if (kind != Arrow) {
#if JS_HAS_EXPR_CLOSURES
addTelemetry(JSCompartment::DeprecatedExpressionClosure);
#else
report(ParseError, false, null(), JSMSG_CURLY_BEFORE_BODY);
return false;
#endif
}
tokenStream.ungetToken();
bodyType = ExpressionBody;
#if JS_HAS_EXPR_CLOSURES
fun->setIsExprClosure();
#endif
}
Node body = functionBody(kind, bodyType);
if (!body)
return false;
if (fun->name() && !checkStrictBinding(fun->name(), pn))
return false;
if (bodyType == StatementListBody) {
bool matched;
if (!tokenStream.matchToken(&matched, TOK_RC))
return false;
if (!matched) {
report(ParseError, false, null(), JSMSG_CURLY_AFTER_BODY);
return false;
}
funbox->bufEnd = pos().begin + 1;
} else {
#if not JS_HAS_EXPR_CLOSURES
MOZ_ASSERT(kind == Arrow);
#endif
if (tokenStream.hadError())
return false;
funbox->bufEnd = pos().end;
if (kind == Statement && !MatchOrInsertSemicolon(tokenStream))
return false;
}
return finishFunctionDefinition(pn, funbox, prelude, body);
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::checkYieldNameValidity()
{
// In star generators and in JS >= 1.7, yield is a keyword. Otherwise in
// strict mode, yield is a future reserved word.
if (pc->isStarGenerator() || versionNumber() >= JSVERSION_1_7 || pc->sc->strict) {
report(ParseError, false, null(), JSMSG_RESERVED_ID, "yield");
return false;
}
return true;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::functionStmt()
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FUNCTION));
RootedPropertyName name(context);
GeneratorKind generatorKind = NotGenerator;
TokenKind tt;
if (!tokenStream.getToken(&tt))
return null();
if (tt == TOK_MUL) {
generatorKind = StarGenerator;
if (!tokenStream.getToken(&tt))
return null();
}
if (tt == TOK_NAME) {
name = tokenStream.currentName();
} else if (tt == TOK_YIELD) {
if (!checkYieldNameValidity())
return null();
name = tokenStream.currentName();
} else {
/* Unnamed function expressions are forbidden in statement context. */
report(ParseError, false, null(), JSMSG_UNNAMED_FUNCTION_STMT);
return null();
}
/* We forbid function statements in strict mode code. */
if (!pc->atBodyLevel() && pc->sc->needStrictChecks() &&
!report(ParseStrictError, pc->sc->strict, null(), JSMSG_STRICT_FUNCTION_STATEMENT))
return null();
return functionDef(name, Normal, Statement, generatorKind);
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::functionExpr(InvokedPrediction invoked)
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FUNCTION));
GeneratorKind generatorKind = NotGenerator;
TokenKind tt;
if (!tokenStream.getToken(&tt))
return null();
if (tt == TOK_MUL) {
generatorKind = StarGenerator;
if (!tokenStream.getToken(&tt))
return null();
}
RootedPropertyName name(context);
if (tt == TOK_NAME) {
name = tokenStream.currentName();
} else if (tt == TOK_YIELD) {
if (!checkYieldNameValidity())
return null();
name = tokenStream.currentName();
} else {
tokenStream.ungetToken();
}
return functionDef(name, Normal, Expression, generatorKind, invoked);
}
/*
* Return true if this node, known to be an unparenthesized string literal,
* could be the string of a directive in a Directive Prologue. Directive
* strings never contain escape sequences or line continuations.
* isEscapeFreeStringLiteral, below, checks whether the node itself could be
* a directive.
*/
static inline bool
IsEscapeFreeStringLiteral(const TokenPos& pos, JSAtom* str)
{
/*
* If the string's length in the source code is its length as a value,
* accounting for the quotes, then it must not contain any escape
* sequences or line continuations.
*/
return pos.begin + str->length() + 2 == pos.end;
}
template <>
bool
Parser<SyntaxParseHandler>::asmJS(Node list)
{
// While asm.js could technically be validated and compiled during syntax
// parsing, we have no guarantee that some later JS wouldn't abort the
// syntax parse and cause us to re-parse (and re-compile) the asm.js module.
// For simplicity, unconditionally abort the syntax parse when "use asm" is
// encountered so that asm.js is always validated/compiled exactly once
// during a full parse.
JS_ALWAYS_FALSE(abortIfSyntaxParser());
return false;
}
template <>
bool
Parser<FullParseHandler>::asmJS(Node list)
{
// Disable syntax parsing in anything nested inside the asm.js module.
handler.disableSyntaxParser();
// We should be encountering the "use asm" directive for the first time; if
// the directive is already, we must have failed asm.js validation and we're
// reparsing. In that case, don't try to validate again. A non-null
// newDirectives means we're not in a normal function.
if (!pc->newDirectives || pc->newDirectives->asmJS())
return true;
// If there is no ScriptSource, then we are doing a non-compiling parse and
// so we shouldn't (and can't, without a ScriptSource) compile.
if (ss == nullptr)
return true;
pc->sc->asFunctionBox()->useAsm = true;
// Attempt to validate and compile this asm.js module. On success, the
// tokenStream has been advanced to the closing }. On failure, the
// tokenStream is in an indeterminate state and we must reparse the
// function from the beginning. Reparsing is triggered by marking that a
// new directive has been encountered and returning 'false'.
bool validated;
if (!ValidateAsmJS(context, *this, list, &validated))
return false;
if (!validated) {
pc->newDirectives->setAsmJS();
return false;
}
return true;
}
/*
* Recognize Directive Prologue members and directives. Assuming |pn| is a
* candidate for membership in a directive prologue, recognize directives and
* set |pc|'s flags accordingly. If |pn| is indeed part of a prologue, set its
* |pn_prologue| flag.
*
* Note that the following is a strict mode function:
*
* function foo() {
* "blah" // inserted semi colon
* "blurgh"
* "use\x20loose"
* "use strict"
* }
*
* That is, even though "use\x20loose" can never be a directive, now or in the
* future (because of the hex escape), the Directive Prologue extends through it
* to the "use strict" statement, which is indeed a directive.
*/
template <typename ParseHandler>
bool
Parser<ParseHandler>::maybeParseDirective(Node list, Node pn, bool* cont)
{
TokenPos directivePos;
JSAtom* directive = handler.isStringExprStatement(pn, &directivePos);
*cont = !!directive;
if (!*cont)
return true;
if (IsEscapeFreeStringLiteral(directivePos, directive)) {
// Mark this statement as being a possibly legitimate part of a
// directive prologue, so the bytecode emitter won't warn about it being
// useless code. (We mustn't just omit the statement entirely yet, as it
// could be producing the value of an eval or JSScript execution.)
//
// Note that even if the string isn't one we recognize as a directive,
// the emitter still shouldn't flag it as useless, as it could become a
// directive in the future. We don't want to interfere with people
// taking advantage of directive-prologue-enabled features that appear
// in other browsers first.
handler.setPrologue(pn);
if (directive == context->names().useStrict) {
// We're going to be in strict mode. Note that this scope explicitly
// had "use strict";
pc->sc->setExplicitUseStrict();
if (!pc->sc->strict) {
if (pc->sc->isFunctionBox()) {
// Request that this function be reparsed as strict.
pc->newDirectives->setStrict();
return false;
} else {
// We don't reparse global scopes, so we keep track of the
// one possible strict violation that could occur in the
// directive prologue -- octal escapes -- and complain now.
if (tokenStream.sawOctalEscape()) {
report(ParseError, false, null(), JSMSG_DEPRECATED_OCTAL);
return false;
}
pc->sc->strict = true;
}
}
} else if (directive == context->names().useAsm) {
if (pc->sc->isFunctionBox())
return asmJS(list);
return report(ParseWarning, false, pn, JSMSG_USE_ASM_DIRECTIVE_FAIL);
}
}
return true;
}
/*
* Parse the statements in a block, creating a StatementList node that lists
* the statements. If called from block-parsing code, the caller must match
* '{' before and '}' after.
*/
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::statements()
{
JS_CHECK_RECURSION(context, return null());
Node pn = handler.newStatementList(pc->blockid(), pos());
if (!pn)
return null();
Node saveBlock = pc->blockNode;
pc->blockNode = pn;
bool canHaveDirectives = pc->atBodyLevel();
for (;;) {
TokenKind tt;
if (!tokenStream.peekToken(&tt, TokenStream::Operand)) {
if (tokenStream.isEOF())
isUnexpectedEOF_ = true;
return null();
}
if (tt == TOK_EOF || tt == TOK_RC)
break;
Node next = statement(canHaveDirectives);
if (!next) {
if (tokenStream.isEOF())
isUnexpectedEOF_ = true;
return null();
}
if (canHaveDirectives) {
if (!maybeParseDirective(pn, next, &canHaveDirectives))
return null();
}
handler.addStatementToList(pn, next, pc);
}
/*
* Handle the case where there was a let declaration under this block. If
* it replaced pc->blockNode with a new block node then we must refresh pn
* and then restore pc->blockNode.
*/
if (pc->blockNode != pn)
pn = pc->blockNode;
pc->blockNode = saveBlock;
return pn;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::condition()
{
MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_BEFORE_COND);
Node pn = exprInParens();
if (!pn)
return null();
MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_COND);
/* Check for (a = b) and warn about possible (a == b) mistype. */
if (handler.isUnparenthesizedAssignment(pn)) {
if (!report(ParseExtraWarning, false, null(), JSMSG_EQUAL_AS_ASSIGN))
return null();
}
return pn;
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::matchLabel(MutableHandle<PropertyName*> label)
{
TokenKind tt;
if (!tokenStream.peekTokenSameLine(&tt, TokenStream::Operand))
return false;
if (tt == TOK_NAME) {
tokenStream.consumeKnownToken(TOK_NAME);
label.set(tokenStream.currentName());
} else if (tt == TOK_YIELD) {
tokenStream.consumeKnownToken(TOK_YIELD);
if (!checkYieldNameValidity())
return false;
label.set(tokenStream.currentName());
} else {
label.set(nullptr);
}
return true;
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::reportRedeclaration(Node pn, Definition::Kind redeclKind, HandlePropertyName name)
{
JSAutoByteString printable;
if (!AtomToPrintableString(context, name, &printable))
return false;
StmtInfoPC* stmt = LexicalLookup(pc, name, nullptr, (StmtInfoPC*)nullptr);
if (stmt && stmt->type == STMT_CATCH) {
report(ParseError, false, pn, JSMSG_REDECLARED_CATCH_IDENTIFIER, printable.ptr());
} else {
if (redeclKind == Definition::ARG) {
report(ParseError, false, pn, JSMSG_REDECLARED_PARAM, printable.ptr());
} else {
report(ParseError, false, pn, JSMSG_REDECLARED_VAR, Definition::kindString(redeclKind),
printable.ptr());
}
}
return false;
}
/*
* Define a lexical binding in a block, let-expression, or comprehension scope. pc
* must already be in such a scope.
*
* Throw a SyntaxError if 'atom' is an invalid name. Otherwise create a
* property for the new variable on the block object, pc->staticScope;
* populate data->pn->pn_{op,cookie,defn,dflags}; and stash a pointer to
* data->pn in a slot of the block object.
*/
template <>
/* static */ bool
Parser<FullParseHandler>::bindLexical(BindData<FullParseHandler>* data,
HandlePropertyName name, Parser<FullParseHandler>* parser)
{
ParseContext<FullParseHandler>* pc = parser->pc;
ParseNode* pn = data->pn;
if (!parser->checkStrictBinding(name, pn))
return false;
ExclusiveContext* cx = parser->context;
Rooted<StaticBlockObject*> blockObj(cx, data->let.blockObj);
unsigned index;
if (blockObj) {
index = blockObj->numVariables();
if (index >= StaticBlockObject::LOCAL_INDEX_LIMIT) {
parser->report(ParseError, false, pn, data->let.overflow);
return false;
}
} else {
// If we don't have a block object, we are parsing a body-level let,
// in which case we use a bogus index. See comment block below in
// setting the pn_cookie for explanation on how it gets adjusted.
index = 0;
}
// For block-level lets, assign block-local index to pn->pn_cookie right
// away, encoding it as an upvar cookie whose skip tells the current
// static level. The emitter will adjust the node's slot based on its
// stack depth model -- and, for global and eval code,
// js::frontend::CompileScript will adjust the slot again to include
// script->nfixed and body-level lets.
//
// For body-level lets, the index is bogus at this point and is adjusted
// when creating Bindings. See ParseContext::generateFunctionBindings and
// AppendPackedBindings.
if (!pn->pn_cookie.set(parser->tokenStream, pc->staticLevel, index))
return false;
Definition* dn = pc->decls().lookupFirst(name);
Definition::Kind bindingKind = data->isConst ? Definition::CONST : Definition::LET;
/*
* For bindings that are hoisted to the beginning of the block/function,
* define() right now. Otherwise, delay define until PushLetScope.
*/
if (data->let.varContext == HoistVars) {
if (dn && dn->pn_blockid == pc->blockid())
return parser->reportRedeclaration(pn, dn->kind(), name);
if (!pc->define(parser->tokenStream, name, pn, bindingKind))
return false;
}
if (blockObj) {
bool redeclared;
RootedId id(cx, NameToId(name));
RootedShape shape(cx, StaticBlockObject::addVar(cx, blockObj, id,
data->isConst, index, &redeclared));
if (!shape) {
if (redeclared) {
// The only way to be redeclared without a previous definition is if we're in a
// comma separated list in a DontHoistVars block, so a let block of for header. In
// that case, we must be redeclaring the same type of definition as we're trying to
// make.
Definition::Kind dnKind = dn ? dn->kind() : bindingKind;
parser->reportRedeclaration(pn, dnKind, name);
}
return false;
}
/* Store pn in the static block object. */
blockObj->setDefinitionParseNode(index, reinterpret_cast<Definition*>(pn));
} else {
// Body-level lets are hoisted and need to have been defined via
// pc->define above.
MOZ_ASSERT(data->let.varContext == HoistVars);
MOZ_ASSERT(pc->decls().lookupFirst(name));
}
return true;
}
template <>
/* static */ bool
Parser<SyntaxParseHandler>::bindLexical(BindData<SyntaxParseHandler>* data,
HandlePropertyName name, Parser<SyntaxParseHandler>* parser)
{
if (!parser->checkStrictBinding(name, data->pn))
return false;
return true;
}
template <typename ParseHandler, class Op>
static inline bool
ForEachLetDef(TokenStream& ts, ParseContext<ParseHandler>* pc,
HandleStaticBlockObject blockObj, Op op)
{
for (Shape::Range<CanGC> r(ts.context(), blockObj->lastProperty()); !r.empty(); r.popFront()) {
Shape& shape = r.front();
/* Beware the destructuring dummy slots. */
if (JSID_IS_INT(shape.propid()))
continue;
if (!op(ts, pc, blockObj, shape, JSID_TO_ATOM(shape.propid())))
return false;
}
return true;
}
template <typename ParseHandler>
struct PopLetDecl {
bool operator()(TokenStream&, ParseContext<ParseHandler>* pc, HandleStaticBlockObject,
const Shape&, JSAtom* atom)
{
pc->popLetDecl(atom);
return true;
}
};
// We compute the maximum block scope depth, in slots, of a compilation unit at
// parse-time. Each nested statement has a field indicating the maximum block
// scope depth that is nested inside it. When we leave a nested statement, we
// add the number of slots in the statement to the nested depth, and use that to
// update the maximum block scope depth of the outer statement or parse
// context. In the end, pc->blockScopeDepth will indicate the number of slots
// to reserve in the fixed part of a stack frame.
//
template <typename ParseHandler>
static void
AccumulateBlockScopeDepth(ParseContext<ParseHandler>* pc)
{
uint32_t innerDepth = pc->topStmt->innerBlockScopeDepth;
StmtInfoPC* outer = pc->topStmt->down;
if (pc->topStmt->isBlockScope)
innerDepth += pc->topStmt->staticScope->template as<StaticBlockObject>().numVariables();
if (outer) {
if (outer->innerBlockScopeDepth < innerDepth)
outer->innerBlockScopeDepth = innerDepth;
} else {
if (pc->blockScopeDepth < innerDepth)
pc->blockScopeDepth = innerDepth;
}
}
template <typename ParseHandler>
static void
PopStatementPC(TokenStream& ts, ParseContext<ParseHandler>* pc)
{
RootedNestedScopeObject scopeObj(ts.context(), pc->topStmt->staticScope);
MOZ_ASSERT(!!scopeObj == pc->topStmt->isNestedScope);
AccumulateBlockScopeDepth(pc);
FinishPopStatement(pc);
if (scopeObj) {
if (scopeObj->is<StaticBlockObject>()) {
RootedStaticBlockObject blockObj(ts.context(), &scopeObj->as<StaticBlockObject>());
MOZ_ASSERT(!blockObj->inDictionaryMode());
ForEachLetDef(ts, pc, blockObj, PopLetDecl<ParseHandler>());
}
scopeObj->resetEnclosingNestedScopeFromParser();
}
}
/*
* The function LexicalLookup searches a static binding for the given name in
* the stack of statements enclosing the statement currently being parsed. Each
* statement that introduces a new scope has a corresponding scope object, on
* which the bindings for that scope are stored. LexicalLookup either returns
* the innermost statement which has a scope object containing a binding with
* the given name, or nullptr.
*/
template <class ContextT>
typename ContextT::StmtInfo*
LexicalLookup(ContextT* ct, HandleAtom atom, int* slotp, typename ContextT::StmtInfo* stmt)
{
RootedId id(ct->sc->context, AtomToId(atom));
if (!stmt)
stmt = ct->topScopeStmt;
for (; stmt; stmt = stmt->downScope) {
/*
* With-statements introduce dynamic bindings. Since dynamic bindings
* can potentially override any static bindings introduced by statements
* further up the stack, we have to abort the search.
*/
if (stmt->type == STMT_WITH && !ct->sc->isDotVariable(atom))
break;
// Skip statements that do not introduce a new scope
if (!stmt->isBlockScope)
continue;
StaticBlockObject& blockObj = stmt->staticBlock();
Shape* shape = blockObj.lookup(ct->sc->context, id);
if (shape) {
if (slotp)
*slotp = blockObj.shapeToIndex(*shape);
return stmt;
}
}
if (slotp)
*slotp = -1;
return stmt;
}
template <typename ParseHandler>
static inline bool
OuterLet(ParseContext<ParseHandler>* pc, StmtInfoPC* stmt, HandleAtom atom)
{
while (stmt->downScope) {
stmt = LexicalLookup(pc, atom, nullptr, stmt->downScope);
if (!stmt)
return false;
if (stmt->type == STMT_BLOCK)
return true;
}
return false;
}
template <typename ParseHandler>
/* static */ bool
Parser<ParseHandler>::bindVarOrGlobalConst(BindData<ParseHandler>* data,
HandlePropertyName name, Parser<ParseHandler>* parser)
{
ExclusiveContext* cx = parser->context;
ParseContext<ParseHandler>* pc = parser->pc;
Node pn = data->pn;
bool isConstDecl = data->op == JSOP_DEFCONST;
/* Default best op for pn is JSOP_GETNAME; we'll try to improve below. */
parser->handler.setOp(pn, JSOP_GETNAME);
if (!parser->checkStrictBinding(name, pn))
return false;
StmtInfoPC* stmt = LexicalLookup(pc, name, nullptr, (StmtInfoPC*)nullptr);
if (stmt && stmt->type == STMT_WITH) {
parser->handler.setFlag(pn, PND_DEOPTIMIZED);
if (pc->sc->isFunctionBox()) {
FunctionBox* funbox = pc->sc->asFunctionBox();
funbox->setMightAliasLocals();
}
/*
* This definition isn't being added to the parse context's
* declarations, so make sure to indicate the need to deoptimize
* the script's arguments object. Mark the function as if it
* contained a debugger statement, which will deoptimize arguments
* as much as possible.
*/
if (name == cx->names().arguments)
pc->sc->setHasDebuggerStatement();
return true;
}
DefinitionList::Range defs = pc->decls().lookupMulti(name);
MOZ_ASSERT_IF(stmt, !defs.empty());
if (defs.empty()) {
return pc->define(parser->tokenStream, name, pn,
isConstDecl ? Definition::GLOBALCONST : Definition::VAR);
}
/*
* There was a previous declaration with the same name. The standard
* disallows several forms of redeclaration. Critically,
* let (x) { var x; } // error
* is not allowed which allows us to turn any non-error redeclaration
* into a use of the initial declaration.
*/
DefinitionNode dn = defs.front<ParseHandler>();
Definition::Kind dn_kind = parser->handler.getDefinitionKind(dn);
if (dn_kind == Definition::ARG) {
JSAutoByteString bytes;
if (!AtomToPrintableString(cx, name, &bytes))
return false;
if (isConstDecl) {
parser->report(ParseError, false, pn, JSMSG_REDECLARED_PARAM, bytes.ptr());
return false;
}
if (!parser->report(ParseExtraWarning, false, pn, JSMSG_VAR_HIDES_ARG, bytes.ptr()))
return false;
} else {
bool inCatchBody = (stmt && stmt->type == STMT_CATCH);
bool error = (isConstDecl ||
dn_kind == Definition::CONST ||
dn_kind == Definition::GLOBALCONST ||
(dn_kind == Definition::LET &&
(!inCatchBody || OuterLet(pc, stmt, name))));
if (parser->options().extraWarningsOption
? data->op != JSOP_DEFVAR || dn_kind != Definition::VAR
: error)
{
JSAutoByteString bytes;
if (!AtomToPrintableString(cx, name, &bytes))
return false;
ParseReportKind reporter = error ? ParseError : ParseExtraWarning;
if (!(inCatchBody
? parser->report(reporter, false, pn,
JSMSG_REDECLARED_CATCH_IDENTIFIER, bytes.ptr())
: parser->report(reporter, false, pn, JSMSG_REDECLARED_VAR,
Definition::kindString(dn_kind), bytes.ptr())))
{
return false;
}
}
}
parser->handler.linkUseToDef(pn, dn);
return true;
}
template <>
bool
Parser<FullParseHandler>::makeSetCall(ParseNode* pn, unsigned msg)
{
MOZ_ASSERT(pn->isKind(PNK_CALL));
MOZ_ASSERT(pn->isArity(PN_LIST));
MOZ_ASSERT(pn->isOp(JSOP_CALL) || pn->isOp(JSOP_SPREADCALL) ||
pn->isOp(JSOP_EVAL) || pn->isOp(JSOP_STRICTEVAL) ||
pn->isOp(JSOP_SPREADEVAL) || pn->isOp(JSOP_STRICTSPREADEVAL) ||
pn->isOp(JSOP_FUNCALL) || pn->isOp(JSOP_FUNAPPLY));
if (!report(ParseStrictError, pc->sc->strict, pn, msg))
return false;
handler.markAsSetCall(pn);
return true;
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::noteNameUse(HandlePropertyName name, Node pn)
{
/*
* The asm.js validator does all its own symbol-table management so, as an
* optimization, avoid doing any work here. Use-def links are only necessary
* for emitting bytecode and successfully-validated asm.js does not emit
* bytecode. (On validation failure, the asm.js module is reparsed.)
*/
if (pc->useAsmOrInsideUseAsm())
return true;
StmtInfoPC* stmt = LexicalLookup(pc, name, nullptr, (StmtInfoPC*)nullptr);
DefinitionList::Range defs = pc->decls().lookupMulti(name);
DefinitionNode dn;
if (!defs.empty()) {
dn = defs.front<ParseHandler>();
} else {
/*
* No definition before this use in any lexical scope.
* Create a placeholder definition node to either:
* - Be adopted when we parse the real defining
* declaration, or
* - Be left as a free variable definition if we never
* see the real definition.
*/
dn = getOrCreateLexicalDependency(pc, name);
if (!dn)
return false;
}
handler.linkUseToDef(pn, dn);
if (stmt) {
if (stmt->type == STMT_WITH) {
handler.setFlag(pn, PND_DEOPTIMIZED);
} else if (stmt->type == STMT_SWITCH && stmt->isBlockScope) {
// See comments above StmtInfoPC and switchStatement for how
// firstDominatingLexicalInCase is computed.
MOZ_ASSERT(stmt->firstDominatingLexicalInCase <= stmt->staticBlock().numVariables());
handler.markMaybeUninitializedLexicalUseInSwitch(pn, dn,
stmt->firstDominatingLexicalInCase);
}
}
return true;
}
template <>
bool
Parser<FullParseHandler>::bindDestructuringVar(BindData<FullParseHandler>* data, ParseNode* pn)
{
MOZ_ASSERT(pn->isKind(PNK_NAME));
RootedPropertyName name(context, pn->pn_atom->asPropertyName());
data->pn = pn;
if (!data->binder(data, name, this))
return false;
/*
* Select the appropriate name-setting opcode, respecting eager selection
* done by the data->binder function.
*/
if (data->op == JSOP_INITLEXICAL)
pn->setOp(JSOP_INITLEXICAL);
else if (pn->pn_dflags & PND_BOUND)
pn->setOp(JSOP_SETLOCAL);
else if (data->op == JSOP_DEFCONST)
pn->setOp(JSOP_SETCONST);
else
pn->setOp(JSOP_SETNAME);
if (data->op == JSOP_DEFCONST)
pn->pn_dflags |= PND_CONST;
pn->markAsAssigned();
return true;
}
template <>
bool
Parser<FullParseHandler>::checkDestructuring(BindData<FullParseHandler>* data, ParseNode* left);
template <>
bool
Parser<FullParseHandler>::checkDestructuringObject(BindData<FullParseHandler>* data,
ParseNode* objectPattern)
{
MOZ_ASSERT(objectPattern->isKind(PNK_OBJECT));
for (ParseNode* member = objectPattern->pn_head; member; member = member->pn_next) {
ParseNode* expr;
if (member->isKind(PNK_MUTATEPROTO)) {
expr = member->pn_kid;
} else {
MOZ_ASSERT(member->isKind(PNK_COLON) || member->isKind(PNK_SHORTHAND));
expr = member->pn_right;
}
if (expr->isKind(PNK_ASSIGN))
expr = expr->pn_left;
bool ok;
if (expr->isKind(PNK_ARRAY) || expr->isKind(PNK_OBJECT)) {
ok = checkDestructuring(data, expr);
} else if (data) {
if (!expr->isKind(PNK_NAME)) {
report(ParseError, false, expr, JSMSG_NO_VARIABLE_NAME);
return false;
}
ok = bindDestructuringVar(data, expr);
} else {
ok = checkAndMarkAsAssignmentLhs(expr, KeyedDestructuringAssignment);
}
if (!ok)
return false;
}
return true;
}
template <>
bool
Parser<FullParseHandler>::checkDestructuringArray(BindData<FullParseHandler>* data,
ParseNode* arrayPattern)
{
MOZ_ASSERT(arrayPattern->isKind(PNK_ARRAY));
for (ParseNode* element = arrayPattern->pn_head; element; element = element->pn_next) {
if (element->isKind(PNK_ELISION))
continue;
ParseNode* target = element;
if (target->isKind(PNK_SPREAD)) {
if (target->pn_next) {
report(ParseError, false, target->pn_next, JSMSG_PARAMETER_AFTER_REST);
return false;
}
target = target->pn_kid;
// The RestElement should not support nested patterns.
if (target->isKind(PNK_ARRAY) || target->isKind(PNK_OBJECT)) {
report(ParseError, false, target, JSMSG_BAD_DESTRUCT_TARGET);
return false;
}
} else if (target->isKind(PNK_ASSIGN)) {
target = target->pn_left;
}
bool ok;
if (target->isKind(PNK_ARRAY) || target->isKind(PNK_OBJECT)) {
ok = checkDestructuring(data, target);
} else {
if (data) {
if (!target->isKind(PNK_NAME)) {
report(ParseError, false, target, JSMSG_NO_VARIABLE_NAME);
return false;
}
ok = bindDestructuringVar(data, target);
} else {
ok = checkAndMarkAsAssignmentLhs(target, KeyedDestructuringAssignment);
}
}
if (!ok)
return false;
}
return true;
}
/*
* Destructuring patterns can appear in two kinds of contexts:
*
* - assignment-like: assignment expressions and |for| loop heads. In
* these cases, the patterns' property value positions can be
* arbitrary lvalue expressions; the destructuring is just a fancy
* assignment.
*
* - binding-like: |var| and |let| declarations, functions' formal
* parameter lists, |catch| clauses, and comprehension tails. In
* these cases, the patterns' property value positions must be
* simple names; the destructuring defines them as new variables.
*
* In both cases, other code parses the pattern as an arbitrary
* primaryExpr, and then, here in checkDestructuring, verify that the
* tree is a valid AssignmentPattern or BindingPattern.
*
* In assignment-like contexts, we parse the pattern with
* pc->inDeclDestructuring clear, so the lvalue expressions in the
* pattern are parsed normally. primaryExpr links variable references
* into the appropriate use chains; creates placeholder definitions;
* and so on. checkDestructuring is called with |data| nullptr (since
* we won't be binding any new names), and we specialize lvalues as
* appropriate.
*
* In declaration-like contexts, the normal variable reference
* processing would just be an obstruction, because we're going to
* define the names that appear in the property value positions as new
* variables anyway. In this case, we parse the pattern with
* pc->inDeclDestructuring set, which directs primaryExpr to leave
* whatever name nodes it creates unconnected. Then, here in
* checkDestructuring, we require the pattern's property value
* positions to be simple names, and define them as appropriate to the
* context. For these calls, |data| points to the right sort of
* BindData.
*/
template <>
bool
Parser<FullParseHandler>::checkDestructuring(BindData<FullParseHandler>* data, ParseNode* left)
{
if (left->isKind(PNK_ARRAYCOMP)) {
report(ParseError, false, left, JSMSG_ARRAY_COMP_LEFTSIDE);
return false;
}
if (left->isKind(PNK_ARRAY))
return checkDestructuringArray(data, left);
return checkDestructuringObject(data, left);
}
template <>
bool
Parser<SyntaxParseHandler>::checkDestructuring(BindData<SyntaxParseHandler>* data, Node left)
{
return abortIfSyntaxParser();
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::destructuringExpr(BindData<ParseHandler>* data, TokenKind tt)
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(tt));
pc->inDeclDestructuring = true;
Node pn = primaryExpr(tt);
pc->inDeclDestructuring = false;
if (!pn)
return null();
if (!checkDestructuring(data, pn))
return null();
return pn;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::destructuringExprWithoutYield(BindData<ParseHandler>* data, TokenKind tt,
unsigned msg)
{
uint32_t startYieldOffset = pc->lastYieldOffset;
Node res = destructuringExpr(data, tt);
if (res && pc->lastYieldOffset != startYieldOffset) {
reportWithOffset(ParseError, false, pc->lastYieldOffset,
msg, js_yield_str);
return null();
}
return res;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::pushLexicalScope(HandleStaticBlockObject blockObj, StmtInfoPC* stmt)
{
MOZ_ASSERT(blockObj);
ObjectBox* blockbox = newObjectBox(blockObj);
if (!blockbox)
return null();
PushStatementPC(pc, stmt, STMT_BLOCK);
blockObj->initEnclosingNestedScopeFromParser(pc->staticScope);
FinishPushNestedScope(pc, stmt, *blockObj.get());
stmt->isBlockScope = true;
Node pn = handler.newLexicalScope(blockbox);
if (!pn)
return null();
if (!GenerateBlockId(tokenStream, pc, stmt->blockid))
return null();
handler.setBlockId(pn, stmt->blockid);
return pn;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::pushLexicalScope(StmtInfoPC* stmt)
{
RootedStaticBlockObject blockObj(context, StaticBlockObject::create(context));
if (!blockObj)
return null();
return pushLexicalScope(blockObj, stmt);
}
struct AddLetDecl
{
uint32_t blockid;
explicit AddLetDecl(uint32_t blockid) : blockid(blockid) {}
bool operator()(TokenStream& ts, ParseContext<FullParseHandler>* pc,
HandleStaticBlockObject blockObj, const Shape& shape, JSAtom*)
{
ParseNode* def = (ParseNode*) blockObj->getSlot(shape.slot()).toPrivate();
def->pn_blockid = blockid;
RootedPropertyName name(ts.context(), def->name());
return pc->define(ts, name, def, Definition::LET);
}
};
template <>
ParseNode*
Parser<FullParseHandler>::pushLetScope(HandleStaticBlockObject blockObj, StmtInfoPC* stmt)
{
MOZ_ASSERT(blockObj);
ParseNode* pn = pushLexicalScope(blockObj, stmt);
if (!pn)
return null();
pn->pn_dflags |= PND_LEXICAL;
/* Populate the new scope with decls found in the head with updated blockid. */
if (!ForEachLetDef(tokenStream, pc, blockObj, AddLetDecl(stmt->blockid)))
return null();
return pn;
}
template <>
SyntaxParseHandler::Node
Parser<SyntaxParseHandler>::pushLetScope(HandleStaticBlockObject blockObj, StmtInfoPC* stmt)
{
JS_ALWAYS_FALSE(abortIfSyntaxParser());
return SyntaxParseHandler::NodeFailure;
}
/*
* Parse a let block statement or let expression (determined by 'letContext').
* In both cases, bindings are not hoisted to the top of the enclosing block
* and thus must be carefully injected between variables() and the let body.
*/
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::deprecatedLetBlockOrExpression(LetContext letContext)
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_LET));
RootedStaticBlockObject blockObj(context, StaticBlockObject::create(context));
if (!blockObj)
return null();
uint32_t begin = pos().begin;
MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_BEFORE_LET);
Node vars = variables(PNK_LET, nullptr, blockObj, DontHoistVars);
if (!vars)
return null();
MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_LET);
StmtInfoPC stmtInfo(context);
Node block = pushLetScope(blockObj, &stmtInfo);
if (!block)
return null();
bool needExprStmt = false;
if (letContext == LetStatement) {
bool matched;
if (!tokenStream.matchToken(&matched, TOK_LC, TokenStream::Operand))
return null();
if (!matched) {
/*
* Strict mode eliminates a grammar ambiguity with unparenthesized
* LetExpressions in an ExpressionStatement. If followed immediately
* by an arguments list, it's ambiguous whether the let expression
* is the callee or the call is inside the let expression body.
*
* function id(x) { return x; }
* var x = "outer";
* // Does this parse as
* // (let (loc = "inner") id)(loc) // "outer"
* // or as
* // let (loc = "inner") (id(loc)) // "inner"
* let (loc = "inner") id(loc);
*
* See bug 569464.
*/
if (!reportWithOffset(ParseStrictError, pc->sc->strict, begin,
JSMSG_STRICT_CODE_LET_EXPR_STMT))
{
return null();
}
/*
* If this is really an expression in let statement guise, then we
* need to wrap the PNK_LETEXPR node in a PNK_SEMI node so that we
* pop the return value of the expression.
*/
needExprStmt = true;
letContext = LetExpression;
}
}
Node expr;
if (letContext == LetStatement) {
expr = statements();
if (!expr)
return null();
MUST_MATCH_TOKEN(TOK_RC, JSMSG_CURLY_AFTER_LET);
addTelemetry(JSCompartment::DeprecatedLetBlock);
if (!report(ParseWarning, pc->sc->strict, expr, JSMSG_DEPRECATED_LET_BLOCK))
return null();
} else {
MOZ_ASSERT(letContext == LetExpression);
expr = assignExpr();
if (!expr)
return null();
addTelemetry(JSCompartment::DeprecatedLetExpression);
if (!report(ParseWarning, pc->sc->strict, expr, JSMSG_DEPRECATED_LET_EXPRESSION))
return null();
}
handler.setLexicalScopeBody(block, expr);
PopStatementPC(tokenStream, pc);
TokenPos letPos(begin, pos().end);
if (letContext == LetExpression) {
if (needExprStmt) {
if (!MatchOrInsertSemicolon(tokenStream))
return null();
}
Node letExpr = handler.newLetExpression(vars, block, letPos);
if (!letExpr)
return null();
return needExprStmt ? handler.newExprStatement(letExpr, pos().end) : letExpr;
}
return handler.newLetBlock(vars, block, letPos);
}
template <typename ParseHandler>
static bool
PushBlocklikeStatement(TokenStream& ts, StmtInfoPC* stmt, StmtType type,
ParseContext<ParseHandler>* pc)
{
PushStatementPC(pc, stmt, type);
return GenerateBlockId(ts, pc, stmt->blockid);
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::blockStatement()
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_LC));
StmtInfoPC stmtInfo(context);
if (!PushBlocklikeStatement(tokenStream, &stmtInfo, STMT_BLOCK, pc))
return null();
Node list = statements();
if (!list)
return null();
MUST_MATCH_TOKEN(TOK_RC, JSMSG_CURLY_IN_COMPOUND);
PopStatementPC(tokenStream, pc);
return list;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::newBindingNode(PropertyName* name, bool functionScope, VarContext varContext)
{
/*
* If this name is being injected into an existing block/function, see if
* it has already been declared or if it resolves an outstanding lexdep.
* Otherwise, this is a let block/expr that introduces a new scope and thus
* shadows existing decls and doesn't resolve existing lexdeps. Duplicate
* names are caught by bindLet.
*/
if (varContext == HoistVars) {
if (AtomDefnPtr p = pc->lexdeps->lookup(name)) {
DefinitionNode lexdep = p.value().get<ParseHandler>();
MOZ_ASSERT(handler.getDefinitionKind(lexdep) == Definition::PLACEHOLDER);
Node pn = handler.getDefinitionNode(lexdep);
if (handler.dependencyCovered(pn, pc->blockid(), functionScope)) {
handler.setBlockId(pn, pc->blockid());
pc->lexdeps->remove(p);
handler.setPosition(pn, pos());
return pn;
}
}
}
/* Make a new node for this declarator name (or destructuring pattern). */
return newName(name);
}
/*
* The 'blockObj' parameter is non-null when parsing the 'vars' in a let
* expression, block statement, non-top-level let declaration in statement
* context, and the let-initializer of a for-statement.
*/
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::variables(ParseNodeKind kind, bool* psimple,
StaticBlockObject* blockObj, VarContext varContext)
{
/*
* The four options here are:
* - PNK_VAR: We're parsing var declarations.
* - PNK_CONST: We're parsing const declarations.
* - PNK_GLOBALCONST: We're parsing const declarations at toplevel (see bug 589119).
* - PNK_LET: We are parsing a let declaration.
*/
MOZ_ASSERT(kind == PNK_VAR || kind == PNK_CONST || kind == PNK_LET || kind == PNK_GLOBALCONST);
/*
* The simple flag is set if the declaration has the form 'var x', with
* only one variable declared and no initializer expression.
*/
MOZ_ASSERT_IF(psimple, *psimple);
JSOp op = JSOP_NOP;
if (kind == PNK_VAR)
op = JSOP_DEFVAR;
else if (kind == PNK_GLOBALCONST)
op = JSOP_DEFCONST;
Node pn = handler.newList(kind, op);
if (!pn)
return null();
/*
* SpiderMonkey const is really "write once per initialization evaluation"
* var, whereas let is block scoped. ES-Harmony wants block-scoped const so
* this code will change soon.
*/
BindData<ParseHandler> data(context);
if (kind == PNK_VAR || kind == PNK_GLOBALCONST) {
data.initVarOrGlobalConst(op);
} else {
data.initLexical(varContext, blockObj, JSMSG_TOO_MANY_LOCALS,
/* isConst = */ kind == PNK_CONST);
}
bool first = true;
Node pn2;
while (true) {
do {
if (psimple && !first)
*psimple = false;
first = false;
TokenKind tt;
if (!tokenStream.getToken(&tt))
return null();
if (tt == TOK_LB || tt == TOK_LC) {
if (psimple)
*psimple = false;
pc->inDeclDestructuring = true;
pn2 = primaryExpr(tt);
pc->inDeclDestructuring = false;
if (!pn2)
return null();
bool parsingForInOrOfInit = false;
if (pc->parsingForInit) {
bool isForIn, isForOf;
if (!matchInOrOf(&isForIn, &isForOf))
return null();
parsingForInOrOfInit = isForIn || isForOf;
}
// See comment below for bindBeforeInitializer in the code that
// handles the non-destructuring case.
bool bindBeforeInitializer = (kind != PNK_LET && kind != PNK_CONST) ||
parsingForInOrOfInit;
if (bindBeforeInitializer && !checkDestructuring(&data, pn2))
return null();
if (parsingForInOrOfInit) {
tokenStream.ungetToken();
handler.addList(pn, pn2);
break;
}
MUST_MATCH_TOKEN(TOK_ASSIGN, JSMSG_BAD_DESTRUCT_DECL);
Node init = assignExpr();
if (!init)
return null();
if (!bindBeforeInitializer && !checkDestructuring(&data, pn2))
return null();
pn2 = handler.newBinary(PNK_ASSIGN, pn2, init);
if (!pn2)
return null();
handler.addList(pn, pn2);
break;
}
if (tt != TOK_NAME) {
if (tt == TOK_YIELD) {
if (!checkYieldNameValidity())
return null();
} else {
report(ParseError, false, null(), JSMSG_NO_VARIABLE_NAME);
return null();
}
}
RootedPropertyName name(context, tokenStream.currentName());
pn2 = newBindingNode(name, kind == PNK_VAR || kind == PNK_GLOBALCONST, varContext);
if (!pn2)
return null();
if (data.isConst)
handler.setFlag(pn2, PND_CONST);
data.pn = pn2;
handler.addList(pn, pn2);
bool matched;
if (!tokenStream.matchToken(&matched, TOK_ASSIGN))
return null();
if (matched) {
if (psimple)
*psimple = false;
// In ES6, lexical bindings may not be accessed until
// initialized. So a declaration of the form |let x = x| results
// in a ReferenceError, as the 'x' on the RHS is accessing the let
// binding before it is initialized.
//
// If we are not parsing a let declaration, bind the name
// now. Otherwise we must wait until after parsing the initializing
// assignment.
bool bindBeforeInitializer = kind != PNK_LET && kind != PNK_CONST;
if (bindBeforeInitializer && !data.binder(&data, name, this))
return null();
Node init = assignExpr();
if (!init)
return null();
if (!bindBeforeInitializer && !data.binder(&data, name, this))
return null();
if (!handler.finishInitializerAssignment(pn2, init, data.op))
return null();
} else {
if (data.isConst && !pc->parsingForInit) {
report(ParseError, false, null(), JSMSG_BAD_CONST_DECL);
return null();
}
if (!data.binder(&data, name, this))
return null();
}
} while (false);
bool matched;
if (!tokenStream.matchToken(&matched, TOK_COMMA))
return null();
if (!matched)
break;
}
return pn;
}
template <>
ParseNode*
Parser<FullParseHandler>::lexicalDeclaration(bool isConst)
{
handler.disableSyntaxParser();
ParseNode* pn;
do {
/*
* This is a let declaration. We must be directly under a block per the
* proposed ES4 specs, but not an implicit block created due to
* 'for (let ...)'. If we pass this error test, make the enclosing
* StmtInfoPC be our scope. Further let declarations in this block will
* find this scope statement and use the same block object.
*
* If we are the first let declaration in this block (i.e., when the
* enclosing maybe-scope StmtInfoPC isn't yet a scope statement) then
* we also need to set pc->blockNode to be our PNK_LEXICALSCOPE.
*/
StmtInfoPC* stmt = pc->topStmt;
if (stmt && (!stmt->maybeScope() || stmt->isForLetBlock)) {
report(ParseError, false, null(), JSMSG_LEXICAL_DECL_NOT_IN_BLOCK,
isConst ? "const" : "let");
return null();
}
if (stmt && stmt->isBlockScope) {
MOZ_ASSERT(pc->staticScope == stmt->staticScope);
} else {
if (pc->atBodyLevel()) {
/*
* When bug 589199 is fixed, let variables will be stored in
* the slots of a new scope chain object, encountered just
* before the global object in the overall chain. This extra
* object is present in the scope chain for all code in that
* global, including self-hosted code. But self-hosted code
* must be usable against *any* global object, including ones
* with other let variables -- variables possibly placed in
* conflicting slots. Forbid top-level let declarations to
* prevent such conflicts from ever occurring.
*/
bool isGlobal = !pc->sc->isFunctionBox() && stmt == pc->topScopeStmt;
if (options().selfHostingMode && isGlobal) {
report(ParseError, false, null(), JSMSG_SELFHOSTED_TOP_LEVEL_LEXICAL,
isConst ? "'const'" : "'let'");
return null();
}
/*
* Parse body-level lets without a new block object. ES6 specs
* that an execution environment's initial lexical environment
* is the VariableEnvironment, i.e., body-level lets are in
* the same environment record as vars.
*
* However, they cannot be parsed exactly as vars, as ES6
* requires that uninitialized lets throw ReferenceError on use.
*
* See 8.1.1.1.6 and the note in 13.2.1.
*
* FIXME global-level lets are still considered vars until
* other bugs are fixed.
*/
ParseNodeKind kind = PNK_LET;
if (isGlobal)
kind = isConst ? PNK_GLOBALCONST : PNK_VAR;
else if (isConst)
kind = PNK_CONST;
pn = variables(kind);
if (!pn)
return null();
pn->pn_xflags |= PNX_POPVAR;
break;
}
/*
* Some obvious assertions here, but they may help clarify the
* situation. This stmt is not yet a scope, so it must not be a
* catch block (catch is a lexical scope by definition).
*/
MOZ_ASSERT(!stmt->isBlockScope);
MOZ_ASSERT(stmt != pc->topScopeStmt);
MOZ_ASSERT(stmt->type == STMT_BLOCK ||
stmt->type == STMT_SWITCH ||
stmt->type == STMT_TRY ||
stmt->type == STMT_FINALLY);
MOZ_ASSERT(!stmt->downScope);
/* Convert the block statement into a scope statement. */
StaticBlockObject* blockObj = StaticBlockObject::create(context);
if (!blockObj)
return null();
ObjectBox* blockbox = newObjectBox(blockObj);
if (!blockbox)
return null();
/*
* Insert stmt on the pc->topScopeStmt/stmtInfo.downScope linked
* list stack, if it isn't already there. If it is there, but it
* lacks the SIF_SCOPE flag, it must be a try, catch, or finally
* block.
*/
stmt->isBlockScope = stmt->isNestedScope = true;
stmt->downScope = pc->topScopeStmt;
pc->topScopeStmt = stmt;
blockObj->initEnclosingNestedScopeFromParser(pc->staticScope);
pc->staticScope = blockObj;
stmt->staticScope = blockObj;
#ifdef DEBUG
ParseNode* tmp = pc->blockNode;
MOZ_ASSERT(!tmp || !tmp->isKind(PNK_LEXICALSCOPE));
#endif
/* Create a new lexical scope node for these statements. */
ParseNode* pn1 = handler.new_<LexicalScopeNode>(blockbox, pc->blockNode);
if (!pn1)
return null();
pc->blockNode = pn1;
}
pn = variables(isConst ? PNK_CONST : PNK_LET, nullptr,
&pc->staticScope->as<StaticBlockObject>(), HoistVars);
if (!pn)
return null();
pn->pn_xflags = PNX_POPVAR;
} while (0);
return MatchOrInsertSemicolon(tokenStream) ? pn : nullptr;
}
template <>
SyntaxParseHandler::Node
Parser<SyntaxParseHandler>::lexicalDeclaration(bool)
{
JS_ALWAYS_FALSE(abortIfSyntaxParser());
return SyntaxParseHandler::NodeFailure;
}
template <>
ParseNode*
Parser<FullParseHandler>::letDeclarationOrBlock()
{
handler.disableSyntaxParser();
/* Check for a let statement or let expression. */
TokenKind tt;
if (!tokenStream.peekToken(&tt))
return null();
if (tt == TOK_LP) {
ParseNode* node = deprecatedLetBlockOrExpression(LetStatement);
if (!node)
return nullptr;
if (node->isKind(PNK_LETBLOCK)) {
MOZ_ASSERT(node->isArity(PN_BINARY));
} else {
MOZ_ASSERT(node->isKind(PNK_SEMI));
MOZ_ASSERT(node->pn_kid->isKind(PNK_LETEXPR));
MOZ_ASSERT(node->pn_kid->isArity(PN_BINARY));
}
return node;
}
ParseNode* decl = lexicalDeclaration(/* isConst = */ false);
if (!decl)
return nullptr;
// let-declarations at global scope are currently treated as plain old var.
// See bug 589199.
MOZ_ASSERT(decl->isKind(PNK_LET) || decl->isKind(PNK_VAR));
MOZ_ASSERT(decl->isArity(PN_LIST));
return decl;
}
template <>
SyntaxParseHandler::Node
Parser<SyntaxParseHandler>::letDeclarationOrBlock()
{
JS_ALWAYS_FALSE(abortIfSyntaxParser());
return SyntaxParseHandler::NodeFailure;
}
template<typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::importDeclaration()
{
MOZ_ASSERT(tokenStream.currentToken().type == TOK_IMPORT);
if (pc->sc->isFunctionBox() || !pc->atBodyLevel()) {
report(ParseError, false, null(), JSMSG_IMPORT_DECL_AT_TOP_LEVEL);
return null();
}
uint32_t begin = pos().begin;
TokenKind tt;
if (!tokenStream.getToken(&tt))
return null();
Node importSpecSet = handler.newList(PNK_IMPORT_SPEC_LIST);
if (!importSpecSet)
return null();
if (tt == TOK_NAME || tt == TOK_LC) {
if (tt == TOK_NAME) {
// Handle the form |import a from 'b'|, by adding a single import
// specifier to the list, with 'default' as the import name and
// 'a' as the binding name. This is equivalent to
// |import { default as a } from 'b'|.
Node importName = newName(context->names().default_);
if (!importName)
return null();
Node bindingName = newName(tokenStream.currentName());
if (!bindingName)
return null();
Node importSpec = handler.newBinary(PNK_IMPORT_SPEC, importName, bindingName);
if (!importSpec)
return null();
handler.addList(importSpecSet, importSpec);
} else {
while (true) {
// Handle the forms |import {} from 'a'| and
// |import { ..., } from 'a'| (where ... is non empty), by
// escaping the loop early if the next token is }.
if (!tokenStream.peekToken(&tt, TokenStream::KeywordIsName))
return null();
if (tt == TOK_RC)
break;
// If the next token is a keyword, the previous call to
// peekToken matched it as a TOK_NAME, and put it in the
// lookahead buffer, so this call will match keywords as well.
MUST_MATCH_TOKEN(TOK_NAME, JSMSG_NO_IMPORT_NAME);
Node importName = newName(tokenStream.currentName());
if (!importName)
return null();
if (!tokenStream.getToken(&tt))
return null();
if (tt == TOK_NAME && tokenStream.currentName() == context->names().as) {
if (!tokenStream.getToken(&tt))
return null();
if (tt != TOK_NAME) {
report(ParseError, false, null(), JSMSG_NO_BINDING_NAME);
return null();
}
} else {
// Keywords cannot be bound to themselves, so an import name
// that is a keyword is a syntax error if it is not followed
// by the keyword 'as'.
if (IsKeyword(importName->name())) {
JSAutoByteString bytes;
if (!AtomToPrintableString(context, importName->name(), &bytes))
return null();
report(ParseError, false, null(), JSMSG_AS_AFTER_RESERVED_WORD, bytes.ptr());
return null();
}
tokenStream.ungetToken();
}
Node bindingName = newName(tokenStream.currentName());
if (!bindingName)
return null();
Node importSpec = handler.newBinary(PNK_IMPORT_SPEC, importName, bindingName);
if (!importSpec)
return null();
handler.addList(importSpecSet, importSpec);
bool matched;
if (!tokenStream.matchToken(&matched, TOK_COMMA))
return null();
if (!matched)
break;
}
MUST_MATCH_TOKEN(TOK_RC, JSMSG_RC_AFTER_IMPORT_SPEC_LIST);
}
if (!tokenStream.getToken(&tt))
return null();
if (tt != TOK_NAME || tokenStream.currentName() != context->names().from) {
report(ParseError, false, null(), JSMSG_FROM_AFTER_IMPORT_SPEC_SET);
return null();
}
MUST_MATCH_TOKEN(TOK_STRING, JSMSG_MODULE_SPEC_AFTER_FROM);
} else {
if (tt != TOK_STRING) {
report(ParseError, false, null(), JSMSG_DECLARATION_AFTER_IMPORT);
return null();
}
// Handle the form |import 'a'| by leaving the list empty. This is
// equivalent to |import {} from 'a'|.
importSpecSet->pn_pos.end = importSpecSet->pn_pos.begin;
}
Node moduleSpec = stringLiteral();
if (!moduleSpec)
return null();
if (!MatchOrInsertSemicolon(tokenStream))
return null();
return handler.newImportDeclaration(importSpecSet, moduleSpec,
TokenPos(begin, pos().end));
}
template<>
SyntaxParseHandler::Node
Parser<SyntaxParseHandler>::importDeclaration()
{
JS_ALWAYS_FALSE(abortIfSyntaxParser());
return SyntaxParseHandler::NodeFailure;
}
template<typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::exportDeclaration()
{
MOZ_ASSERT(tokenStream.currentToken().type == TOK_EXPORT);
if (pc->sc->isFunctionBox() || !pc->atBodyLevel()) {
report(ParseError, false, null(), JSMSG_EXPORT_DECL_AT_TOP_LEVEL);
return null();
}
uint32_t begin = pos().begin;
Node kid;
TokenKind tt;
if (!tokenStream.getToken(&tt))
return null();
switch (tt) {
case TOK_LC:
case TOK_MUL:
kid = handler.newList(PNK_EXPORT_SPEC_LIST);
if (!kid)
return null();
if (tt == TOK_LC) {
while (true) {
// Handle the forms |export {}| and |export { ..., }| (where ...
// is non empty), by escaping the loop early if the next token
// is }.
if (!tokenStream.peekToken(&tt))
return null();
if (tt == TOK_RC)
break;
MUST_MATCH_TOKEN(TOK_NAME, JSMSG_NO_BINDING_NAME);
Node bindingName = newName(tokenStream.currentName());
if (!bindingName)
return null();
if (!tokenStream.getToken(&tt))
return null();
if (tt == TOK_NAME && tokenStream.currentName() == context->names().as) {
if (!tokenStream.getToken(&tt, TokenStream::KeywordIsName))
return null();
if (tt != TOK_NAME) {
report(ParseError, false, null(), JSMSG_NO_EXPORT_NAME);
return null();
}
} else {
tokenStream.ungetToken();
}
Node exportName = newName(tokenStream.currentName());
if (!exportName)
return null();
Node exportSpec = handler.newBinary(PNK_EXPORT_SPEC, bindingName, exportName);
if (!exportSpec)
return null();
handler.addList(kid, exportSpec);
bool matched;
if (!tokenStream.matchToken(&matched, TOK_COMMA))
return null();
if (!matched)
break;
}
MUST_MATCH_TOKEN(TOK_RC, JSMSG_RC_AFTER_EXPORT_SPEC_LIST);
} else {
// Handle the form |export *| by adding a special export batch
// specifier to the list.
Node exportSpec = handler.newNullary(PNK_EXPORT_BATCH_SPEC, JSOP_NOP, pos());
if (!kid)
return null();
handler.addList(kid, exportSpec);
}
if (!tokenStream.getToken(&tt))
return null();
if (tt == TOK_NAME && tokenStream.currentName() == context->names().from) {
MUST_MATCH_TOKEN(TOK_STRING, JSMSG_MODULE_SPEC_AFTER_FROM);
Node moduleSpec = stringLiteral();
if (!moduleSpec)
return null();
if (!MatchOrInsertSemicolon(tokenStream))
return null();
return handler.newExportFromDeclaration(begin, kid, moduleSpec);
} else {
tokenStream.ungetToken();
}
kid = MatchOrInsertSemicolon(tokenStream) ? kid : nullptr;
if (!kid)
return null();
break;
case TOK_FUNCTION:
kid = functionStmt();
if (!kid)
return null();
break;
case TOK_VAR:
kid = variables(PNK_VAR);
if (!kid)
return null();
kid->pn_xflags = PNX_POPVAR;
kid = MatchOrInsertSemicolon(tokenStream) ? kid : nullptr;
if (!kid)
return null();
break;
case TOK_NAME:
// Handle the form |export a| in the same way as |export let a|, by
// acting as if we've just seen the let keyword. Simply unget the token
// and fall through.
tokenStream.ungetToken();
case TOK_LET:
case TOK_CONST:
kid = lexicalDeclaration(tt == TOK_CONST);
if (!kid)
return null();
break;
default:
report(ParseError, false, null(), JSMSG_DECLARATION_AFTER_EXPORT);
return null();
}
return handler.newExportDeclaration(kid, TokenPos(begin, pos().end));
}
template<>
SyntaxParseHandler::Node
Parser<SyntaxParseHandler>::exportDeclaration()
{
JS_ALWAYS_FALSE(abortIfSyntaxParser());
return SyntaxParseHandler::NodeFailure;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::expressionStatement(InvokedPrediction invoked)
{
tokenStream.ungetToken();
Node pnexpr = expr(invoked);
if (!pnexpr)
return null();
if (!MatchOrInsertSemicolon(tokenStream))
return null();
return handler.newExprStatement(pnexpr, pos().end);
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::ifStatement()
{
uint32_t begin = pos().begin;
/* An IF node has three kids: condition, then, and optional else. */
Node cond = condition();
if (!cond)
return null();
TokenKind tt;
if (!tokenStream.peekToken(&tt, TokenStream::Operand))
return null();
if (tt == TOK_SEMI) {
if (!report(ParseExtraWarning, false, null(), JSMSG_EMPTY_CONSEQUENT))
return null();
}
StmtInfoPC stmtInfo(context);
PushStatementPC(pc, &stmtInfo, STMT_IF);
Node thenBranch = statement();
if (!thenBranch)
return null();
Node elseBranch;
bool matched;
if (!tokenStream.matchToken(&matched, TOK_ELSE, TokenStream::Operand))
return null();
if (matched) {
stmtInfo.type = STMT_ELSE;
elseBranch = statement();
if (!elseBranch)
return null();
} else {
elseBranch = null();
}
PopStatementPC(tokenStream, pc);
return handler.newIfStatement(begin, cond, thenBranch, elseBranch);
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::doWhileStatement()
{
uint32_t begin = pos().begin;
StmtInfoPC stmtInfo(context);
PushStatementPC(pc, &stmtInfo, STMT_DO_LOOP);
Node body = statement();
if (!body)
return null();
MUST_MATCH_TOKEN(TOK_WHILE, JSMSG_WHILE_AFTER_DO);
Node cond = condition();
if (!cond)
return null();
PopStatementPC(tokenStream, pc);
// The semicolon after do-while is even more optional than most
// semicolons in JS. Web compat required this by 2004:
// path_to_url
// ES3 and ES5 disagreed, but ES6 conforms to Web reality:
// path_to_url
bool ignored;
if (!tokenStream.matchToken(&ignored, TOK_SEMI))
return null();
return handler.newDoWhileStatement(body, cond, TokenPos(begin, pos().end));
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::whileStatement()
{
uint32_t begin = pos().begin;
StmtInfoPC stmtInfo(context);
PushStatementPC(pc, &stmtInfo, STMT_WHILE_LOOP);
Node cond = condition();
if (!cond)
return null();
Node body = statement();
if (!body)
return null();
PopStatementPC(tokenStream, pc);
return handler.newWhileStatement(begin, cond, body);
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::matchInOrOf(bool* isForInp, bool* isForOfp)
{
TokenKind tt;
if (!tokenStream.getToken(&tt))
return false;
*isForInp = tt == TOK_IN;
*isForOfp = tt == TOK_NAME && tokenStream.currentToken().name() == context->names().of;
if (!*isForInp && !*isForOfp)
tokenStream.ungetToken();
return true;
}
template <>
bool
Parser<FullParseHandler>::isValidForStatementLHS(ParseNode* pn1, JSVersion version,
bool isForDecl, bool isForEach,
ParseNodeKind headKind)
{
if (isForDecl) {
if (pn1->pn_count > 1)
return false;
if (pn1->isKind(PNK_CONST))
return false;
// In JS 1.7 only, for (var [K, V] in EXPR) has a special meaning.
// Hence all other destructuring decls are banned there.
if (version == JSVERSION_1_7 && !isForEach && headKind == PNK_FORIN) {
ParseNode* lhs = pn1->pn_head;
if (lhs->isKind(PNK_ASSIGN))
lhs = lhs->pn_left;
if (lhs->isKind(PNK_OBJECT))
return false;
if (lhs->isKind(PNK_ARRAY) && lhs->pn_count != 2)
return false;
}
return true;
}
switch (pn1->getKind()) {
case PNK_NAME:
case PNK_DOT:
case PNK_CALL:
case PNK_ELEM:
return true;
case PNK_ARRAY:
case PNK_OBJECT:
// In JS 1.7 only, for ([K, V] in EXPR) has a special meaning.
// Hence all other destructuring left-hand sides are banned there.
if (version == JSVERSION_1_7 && !isForEach && headKind == PNK_FORIN)
return pn1->isKind(PNK_ARRAY) && pn1->pn_count == 2;
return true;
default:
return false;
}
}
template <>
bool
Parser<FullParseHandler>::checkForHeadConstInitializers(ParseNode* pn1)
{
if (!pn1->isKind(PNK_CONST))
return true;
for (ParseNode* assign = pn1->pn_head; assign; assign = assign->pn_next) {
MOZ_ASSERT(assign->isKind(PNK_ASSIGN) || assign->isKind(PNK_NAME));
if (assign->isKind(PNK_NAME) && !assign->isAssigned())
return false;
// PNK_ASSIGN nodes (destructuring assignment) are always assignments.
}
return true;
}
template <>
ParseNode*
Parser<FullParseHandler>::forStatement()
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR));
uint32_t begin = pos().begin;
StmtInfoPC forStmt(context);
PushStatementPC(pc, &forStmt, STMT_FOR_LOOP);
bool isForEach = false;
unsigned iflags = 0;
if (allowsForEachIn()) {
bool matched;
if (!tokenStream.matchContextualKeyword(&matched, context->names().each))
return null();
if (matched) {
iflags = JSITER_FOREACH;
isForEach = true;
addTelemetry(JSCompartment::DeprecatedForEach);
if (versionNumber() < JSVERSION_LATEST) {
if (!report(ParseWarning, pc->sc->strict, null(), JSMSG_DEPRECATED_FOR_EACH))
return null();
}
}
}
MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_AFTER_FOR);
/*
* True if we have 'for (var/let/const ...)', except in the oddball case
* where 'let' begins a let-expression in 'for (let (...) ...)'.
*/
bool isForDecl = false;
/* Non-null when isForDecl is true for a 'for (let ...)' statement. */
RootedStaticBlockObject blockObj(context);
/* Set to 'x' in 'for (x ;... ;...)' or 'for (x in ...)'. */
ParseNode* pn1;
{
TokenKind tt;
if (!tokenStream.peekToken(&tt, TokenStream::Operand))
return null();
if (tt == TOK_SEMI) {
pn1 = nullptr;
} else {
/*
* Set pn1 to a var list or an initializing expression.
*
* Set the parsingForInit flag during parsing of the first clause
* of the for statement. This flag will be used by the RelExpr
* production; if it is set, then the 'in' keyword will not be
* recognized as an operator, leaving it available to be parsed as
* part of a for/in loop.
*
* A side effect of this restriction is that (unparenthesized)
* expressions involving an 'in' operator are illegal in the init
* clause of an ordinary for loop.
*/
pc->parsingForInit = true;
if (tt == TOK_VAR) {
isForDecl = true;
tokenStream.consumeKnownToken(tt);
pn1 = variables(PNK_VAR);
} else if (tt == TOK_LET || tt == TOK_CONST) {
handler.disableSyntaxParser();
bool constDecl = tt == TOK_CONST;
tokenStream.consumeKnownToken(tt);
if (!tokenStream.peekToken(&tt))
return null();
if (tt == TOK_LP) {
pn1 = deprecatedLetBlockOrExpression(LetExpression);
} else {
isForDecl = true;
blockObj = StaticBlockObject::create(context);
if (!blockObj)
return null();
pn1 = variables(constDecl ? PNK_CONST : PNK_LET, nullptr, blockObj,
DontHoistVars);
}
} else {
pn1 = expr();
}
pc->parsingForInit = false;
if (!pn1)
return null();
}
}
MOZ_ASSERT_IF(isForDecl, pn1->isArity(PN_LIST));
MOZ_ASSERT(!!blockObj == (isForDecl && pn1->isOp(JSOP_NOP)));
// The form 'for (let <vars>; <expr2>; <expr3>) <stmt>' generates an
// implicit block even if stmt is not a BlockStatement.
// If the loop has that exact form, then:
// - forLetImpliedBlock is the node for the implicit block scope.
// - forLetDecl is the node for the decl 'let <vars>'.
// Otherwise both are null.
ParseNode* forLetImpliedBlock = nullptr;
ParseNode* forLetDecl = nullptr;
// If non-null, the node for the decl 'var v = expr1' in the weirdo form
// 'for (var v = expr1 in expr2) stmt'.
ParseNode* hoistedVar = nullptr;
/*
* We can be sure that it's a for/in loop if there's still an 'in'
* keyword here, even if JavaScript recognizes 'in' as an operator,
* as we've excluded 'in' from being parsed in RelExpr by setting
* pc->parsingForInit.
*/
StmtInfoPC letStmt(context); /* used if blockObj != nullptr. */
ParseNode* pn2, *pn3; /* forHead->pn_kid2 and pn_kid3. */
ParseNodeKind headKind = PNK_FORHEAD;
if (pn1) {
bool isForIn, isForOf;
if (!matchInOrOf(&isForIn, &isForOf))
return null();
if (isForIn)
headKind = PNK_FORIN;
else if (isForOf)
headKind = PNK_FOROF;
}
if (headKind == PNK_FOROF || headKind == PNK_FORIN) {
/*
* Parse the rest of the for/in or for/of head.
*
* Here pn1 is everything to the left of 'in' or 'of'. At the end of
* this block, pn1 is a decl or nullptr, pn2 is the assignment target
* that receives the enumeration value each iteration, and pn3 is the
* rhs of 'in'.
*/
if (headKind == PNK_FOROF) {
forStmt.type = STMT_FOR_OF_LOOP;
forStmt.type = (headKind == PNK_FOROF) ? STMT_FOR_OF_LOOP : STMT_FOR_IN_LOOP;
if (isForEach) {
report(ParseError, false, null(), JSMSG_BAD_FOR_EACH_LOOP);
return null();
}
} else {
forStmt.type = STMT_FOR_IN_LOOP;
iflags |= JSITER_ENUMERATE;
}
/* Check that the left side of the 'in' or 'of' is valid. */
if (!isValidForStatementLHS(pn1, versionNumber(), isForDecl, isForEach, headKind)) {
report(ParseError, false, pn1, JSMSG_BAD_FOR_LEFTSIDE);
return null();
}
/*
* After the following if-else, pn2 will point to the name or
* destructuring pattern on in's left. pn1 will point to the decl, if
* any, else nullptr. Note that the "declaration with initializer" case
* rewrites the loop-head, moving the decl and setting pn1 to nullptr.
*/
if (isForDecl) {
pn2 = pn1->pn_head;
if ((pn2->isKind(PNK_NAME) && pn2->maybeExpr()) || pn2->isKind(PNK_ASSIGN)) {
/*
* Declaration with initializer.
*
* Rewrite 'for (<decl> x = i in o)' where <decl> is 'var' or
* 'const' to hoist the initializer or the entire decl out of
* the loop head.
*/
if (headKind == PNK_FOROF) {
report(ParseError, false, pn2, JSMSG_INVALID_FOR_OF_INIT);
return null();
}
if (blockObj) {
report(ParseError, false, pn2, JSMSG_INVALID_FOR_IN_INIT);
return null();
}
hoistedVar = pn1;
/*
* All of 'var x = i' is hoisted above 'for (x in o)'.
*
* Request JSOP_POP here since the var is for a simple
* name (it is not a destructuring binding's left-hand
* side) and it has an initializer.
*/
pn1->pn_xflags |= PNX_POPVAR;
pn1 = nullptr;
if (pn2->isKind(PNK_ASSIGN)) {
pn2 = pn2->pn_left;
MOZ_ASSERT(pn2->isKind(PNK_ARRAY) || pn2->isKind(PNK_OBJECT) ||
pn2->isKind(PNK_NAME));
}
}
} else {
/* Not a declaration. */
MOZ_ASSERT(!blockObj);
pn2 = pn1;
pn1 = nullptr;
if (!checkAndMarkAsAssignmentLhs(pn2, PlainAssignment))
return null();
}
pn3 = (headKind == PNK_FOROF) ? assignExpr() : expr();
if (!pn3)
return null();
if (blockObj) {
/*
* Now that the pn3 has been parsed, push the let scope. To hold
* the blockObj for the emitter, wrap the PNK_LEXICALSCOPE node
* created by PushLetScope around the for's initializer. This also
* serves to indicate the let-decl to the emitter.
*/
ParseNode* block = pushLetScope(blockObj, &letStmt);
if (!block)
return null();
letStmt.isForLetBlock = true;
block->pn_expr = pn1;
block->pn_pos = pn1->pn_pos;
pn1 = block;
}
if (isForDecl) {
/*
* pn2 is part of a declaration. Make a copy that can be passed to
* EmitAssignment. Take care to do this after PushLetScope.
*/
pn2 = cloneLeftHandSide(pn2);
if (!pn2)
return null();
}
switch (pn2->getKind()) {
case PNK_NAME:
/* Beware 'for (arguments in ...)' with or without a 'var'. */
pn2->markAsAssigned();
break;
case PNK_ASSIGN:
MOZ_CRASH("forStatement TOK_ASSIGN");
case PNK_ARRAY:
case PNK_OBJECT:
if (versionNumber() == JSVERSION_1_7) {
/*
* Destructuring for-in requires [key, value] enumeration
* in JS1.7.
*/
if (!isForEach && headKind == PNK_FORIN) {
iflags |= JSITER_FOREACH | JSITER_KEYVALUE;
addTelemetry(JSCompartment::DeprecatedDestructuringForIn);
}
}
break;
default:;
}
} else {
if (isForEach) {
reportWithOffset(ParseError, false, begin, JSMSG_BAD_FOR_EACH_LOOP);
return null();
}
headKind = PNK_FORHEAD;
if (blockObj) {
/*
* Desugar 'for (let A; B; C) D' into 'let (A) { for (; B; C) D }'
* to induce the correct scoping for A. Ensure here that the previously
* unchecked assignment mandate for const declarations holds.
*/
if (!checkForHeadConstInitializers(pn1)) {
report(ParseError, false, nullptr, JSMSG_BAD_CONST_DECL);
return null();
}
forLetImpliedBlock = pushLetScope(blockObj, &letStmt);
if (!forLetImpliedBlock)
return null();
letStmt.isForLetBlock = true;
forLetDecl = pn1;
pn1 = nullptr;
}
/* Parse the loop condition or null into pn2. */
MUST_MATCH_TOKEN(TOK_SEMI, JSMSG_SEMI_AFTER_FOR_INIT);
TokenKind tt;
if (!tokenStream.peekToken(&tt, TokenStream::Operand))
return null();
if (tt == TOK_SEMI) {
pn2 = nullptr;
} else {
pn2 = expr();
if (!pn2)
return null();
}
/* Parse the update expression or null into pn3. */
MUST_MATCH_TOKEN(TOK_SEMI, JSMSG_SEMI_AFTER_FOR_COND);
if (!tokenStream.peekToken(&tt, TokenStream::Operand))
return null();
if (tt == TOK_RP) {
pn3 = nullptr;
} else {
pn3 = expr();
if (!pn3)
return null();
}
}
MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_FOR_CTRL);
TokenPos headPos(begin, pos().end);
ParseNode* forHead = handler.newForHead(headKind, pn1, pn2, pn3, headPos);
if (!forHead)
return null();
/* Parse the loop body. */
ParseNode* body = statement();
if (!body)
return null();
if (blockObj)
PopStatementPC(tokenStream, pc);
PopStatementPC(tokenStream, pc);
ParseNode* forLoop = handler.newForStatement(begin, forHead, body, iflags);
if (!forLoop)
return null();
if (hoistedVar) {
ParseNode* pnseq = handler.newList(PNK_SEQ, hoistedVar);
if (!pnseq)
return null();
pnseq->pn_pos = forLoop->pn_pos;
pnseq->append(forLoop);
return pnseq;
}
if (forLetImpliedBlock) {
forLetImpliedBlock->pn_expr = forLoop;
forLetImpliedBlock->pn_pos = forLoop->pn_pos;
return handler.newLetBlock(forLetDecl, forLetImpliedBlock, forLoop->pn_pos);
}
return forLoop;
}
template <>
SyntaxParseHandler::Node
Parser<SyntaxParseHandler>::forStatement()
{
/*
* 'for' statement parsing is fantastically complicated and requires being
* able to inspect the parse tree for previous parts of the 'for'. Syntax
* parsing of 'for' statements is thus done separately, and only handles
* the types of 'for' statements likely to be seen in web content.
*/
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR));
StmtInfoPC forStmt(context);
PushStatementPC(pc, &forStmt, STMT_FOR_LOOP);
/* Don't parse 'for each' loops. */
if (allowsForEachIn()) {
TokenKind tt;
if (!tokenStream.peekToken(&tt))
return null();
// Not all "yield" tokens are names, but the ones that aren't names are
// invalid in this context anyway.
if (tt == TOK_NAME || tt == TOK_YIELD) {
JS_ALWAYS_FALSE(abortIfSyntaxParser());
return null();
}
}
MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_AFTER_FOR);
/* True if we have 'for (var ...)'. */
bool isForDecl = false;
bool simpleForDecl = true;
/* Set to 'x' in 'for (x ;... ;...)' or 'for (x in ...)'. */
Node lhsNode;
{
TokenKind tt;
if (!tokenStream.peekToken(&tt, TokenStream::Operand))
return null();
if (tt == TOK_SEMI) {
lhsNode = null();
} else {
/* Set lhsNode to a var list or an initializing expression. */
pc->parsingForInit = true;
if (tt == TOK_VAR) {
isForDecl = true;
tokenStream.consumeKnownToken(tt);
lhsNode = variables(PNK_VAR, &simpleForDecl);
}
else if (tt == TOK_CONST || tt == TOK_LET) {
JS_ALWAYS_FALSE(abortIfSyntaxParser());
return null();
}
else {
lhsNode = expr();
}
if (!lhsNode)
return null();
pc->parsingForInit = false;
}
}
/*
* We can be sure that it's a for/in loop if there's still an 'in'
* keyword here, even if JavaScript recognizes 'in' as an operator,
* as we've excluded 'in' from being parsed in RelExpr by setting
* pc->parsingForInit.
*/
bool isForIn = false, isForOf = false;
if (lhsNode) {
if (!matchInOrOf(&isForIn, &isForOf))
return null();
}
if (isForIn || isForOf) {
/* Parse the rest of the for/in or for/of head. */
forStmt.type = isForOf ? STMT_FOR_OF_LOOP : STMT_FOR_IN_LOOP;
/* Check that the left side of the 'in' or 'of' is valid. */
if (!isForDecl &&
lhsNode != SyntaxParseHandler::NodeName &&
lhsNode != SyntaxParseHandler::NodeGetProp &&
lhsNode != SyntaxParseHandler::NodeLValue)
{
JS_ALWAYS_FALSE(abortIfSyntaxParser());
return null();
}
if (!simpleForDecl) {
JS_ALWAYS_FALSE(abortIfSyntaxParser());
return null();
}
if (!isForDecl && !checkAndMarkAsAssignmentLhs(lhsNode, PlainAssignment))
return null();
if (!expr())
return null();
} else {
/* Parse the loop condition or null. */
MUST_MATCH_TOKEN(TOK_SEMI, JSMSG_SEMI_AFTER_FOR_INIT);
TokenKind tt;
if (!tokenStream.peekToken(&tt, TokenStream::Operand))
return null();
if (tt != TOK_SEMI) {
if (!expr())
return null();
}
/* Parse the update expression or null. */
MUST_MATCH_TOKEN(TOK_SEMI, JSMSG_SEMI_AFTER_FOR_COND);
if (!tokenStream.peekToken(&tt, TokenStream::Operand))
return null();
if (tt != TOK_RP) {
if (!expr())
return null();
}
}
MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_FOR_CTRL);
/* Parse the loop body. */
if (!statement())
return null();
PopStatementPC(tokenStream, pc);
return SyntaxParseHandler::NodeGeneric;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::switchStatement()
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_SWITCH));
uint32_t begin = pos().begin;
MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_BEFORE_SWITCH);
Node discriminant = exprInParens();
if (!discriminant)
return null();
MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_SWITCH);
MUST_MATCH_TOKEN(TOK_LC, JSMSG_CURLY_BEFORE_SWITCH);
StmtInfoPC stmtInfo(context);
PushStatementPC(pc, &stmtInfo, STMT_SWITCH);
if (!GenerateBlockId(tokenStream, pc, pc->topStmt->blockid))
return null();
Node caseList = handler.newStatementList(pc->blockid(), pos());
if (!caseList)
return null();
Node saveBlock = pc->blockNode;
pc->blockNode = caseList;
bool seenDefault = false;
TokenKind tt;
while (true) {
if (!tokenStream.getToken(&tt))
return null();
if (tt == TOK_RC)
break;
uint32_t caseBegin = pos().begin;
Node caseExpr;
switch (tt) {
case TOK_DEFAULT:
if (seenDefault) {
report(ParseError, false, null(), JSMSG_TOO_MANY_DEFAULTS);
return null();
}
seenDefault = true;
caseExpr = null(); // The default case has pn_left == nullptr.
break;
case TOK_CASE:
caseExpr = expr();
if (!caseExpr)
return null();
break;
default:
report(ParseError, false, null(), JSMSG_BAD_SWITCH);
return null();
}
MUST_MATCH_TOKEN(TOK_COLON, JSMSG_COLON_AFTER_CASE);
Node body = handler.newStatementList(pc->blockid(), pos());
if (!body)
return null();
while (true) {
if (!tokenStream.peekToken(&tt, TokenStream::Operand))
return null();
if (tt == TOK_RC || tt == TOK_CASE || tt == TOK_DEFAULT)
break;
Node stmt = statement();
if (!stmt)
return null();
handler.addList(body, stmt);
}
// In ES6, lexical bindings canot be accessed until initialized. If
// there was a 'let' declaration in the case we just parsed, remember
// the slot starting at which new lexical bindings will be
// assigned. Since lexical bindings from previous cases will not
// dominate uses in the current case, any such uses will require a
// dead zone check.
//
// Currently this is overly conservative; we could do better, but
// declaring lexical bindings within switch cases without introducing
// a new block is poor form and should be avoided.
if (stmtInfo.isBlockScope)
stmtInfo.firstDominatingLexicalInCase = stmtInfo.staticBlock().numVariables();
Node casepn = handler.newCaseOrDefault(caseBegin, caseExpr, body);
if (!casepn)
return null();
handler.addList(caseList, casepn);
}
/*
* Handle the case where there was a let declaration in any case in
* the switch body, but not within an inner block. If it replaced
* pc->blockNode with a new block node then we must refresh caseList and
* then restore pc->blockNode.
*/
if (pc->blockNode != caseList)
caseList = pc->blockNode;
pc->blockNode = saveBlock;
PopStatementPC(tokenStream, pc);
handler.setEndPosition(caseList, pos().end);
return handler.newSwitchStatement(begin, discriminant, caseList);
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::continueStatement()
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_CONTINUE));
uint32_t begin = pos().begin;
RootedPropertyName label(context);
if (!matchLabel(&label))
return null();
StmtInfoPC* stmt = pc->topStmt;
if (label) {
for (StmtInfoPC* stmt2 = nullptr; ; stmt = stmt->down) {
if (!stmt) {
report(ParseError, false, null(), JSMSG_LABEL_NOT_FOUND);
return null();
}
if (stmt->type == STMT_LABEL) {
if (stmt->label == label) {
if (!stmt2 || !stmt2->isLoop()) {
report(ParseError, false, null(), JSMSG_BAD_CONTINUE);
return null();
}
break;
}
} else {
stmt2 = stmt;
}
}
} else {
for (; ; stmt = stmt->down) {
if (!stmt) {
report(ParseError, false, null(), JSMSG_BAD_CONTINUE);
return null();
}
if (stmt->isLoop())
break;
}
}
if (!MatchOrInsertSemicolon(tokenStream))
return null();
return handler.newContinueStatement(label, TokenPos(begin, pos().end));
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::breakStatement()
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_BREAK));
uint32_t begin = pos().begin;
RootedPropertyName label(context);
if (!matchLabel(&label))
return null();
StmtInfoPC* stmt = pc->topStmt;
if (label) {
for (; ; stmt = stmt->down) {
if (!stmt) {
report(ParseError, false, null(), JSMSG_LABEL_NOT_FOUND);
return null();
}
if (stmt->type == STMT_LABEL && stmt->label == label)
break;
}
} else {
for (; ; stmt = stmt->down) {
if (!stmt) {
report(ParseError, false, null(), JSMSG_TOUGH_BREAK);
return null();
}
if (stmt->isLoop() || stmt->type == STMT_SWITCH)
break;
}
}
if (!MatchOrInsertSemicolon(tokenStream))
return null();
return handler.newBreakStatement(label, TokenPos(begin, pos().end));
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::returnStatement()
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_RETURN));
uint32_t begin = pos().begin;
if (!pc->sc->isFunctionBox()) {
report(ParseError, false, null(), JSMSG_BAD_RETURN_OR_YIELD, js_return_str);
return null();
}
// Parse an optional operand.
//
// This is ugly, but we don't want to require a semicolon.
Node exprNode;
TokenKind tt;
if (!tokenStream.peekTokenSameLine(&tt, TokenStream::Operand))
return null();
switch (tt) {
case TOK_EOF:
case TOK_EOL:
case TOK_SEMI:
case TOK_RC:
exprNode = null();
pc->funHasReturnVoid = true;
break;
default: {
exprNode = expr();
if (!exprNode)
return null();
pc->funHasReturnExpr = true;
}
}
if (!MatchOrInsertSemicolon(tokenStream))
return null();
Node genrval = null();
if (pc->isStarGenerator()) {
genrval = newName(context->names().dotGenRVal);
if (!genrval)
return null();
if (!noteNameUse(context->names().dotGenRVal, genrval))
return null();
if (!checkAndMarkAsAssignmentLhs(genrval, PlainAssignment))
return null();
}
Node pn = handler.newReturnStatement(exprNode, genrval, TokenPos(begin, pos().end));
if (!pn)
return null();
if (pc->isLegacyGenerator() && exprNode) {
/* Disallow "return v;" in legacy generators. */
reportBadReturn(pn, ParseError, JSMSG_BAD_GENERATOR_RETURN,
JSMSG_BAD_ANON_GENERATOR_RETURN);
return null();
}
return pn;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::newYieldExpression(uint32_t begin, typename ParseHandler::Node expr,
bool isYieldStar)
{
Node generator = newName(context->names().dotGenerator);
if (!generator)
return null();
if (!noteNameUse(context->names().dotGenerator, generator))
return null();
if (isYieldStar)
return handler.newYieldStarExpression(begin, expr, generator);
return handler.newYieldExpression(begin, expr, generator);
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::yieldExpression()
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_YIELD));
uint32_t begin = pos().begin;
switch (pc->generatorKind()) {
case StarGenerator:
{
MOZ_ASSERT(pc->sc->isFunctionBox());
pc->lastYieldOffset = begin;
Node exprNode;
ParseNodeKind kind = PNK_YIELD;
TokenKind tt;
if (!tokenStream.peekTokenSameLine(&tt, TokenStream::Operand))
return null();
switch (tt) {
// TOK_EOL is special; it implements the [no LineTerminator here]
// quirk in the grammar.
case TOK_EOL:
// The rest of these make up the complete set of tokens that can
// appear after any of the places where AssignmentExpression is used
// throughout the grammar. Conveniently, none of them can also be the
// start an expression.
case TOK_EOF:
case TOK_SEMI:
case TOK_RC:
case TOK_RB:
case TOK_RP:
case TOK_COLON:
case TOK_COMMA:
// No value.
exprNode = null();
break;
case TOK_MUL:
kind = PNK_YIELD_STAR;
tokenStream.consumeKnownToken(TOK_MUL);
// Fall through.
default:
exprNode = assignExpr();
if (!exprNode)
return null();
}
return newYieldExpression(begin, exprNode, kind == PNK_YIELD_STAR);
}
case NotGenerator:
// We are in code that has not seen a yield, but we are in JS 1.7 or
// later. Try to transition to being a legacy generator.
MOZ_ASSERT(tokenStream.versionNumber() >= JSVERSION_1_7);
MOZ_ASSERT(pc->lastYieldOffset == ParseContext<ParseHandler>::NoYieldOffset);
if (!abortIfSyntaxParser())
return null();
if (!pc->sc->isFunctionBox()) {
report(ParseError, false, null(), JSMSG_BAD_RETURN_OR_YIELD, js_yield_str);
return null();
}
pc->sc->asFunctionBox()->setGeneratorKind(LegacyGenerator);
addTelemetry(JSCompartment::DeprecatedLegacyGenerator);
if (pc->funHasReturnExpr) {
/* As in Python (see PEP-255), disallow return v; in generators. */
reportBadReturn(null(), ParseError, JSMSG_BAD_GENERATOR_RETURN,
JSMSG_BAD_ANON_GENERATOR_RETURN);
return null();
}
// Fall through.
case LegacyGenerator:
{
// We are in a legacy generator: a function that has already seen a
// yield, or in a legacy generator comprehension.
MOZ_ASSERT(pc->sc->isFunctionBox());
pc->lastYieldOffset = begin;
// Legacy generators do not require a value.
Node exprNode;
TokenKind tt;
if (!tokenStream.peekTokenSameLine(&tt, TokenStream::Operand))
return null();
switch (tt) {
case TOK_EOF:
case TOK_EOL:
case TOK_SEMI:
case TOK_RC:
case TOK_RB:
case TOK_RP:
case TOK_COLON:
case TOK_COMMA:
// No value.
exprNode = null();
break;
default:
exprNode = assignExpr();
if (!exprNode)
return null();
}
return newYieldExpression(begin, exprNode);
}
}
MOZ_CRASH("yieldExpr");
}
template <>
ParseNode*
Parser<FullParseHandler>::withStatement()
{
// test262/ch12/12.10/12.10-0-1.js fails if we try to parse with-statements
// in syntax-parse mode. See bug 892583.
if (handler.syntaxParser) {
handler.disableSyntaxParser();
abortedSyntaxParse = true;
return null();
}
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_WITH));
uint32_t begin = pos().begin;
// In most cases, we want the constructs forbidden in strict mode code to be
// a subset of those that JSOPTION_EXTRA_WARNINGS warns about, and we should
// use reportStrictModeError. However, 'with' is the sole instance of a
// construct that is forbidden in strict mode code, but doesn't even merit a
// warning under JSOPTION_EXTRA_WARNINGS. See
// path_to_url#c1.
if (pc->sc->strict && !report(ParseStrictError, true, null(), JSMSG_STRICT_CODE_WITH))
return null();
MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_BEFORE_WITH);
Node objectExpr = exprInParens();
if (!objectExpr)
return null();
MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_WITH);
bool oldParsingWith = pc->parsingWith;
pc->parsingWith = true;
StmtInfoPC stmtInfo(context);
PushStatementPC(pc, &stmtInfo, STMT_WITH);
Rooted<StaticWithObject*> staticWith(context, StaticWithObject::create(context));
if (!staticWith)
return null();
staticWith->initEnclosingNestedScopeFromParser(pc->staticScope);
FinishPushNestedScope(pc, &stmtInfo, *staticWith);
Node innerBlock = statement();
if (!innerBlock)
return null();
PopStatementPC(tokenStream, pc);
pc->sc->setBindingsAccessedDynamically();
pc->parsingWith = oldParsingWith;
/*
* Make sure to deoptimize lexical dependencies inside the |with|
* to safely optimize binding globals (see bug 561923).
*/
for (AtomDefnRange r = pc->lexdeps->all(); !r.empty(); r.popFront()) {
DefinitionNode defn = r.front().value().get<FullParseHandler>();
DefinitionNode lexdep = handler.resolve(defn);
if (!pc->sc->isDotVariable(lexdep->name()))
handler.deoptimizeUsesWithin(lexdep, TokenPos(begin, pos().begin));
}
ObjectBox* staticWithBox = newObjectBox(staticWith);
if (!staticWithBox)
return null();
return handler.newWithStatement(begin, objectExpr, innerBlock, staticWithBox);
}
template <>
SyntaxParseHandler::Node
Parser<SyntaxParseHandler>::withStatement()
{
JS_ALWAYS_FALSE(abortIfSyntaxParser());
return null();
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::labeledStatement()
{
uint32_t begin = pos().begin;
RootedPropertyName label(context, tokenStream.currentName());
for (StmtInfoPC* stmt = pc->topStmt; stmt; stmt = stmt->down) {
if (stmt->type == STMT_LABEL && stmt->label == label) {
report(ParseError, false, null(), JSMSG_DUPLICATE_LABEL);
return null();
}
}
tokenStream.consumeKnownToken(TOK_COLON);
/* Push a label struct and parse the statement. */
StmtInfoPC stmtInfo(context);
PushStatementPC(pc, &stmtInfo, STMT_LABEL);
stmtInfo.label = label;
Node pn = statement();
if (!pn)
return null();
/* Pop the label, set pn_expr, and return early. */
PopStatementPC(tokenStream, pc);
return handler.newLabeledStatement(label, pn, begin);
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::throwStatement()
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_THROW));
uint32_t begin = pos().begin;
/* ECMA-262 Edition 3 says 'throw [no LineTerminator here] Expr'. */
TokenKind tt;
if (!tokenStream.peekTokenSameLine(&tt, TokenStream::Operand))
return null();
if (tt == TOK_EOF || tt == TOK_SEMI || tt == TOK_RC) {
report(ParseError, false, null(), JSMSG_MISSING_EXPR_AFTER_THROW);
return null();
}
if (tt == TOK_EOL) {
report(ParseError, false, null(), JSMSG_LINE_BREAK_AFTER_THROW);
return null();
}
Node throwExpr = expr();
if (!throwExpr)
return null();
if (!MatchOrInsertSemicolon(tokenStream))
return null();
return handler.newThrowStatement(throwExpr, TokenPos(begin, pos().end));
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::tryStatement()
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_TRY));
uint32_t begin = pos().begin;
/*
* try nodes are ternary.
* kid1 is the try statement
* kid2 is the catch node list or null
* kid3 is the finally statement
*
* catch nodes are ternary.
* kid1 is the lvalue (TOK_NAME, TOK_LB, or TOK_LC)
* kid2 is the catch guard or null if no guard
* kid3 is the catch block
*
* catch lvalue nodes are either:
* TOK_NAME for a single identifier
* TOK_RB or TOK_RC for a destructuring left-hand side
*
* finally nodes are TOK_LC statement lists.
*/
MUST_MATCH_TOKEN(TOK_LC, JSMSG_CURLY_BEFORE_TRY);
StmtInfoPC stmtInfo(context);
if (!PushBlocklikeStatement(tokenStream, &stmtInfo, STMT_TRY, pc))
return null();
Node innerBlock = statements();
if (!innerBlock)
return null();
MUST_MATCH_TOKEN(TOK_RC, JSMSG_CURLY_AFTER_TRY);
PopStatementPC(tokenStream, pc);
bool hasUnconditionalCatch = false;
Node catchList = null();
TokenKind tt;
if (!tokenStream.getToken(&tt))
return null();
if (tt == TOK_CATCH) {
catchList = handler.newCatchList();
if (!catchList)
return null();
do {
Node pnblock;
BindData<ParseHandler> data(context);
/* Check for another catch after unconditional catch. */
if (hasUnconditionalCatch) {
report(ParseError, false, null(), JSMSG_CATCH_AFTER_GENERAL);
return null();
}
/*
* Create a lexical scope node around the whole catch clause,
* including the head.
*/
pnblock = pushLexicalScope(&stmtInfo);
if (!pnblock)
return null();
stmtInfo.type = STMT_CATCH;
/*
* Legal catch forms are:
* catch (lhs)
* catch (lhs if <boolean_expression>)
* where lhs is a name or a destructuring left-hand side.
* (the latter is legal only #ifdef JS_HAS_CATCH_GUARD)
*/
MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_BEFORE_CATCH);
/*
* Contrary to ECMA Ed. 3, the catch variable is lexically
* scoped, not a property of a new Object instance. This is
* an intentional change that anticipates ECMA Ed. 4.
*/
data.initLexical(HoistVars, &pc->staticScope->template as<StaticBlockObject>(),
JSMSG_TOO_MANY_CATCH_VARS);
MOZ_ASSERT(data.let.blockObj);
if (!tokenStream.getToken(&tt))
return null();
Node catchName;
switch (tt) {
case TOK_LB:
case TOK_LC:
catchName = destructuringExpr(&data, tt);
if (!catchName)
return null();
break;
case TOK_YIELD:
if (!checkYieldNameValidity())
return null();
// Fall through.
case TOK_NAME:
{
RootedPropertyName label(context, tokenStream.currentName());
catchName = newBindingNode(label, false);
if (!catchName)
return null();
data.pn = catchName;
if (!data.binder(&data, label, this))
return null();
break;
}
default:
report(ParseError, false, null(), JSMSG_CATCH_IDENTIFIER);
return null();
}
Node catchGuard = null();
#if JS_HAS_CATCH_GUARD
/*
* We use 'catch (x if x === 5)' (not 'catch (x : x === 5)')
* to avoid conflicting with the JS2/ECMAv4 type annotation
* catchguard syntax.
*/
bool matched;
if (!tokenStream.matchToken(&matched, TOK_IF))
return null();
if (matched) {
catchGuard = expr();
if (!catchGuard)
return null();
}
#endif
MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_CATCH);
MUST_MATCH_TOKEN(TOK_LC, JSMSG_CURLY_BEFORE_CATCH);
Node catchBody = statements();
if (!catchBody)
return null();
MUST_MATCH_TOKEN(TOK_RC, JSMSG_CURLY_AFTER_CATCH);
PopStatementPC(tokenStream, pc);
if (!catchGuard)
hasUnconditionalCatch = true;
if (!handler.addCatchBlock(catchList, pnblock, catchName, catchGuard, catchBody))
return null();
handler.setEndPosition(catchList, pos().end);
handler.setEndPosition(pnblock, pos().end);
if (!tokenStream.getToken(&tt, TokenStream::Operand))
return null();
} while (tt == TOK_CATCH);
}
Node finallyBlock = null();
if (tt == TOK_FINALLY) {
MUST_MATCH_TOKEN(TOK_LC, JSMSG_CURLY_BEFORE_FINALLY);
if (!PushBlocklikeStatement(tokenStream, &stmtInfo, STMT_FINALLY, pc))
return null();
finallyBlock = statements();
if (!finallyBlock)
return null();
MUST_MATCH_TOKEN(TOK_RC, JSMSG_CURLY_AFTER_FINALLY);
PopStatementPC(tokenStream, pc);
} else {
tokenStream.ungetToken();
}
if (!catchList && !finallyBlock) {
report(ParseError, false, null(), JSMSG_CATCH_OR_FINALLY);
return null();
}
return handler.newTryStatement(begin, innerBlock, catchList, finallyBlock);
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::debuggerStatement()
{
TokenPos p;
p.begin = pos().begin;
if (!MatchOrInsertSemicolon(tokenStream))
return null();
p.end = pos().end;
pc->sc->setBindingsAccessedDynamically();
pc->sc->setHasDebuggerStatement();
return handler.newDebuggerStatement(p);
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::statement(bool canHaveDirectives)
{
MOZ_ASSERT(checkOptionsCalled);
JS_CHECK_RECURSION(context, return null());
TokenKind tt;
if (!tokenStream.getToken(&tt, TokenStream::Operand))
return null();
switch (tt) {
case TOK_LC:
return blockStatement();
case TOK_CONST:
if (!abortIfSyntaxParser())
return null();
return lexicalDeclaration(/* isConst = */ true);
case TOK_VAR: {
Node pn = variables(PNK_VAR);
if (!pn)
return null();
// Tell js_EmitTree to generate a final POP.
handler.setListFlag(pn, PNX_POPVAR);
if (!MatchOrInsertSemicolon(tokenStream))
return null();
return pn;
}
case TOK_LET:
return letDeclarationOrBlock();
case TOK_IMPORT:
return importDeclaration();
case TOK_EXPORT:
return exportDeclaration();
case TOK_SEMI:
return handler.newEmptyStatement(pos());
case TOK_IF:
return ifStatement();
case TOK_DO:
return doWhileStatement();
case TOK_WHILE:
return whileStatement();
case TOK_FOR:
return forStatement();
case TOK_SWITCH:
return switchStatement();
case TOK_CONTINUE:
return continueStatement();
case TOK_BREAK:
return breakStatement();
case TOK_RETURN:
return returnStatement();
case TOK_WITH:
return withStatement();
case TOK_THROW:
return throwStatement();
case TOK_TRY:
return tryStatement();
case TOK_FUNCTION:
return functionStmt();
case TOK_DEBUGGER:
return debuggerStatement();
/* TOK_CATCH and TOK_FINALLY are both handled in the TOK_TRY case */
case TOK_CATCH:
report(ParseError, false, null(), JSMSG_CATCH_WITHOUT_TRY);
return null();
case TOK_FINALLY:
report(ParseError, false, null(), JSMSG_FINALLY_WITHOUT_TRY);
return null();
case TOK_STRING:
if (!canHaveDirectives && tokenStream.currentToken().atom() == context->names().useAsm) {
if (!abortIfSyntaxParser())
return null();
if (!report(ParseWarning, false, null(), JSMSG_USE_ASM_DIRECTIVE_FAIL))
return null();
}
return expressionStatement();
case TOK_YIELD: {
TokenKind next;
TokenStream::Modifier modifier = yieldExpressionsSupported()
? TokenStream::Operand
: TokenStream::None;
if (!tokenStream.peekToken(&next, modifier))
return null();
if (next == TOK_COLON) {
if (!checkYieldNameValidity())
return null();
return labeledStatement();
}
return expressionStatement();
}
case TOK_NAME: {
TokenKind next;
if (!tokenStream.peekToken(&next))
return null();
if (next == TOK_COLON)
return labeledStatement();
return expressionStatement();
}
case TOK_NEW:
return expressionStatement(PredictInvoked);
default:
return expressionStatement();
}
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::expr(InvokedPrediction invoked)
{
Node pn = assignExpr(invoked);
if (!pn)
return null();
bool matched;
if (!tokenStream.matchToken(&matched, TOK_COMMA))
return null();
if (matched) {
Node seq = handler.newCommaExpressionList(pn);
if (!seq)
return null();
while (true) {
if (handler.isUnparenthesizedYieldExpression(pn)) {
report(ParseError, false, pn, JSMSG_BAD_GENERATOR_SYNTAX, js_yield_str);
return null();
}
pn = assignExpr();
if (!pn)
return null();
handler.addList(seq, pn);
if (!tokenStream.matchToken(&matched, TOK_COMMA))
return null();
if (!matched)
break;
}
return seq;
}
return pn;
}
static const JSOp ParseNodeKindToJSOp[] = {
JSOP_OR,
JSOP_AND,
JSOP_BITOR,
JSOP_BITXOR,
JSOP_BITAND,
JSOP_STRICTEQ,
JSOP_EQ,
JSOP_STRICTNE,
JSOP_NE,
JSOP_LT,
JSOP_LE,
JSOP_GT,
JSOP_GE,
JSOP_INSTANCEOF,
JSOP_IN,
JSOP_LSH,
JSOP_RSH,
JSOP_URSH,
JSOP_ADD,
JSOP_SUB,
JSOP_MUL,
JSOP_DIV,
JSOP_MOD
};
static inline JSOp
BinaryOpParseNodeKindToJSOp(ParseNodeKind pnk)
{
MOZ_ASSERT(pnk >= PNK_BINOP_FIRST);
MOZ_ASSERT(pnk <= PNK_BINOP_LAST);
return ParseNodeKindToJSOp[pnk - PNK_BINOP_FIRST];
}
static bool
IsBinaryOpToken(TokenKind tok, bool parsingForInit)
{
return tok == TOK_IN ? !parsingForInit : TokenKindIsBinaryOp(tok);
}
static ParseNodeKind
BinaryOpTokenKindToParseNodeKind(TokenKind tok)
{
MOZ_ASSERT(TokenKindIsBinaryOp(tok));
return ParseNodeKind(PNK_BINOP_FIRST + (tok - TOK_BINOP_FIRST));
}
static const int PrecedenceTable[] = {
1, /* PNK_OR */
2, /* PNK_AND */
3, /* PNK_BITOR */
4, /* PNK_BITXOR */
5, /* PNK_BITAND */
6, /* PNK_STRICTEQ */
6, /* PNK_EQ */
6, /* PNK_STRICTNE */
6, /* PNK_NE */
7, /* PNK_LT */
7, /* PNK_LE */
7, /* PNK_GT */
7, /* PNK_GE */
7, /* PNK_INSTANCEOF */
7, /* PNK_IN */
8, /* PNK_LSH */
8, /* PNK_RSH */
8, /* PNK_URSH */
9, /* PNK_ADD */
9, /* PNK_SUB */
10, /* PNK_STAR */
10, /* PNK_DIV */
10 /* PNK_MOD */
};
static const int PRECEDENCE_CLASSES = 10;
static int
Precedence(ParseNodeKind pnk) {
// Everything binds tighter than PNK_LIMIT, because we want to reduce all
// nodes to a single node when we reach a token that is not another binary
// operator.
if (pnk == PNK_LIMIT)
return 0;
MOZ_ASSERT(pnk >= PNK_BINOP_FIRST);
MOZ_ASSERT(pnk <= PNK_BINOP_LAST);
return PrecedenceTable[pnk - PNK_BINOP_FIRST];
}
template <typename ParseHandler>
MOZ_ALWAYS_INLINE typename ParseHandler::Node
Parser<ParseHandler>::orExpr1(InvokedPrediction invoked)
{
// Shift-reduce parser for the left-associative binary operator part of
// the JS syntax.
// Conceptually there's just one stack, a stack of pairs (lhs, op).
// It's implemented using two separate arrays, though.
Node nodeStack[PRECEDENCE_CLASSES];
ParseNodeKind kindStack[PRECEDENCE_CLASSES];
int depth = 0;
bool oldParsingForInit = pc->parsingForInit;
pc->parsingForInit = false;
Node pn;
for (;;) {
pn = unaryExpr(invoked);
if (!pn)
return pn;
// If a binary operator follows, consume it and compute the
// corresponding operator.
TokenKind tok;
if (!tokenStream.getToken(&tok))
return null();
ParseNodeKind pnk;
if (IsBinaryOpToken(tok, oldParsingForInit)) {
pnk = BinaryOpTokenKindToParseNodeKind(tok);
} else {
tok = TOK_EOF;
pnk = PNK_LIMIT;
}
// If pnk has precedence less than or equal to another operator on the
// stack, reduce. This combines nodes on the stack until we form the
// actual lhs of pnk.
//
// The >= in this condition works because all the operators in question
// are left-associative; if any were not, the case where two operators
// have equal precedence would need to be handled specially, and the
// stack would need to be a Vector.
while (depth > 0 && Precedence(kindStack[depth - 1]) >= Precedence(pnk)) {
depth--;
ParseNodeKind combiningPnk = kindStack[depth];
JSOp combiningOp = BinaryOpParseNodeKindToJSOp(combiningPnk);
pn = handler.appendOrCreateList(combiningPnk, nodeStack[depth], pn, pc, combiningOp);
if (!pn)
return pn;
}
if (pnk == PNK_LIMIT)
break;
nodeStack[depth] = pn;
kindStack[depth] = pnk;
depth++;
MOZ_ASSERT(depth <= PRECEDENCE_CLASSES);
}
MOZ_ASSERT(depth == 0);
pc->parsingForInit = oldParsingForInit;
return pn;
}
template <typename ParseHandler>
MOZ_ALWAYS_INLINE typename ParseHandler::Node
Parser<ParseHandler>::condExpr1(InvokedPrediction invoked)
{
Node condition = orExpr1(invoked);
if (!condition || !tokenStream.isCurrentTokenType(TOK_HOOK))
return condition;
/*
* Always accept the 'in' operator in the middle clause of a ternary,
* where it's unambiguous, even if we might be parsing the init of a
* for statement.
*/
bool oldParsingForInit = pc->parsingForInit;
pc->parsingForInit = false;
Node thenExpr = assignExpr();
pc->parsingForInit = oldParsingForInit;
if (!thenExpr)
return null();
MUST_MATCH_TOKEN(TOK_COLON, JSMSG_COLON_IN_COND);
Node elseExpr = assignExpr();
if (!elseExpr)
return null();
// Advance to the next token; the caller is responsible for interpreting it.
TokenKind ignored;
if (!tokenStream.getToken(&ignored))
return null();
return handler.newConditional(condition, thenExpr, elseExpr);
}
template <>
bool
Parser<FullParseHandler>::checkAndMarkAsAssignmentLhs(ParseNode* pn, AssignmentFlavor flavor)
{
switch (pn->getKind()) {
case PNK_NAME:
if (!checkStrictAssignment(pn))
return false;
if (flavor == KeyedDestructuringAssignment) {
/*
* We may be called on a name node that has already been
* specialized, in the very weird "for (var [x] = i in o) ..."
* case. See bug 558633.
*/
if (!(js_CodeSpec[pn->getOp()].format & JOF_SET))
pn->setOp(JSOP_SETNAME);
} else {
pn->setOp(pn->isOp(JSOP_GETLOCAL) ? JSOP_SETLOCAL : JSOP_SETNAME);
}
pn->markAsAssigned();
break;
case PNK_DOT:
case PNK_ELEM:
break;
case PNK_ARRAY:
case PNK_OBJECT:
if (flavor == CompoundAssignment) {
report(ParseError, false, null(), JSMSG_BAD_DESTRUCT_ASS);
return false;
}
if (!checkDestructuring(nullptr, pn))
return false;
break;
case PNK_CALL:
if (flavor == KeyedDestructuringAssignment) {
report(ParseError, false, pn, JSMSG_BAD_DESTRUCT_TARGET);
return false;
}
if (!makeSetCall(pn, JSMSG_BAD_LEFTSIDE_OF_ASS))
return false;
break;
default:
unsigned errnum = (flavor == KeyedDestructuringAssignment) ? JSMSG_BAD_DESTRUCT_TARGET :
JSMSG_BAD_LEFTSIDE_OF_ASS;
report(ParseError, false, pn, errnum);
return false;
}
return true;
}
template <>
bool
Parser<SyntaxParseHandler>::checkAndMarkAsAssignmentLhs(Node pn, AssignmentFlavor flavor)
{
/* Full syntax checking of valid assignment LHS terms requires a parse tree. */
if (pn != SyntaxParseHandler::NodeName &&
pn != SyntaxParseHandler::NodeGetProp &&
pn != SyntaxParseHandler::NodeLValue)
{
return abortIfSyntaxParser();
}
return checkStrictAssignment(pn);
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::assignExpr(InvokedPrediction invoked)
{
JS_CHECK_RECURSION(context, return null());
// It's very common at this point to have a "detectably simple" expression,
// i.e. a name/number/string token followed by one of the following tokens
// that obviously isn't part of an expression: , ; : ) ] }
//
// (In Parsemark this happens 81.4% of the time; in code with large
// numeric arrays, such as some Kraken benchmarks, it happens more often.)
//
// In such cases, we can avoid the full expression parsing route through
// assignExpr(), condExpr1(), orExpr1(), unaryExpr(), memberExpr(), and
// primaryExpr().
TokenKind tt;
if (!tokenStream.getToken(&tt, TokenStream::Operand))
return null();
bool endsExpr;
if (tt == TOK_NAME) {
if (!tokenStream.nextTokenEndsExpr(&endsExpr))
return null();
if (endsExpr)
return identifierName();
}
if (tt == TOK_NUMBER) {
if (!tokenStream.nextTokenEndsExpr(&endsExpr))
return null();
if (endsExpr)
return newNumber(tokenStream.currentToken());
}
if (tt == TOK_STRING) {
if (!tokenStream.nextTokenEndsExpr(&endsExpr))
return null();
if (endsExpr)
return stringLiteral();
}
if (tt == TOK_YIELD && yieldExpressionsSupported())
return yieldExpression();
tokenStream.ungetToken();
// Save the tokenizer state in case we find an arrow function and have to
// rewind.
TokenStream::Position start(keepAtoms);
tokenStream.tell(&start);
Node lhs = condExpr1(invoked);
if (!lhs)
return null();
ParseNodeKind kind;
JSOp op;
switch (tokenStream.currentToken().type) {
case TOK_ASSIGN: kind = PNK_ASSIGN; op = JSOP_NOP; break;
case TOK_ADDASSIGN: kind = PNK_ADDASSIGN; op = JSOP_ADD; break;
case TOK_SUBASSIGN: kind = PNK_SUBASSIGN; op = JSOP_SUB; break;
case TOK_BITORASSIGN: kind = PNK_BITORASSIGN; op = JSOP_BITOR; break;
case TOK_BITXORASSIGN: kind = PNK_BITXORASSIGN; op = JSOP_BITXOR; break;
case TOK_BITANDASSIGN: kind = PNK_BITANDASSIGN; op = JSOP_BITAND; break;
case TOK_LSHASSIGN: kind = PNK_LSHASSIGN; op = JSOP_LSH; break;
case TOK_RSHASSIGN: kind = PNK_RSHASSIGN; op = JSOP_RSH; break;
case TOK_URSHASSIGN: kind = PNK_URSHASSIGN; op = JSOP_URSH; break;
case TOK_MULASSIGN: kind = PNK_MULASSIGN; op = JSOP_MUL; break;
case TOK_DIVASSIGN: kind = PNK_DIVASSIGN; op = JSOP_DIV; break;
case TOK_MODASSIGN: kind = PNK_MODASSIGN; op = JSOP_MOD; break;
case TOK_ARROW: {
tokenStream.seek(start);
if (!abortIfSyntaxParser())
return null();
TokenKind ignored;
if (!tokenStream.peekToken(&ignored))
return null();
return functionDef(NullPtr(), Normal, Arrow, NotGenerator);
}
default:
MOZ_ASSERT(!tokenStream.isCurrentTokenAssignment());
tokenStream.ungetToken();
return lhs;
}
AssignmentFlavor flavor = kind == PNK_ASSIGN ? PlainAssignment : CompoundAssignment;
if (!checkAndMarkAsAssignmentLhs(lhs, flavor))
return null();
bool saved = pc->inDeclDestructuring;
pc->inDeclDestructuring = false;
Node rhs = assignExpr();
pc->inDeclDestructuring = saved;
if (!rhs)
return null();
return handler.newAssignment(kind, lhs, rhs, pc, op);
}
static const char incop_name_str[][10] = {"increment", "decrement"};
template <>
bool
Parser<FullParseHandler>::checkAndMarkAsIncOperand(ParseNode* kid, TokenKind tt, bool preorder)
{
// Check.
if (!kid->isKind(PNK_NAME) &&
!kid->isKind(PNK_DOT) &&
!kid->isKind(PNK_ELEM) &&
!(kid->isKind(PNK_CALL) &&
(kid->isOp(JSOP_CALL) || kid->isOp(JSOP_SPREADCALL) ||
kid->isOp(JSOP_EVAL) || kid->isOp(JSOP_STRICTEVAL) ||
kid->isOp(JSOP_SPREADEVAL) || kid->isOp(JSOP_STRICTSPREADEVAL) ||
kid->isOp(JSOP_FUNCALL) ||
kid->isOp(JSOP_FUNAPPLY))))
{
report(ParseError, false, null(), JSMSG_BAD_OPERAND, incop_name_str[tt == TOK_DEC]);
return false;
}
if (!checkStrictAssignment(kid))
return false;
// Mark.
if (kid->isKind(PNK_NAME)) {
kid->markAsAssigned();
} else if (kid->isKind(PNK_CALL)) {
if (!makeSetCall(kid, JSMSG_BAD_INCOP_OPERAND))
return false;
}
return true;
}
template <>
bool
Parser<SyntaxParseHandler>::checkAndMarkAsIncOperand(Node kid, TokenKind tt, bool preorder)
{
// To the extent of what we support in syntax-parse mode, the rules for
// inc/dec operands are the same as for assignment. There are differences,
// such as destructuring; but if we hit any of those cases, we'll abort and
// reparse in full mode.
return checkAndMarkAsAssignmentLhs(kid, IncDecAssignment);
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::unaryOpExpr(ParseNodeKind kind, JSOp op, uint32_t begin)
{
Node kid = unaryExpr();
if (!kid)
return null();
return handler.newUnary(kind, op, begin, kid);
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::unaryExpr(InvokedPrediction invoked)
{
Node pn, pn2;
JS_CHECK_RECURSION(context, return null());
TokenKind tt;
if (!tokenStream.getToken(&tt, TokenStream::Operand))
return null();
uint32_t begin = pos().begin;
switch (tt) {
case TOK_TYPEOF:
return unaryOpExpr(PNK_TYPEOF, JSOP_TYPEOF, begin);
case TOK_VOID:
return unaryOpExpr(PNK_VOID, JSOP_VOID, begin);
case TOK_NOT:
return unaryOpExpr(PNK_NOT, JSOP_NOT, begin);
case TOK_BITNOT:
return unaryOpExpr(PNK_BITNOT, JSOP_BITNOT, begin);
case TOK_ADD:
return unaryOpExpr(PNK_POS, JSOP_POS, begin);
case TOK_SUB:
return unaryOpExpr(PNK_NEG, JSOP_NEG, begin);
case TOK_INC:
case TOK_DEC:
{
TokenKind tt2;
if (!tokenStream.getToken(&tt2, TokenStream::Operand))
return null();
pn2 = memberExpr(tt2, true);
if (!pn2)
return null();
if (!checkAndMarkAsIncOperand(pn2, tt, true))
return null();
return handler.newUnary((tt == TOK_INC) ? PNK_PREINCREMENT : PNK_PREDECREMENT,
JSOP_NOP,
begin,
pn2);
}
case TOK_DELETE: {
Node expr = unaryExpr();
if (!expr)
return null();
// Per spec, deleting any unary expression is valid -- it simply
// returns true -- except for one case that is illegal in strict mode.
if (handler.isName(expr)) {
if (!report(ParseStrictError, pc->sc->strict, expr, JSMSG_DEPRECATED_DELETE_OPERAND))
return null();
pc->sc->setBindingsAccessedDynamically();
}
return handler.newDelete(begin, expr);
}
default:
pn = memberExpr(tt, /* allowCallSyntax = */ true, invoked);
if (!pn)
return null();
/* Don't look across a newline boundary for a postfix incop. */
if (!tokenStream.peekTokenSameLine(&tt, TokenStream::Operand))
return null();
if (tt == TOK_INC || tt == TOK_DEC) {
tokenStream.consumeKnownToken(tt);
if (!checkAndMarkAsIncOperand(pn, tt, false))
return null();
return handler.newUnary((tt == TOK_INC) ? PNK_POSTINCREMENT : PNK_POSTDECREMENT,
JSOP_NOP,
begin,
pn);
}
return pn;
}
}
/*
* A dedicated helper for transplanting the legacy comprehension expression E in
*
* [E for (V in I)] // legacy array comprehension
* (E for (V in I)) // legacy generator expression
*
* from its initial location in the AST, on the left of the 'for', to its final
* position on the right. To avoid a separate pass we do this by adjusting the
* blockids and name binding links that were established when E was parsed.
*
* A legacy generator expression desugars like so:
*
* (E for (V in I)) => (function () { for (var V in I) yield E; })()
*
* so the transplanter must adjust static level as well as blockid. E's source
* coordinates in root->pn_pos are critical to deciding which binding links to
* preserve and which to cut.
*
* NB: This is not a general tree transplanter -- it knows in particular that
* the one or more bindings induced by V have not yet been created.
*/
class LegacyCompExprTransplanter
{
ParseNode* root;
Parser<FullParseHandler>* parser;
ParseContext<FullParseHandler>* outerpc;
GeneratorKind comprehensionKind;
unsigned adjust;
HashSet<Definition*> visitedImplicitArguments;
public:
LegacyCompExprTransplanter(ParseNode* pn, Parser<FullParseHandler>* parser,
ParseContext<FullParseHandler>* outerpc,
GeneratorKind kind, unsigned adj)
: root(pn), parser(parser), outerpc(outerpc), comprehensionKind(kind), adjust(adj),
visitedImplicitArguments(parser->context)
{}
bool init() {
return visitedImplicitArguments.init();
}
bool transplant(ParseNode* pn);
};
/*
* Any definitions nested within the legacy comprehension expression of a
* generator expression must move "down" one static level, which of course
* increases the upvar-frame-skip count.
*/
template <typename ParseHandler>
static bool
BumpStaticLevel(TokenStream& ts, ParseNode* pn, ParseContext<ParseHandler>* pc)
{
if (pn->pn_cookie.isFree())
return true;
unsigned level = unsigned(pn->pn_cookie.level()) + 1;
MOZ_ASSERT(level >= pc->staticLevel);
return pn->pn_cookie.set(ts, level, pn->pn_cookie.slot());
}
template <typename ParseHandler>
static bool
AdjustBlockId(TokenStream& ts, ParseNode* pn, unsigned adjust, ParseContext<ParseHandler>* pc)
{
MOZ_ASSERT(pn->isArity(PN_LIST) || pn->isArity(PN_CODE) || pn->isArity(PN_NAME));
if (BlockIdLimit - pn->pn_blockid <= adjust + 1) {
ts.reportError(JSMSG_NEED_DIET, "program");
return false;
}
pn->pn_blockid += adjust;
if (pn->pn_blockid >= pc->blockidGen)
pc->blockidGen = pn->pn_blockid + 1;
return true;
}
bool
LegacyCompExprTransplanter::transplant(ParseNode* pn)
{
ParseContext<FullParseHandler>* pc = parser->pc;
bool isGenexp = comprehensionKind != NotGenerator;
if (!pn)
return true;
switch (pn->getArity()) {
case PN_LIST:
for (ParseNode* pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) {
if (!transplant(pn2))
return false;
}
if (pn->pn_pos >= root->pn_pos) {
if (!AdjustBlockId(parser->tokenStream, pn, adjust, pc))
return false;
}
break;
case PN_TERNARY:
if (!transplant(pn->pn_kid1) ||
!transplant(pn->pn_kid2) ||
!transplant(pn->pn_kid3))
return false;
break;
case PN_BINARY:
case PN_BINARY_OBJ:
if (!transplant(pn->pn_left))
return false;
/* Binary TOK_COLON nodes can have left == right. See bug 492714. */
if (pn->pn_right != pn->pn_left) {
if (!transplant(pn->pn_right))
return false;
}
break;
case PN_UNARY:
if (!transplant(pn->pn_kid))
return false;
break;
case PN_CODE:
case PN_NAME:
if (!transplant(pn->maybeExpr()))
return false;
if (pn->isDefn()) {
if (isGenexp && !BumpStaticLevel(parser->tokenStream, pn, pc))
return false;
} else if (pn->isUsed()) {
MOZ_ASSERT(pn->pn_cookie.isFree());
Definition* dn = pn->pn_lexdef;
MOZ_ASSERT(dn->isDefn());
/*
* Adjust the definition's block id only if it is a placeholder not
* to the left of the root node, and if pn is the last use visited
* in the legacy comprehension expression (to avoid adjusting the
* blockid multiple times).
*
* Non-placeholder definitions within the legacy comprehension
* expression will be visited further below.
*/
if (dn->isPlaceholder() && dn->pn_pos >= root->pn_pos && dn->dn_uses == pn) {
if (isGenexp && !BumpStaticLevel(parser->tokenStream, dn, pc))
return false;
if (!AdjustBlockId(parser->tokenStream, dn, adjust, pc))
return false;
}
RootedAtom atom(parser->context, pn->pn_atom);
#ifdef DEBUG
StmtInfoPC* stmt = LexicalLookup(pc, atom, nullptr, (StmtInfoPC*)nullptr);
MOZ_ASSERT(!stmt || stmt != pc->topStmt);
#endif
if (isGenexp && !dn->isOp(JSOP_CALLEE)) {
MOZ_ASSERT_IF(!pc->sc->isDotVariable(atom), !pc->decls().lookupFirst(atom));
if (pc->sc->isDotVariable(atom)) {
if (dn->dn_uses == pn) {
if (!BumpStaticLevel(parser->tokenStream, dn, pc))
return false;
if (!AdjustBlockId(parser->tokenStream, dn, adjust, pc))
return false;
}
} else if (dn->pn_pos < root->pn_pos) {
/*
* The variable originally appeared to be a use of a
* definition or placeholder outside the generator, but now
* we know it is scoped within the legacy comprehension
* tail's clauses. Make it (along with any other uses within
* the generator) a use of a new placeholder in the
* generator's lexdeps.
*/
Definition* dn2 = parser->handler.newPlaceholder(atom, parser->pc->blockid(),
parser->pos());
if (!dn2)
return false;
dn2->pn_pos = root->pn_pos;
/*
* Change all uses of |dn| that lie within the generator's
* |yield| expression into uses of dn2.
*/
ParseNode** pnup = &dn->dn_uses;
ParseNode* pnu;
while ((pnu = *pnup) != nullptr && pnu->pn_pos >= root->pn_pos) {
pnu->pn_lexdef = dn2;
dn2->pn_dflags |= pnu->pn_dflags & PND_USE2DEF_FLAGS;
pnup = &pnu->pn_link;
}
dn2->dn_uses = dn->dn_uses;
dn->dn_uses = *pnup;
*pnup = nullptr;
DefinitionSingle def = DefinitionSingle::new_<FullParseHandler>(dn2);
if (!pc->lexdeps->put(atom, def))
return false;
if (dn->isClosed())
dn2->pn_dflags |= PND_CLOSED;
} else if (dn->isPlaceholder()) {
/*
* The variable first occurs free in the 'yield' expression;
* move the existing placeholder node (and all its uses)
* from the parent's lexdeps into the generator's lexdeps.
*/
outerpc->lexdeps->remove(atom);
DefinitionSingle def = DefinitionSingle::new_<FullParseHandler>(dn);
if (!pc->lexdeps->put(atom, def))
return false;
} else if (dn->isImplicitArguments()) {
/*
* Implicit 'arguments' Definition nodes (see
* PND_IMPLICITARGUMENTS in Parser::functionBody) are only
* reachable via the lexdefs of their uses. Unfortunately,
* there may be multiple uses, so we need to maintain a set
* to only bump the definition once.
*/
if (isGenexp && !visitedImplicitArguments.has(dn)) {
if (!BumpStaticLevel(parser->tokenStream, dn, pc))
return false;
if (!AdjustBlockId(parser->tokenStream, dn, adjust, pc))
return false;
if (!visitedImplicitArguments.put(dn))
return false;
}
}
}
}
if (pn->pn_pos >= root->pn_pos) {
if (!AdjustBlockId(parser->tokenStream, pn, adjust, pc))
return false;
}
break;
case PN_NULLARY:
/* Nothing. */
break;
}
return true;
}
// Parsing legacy (JS1.7-style) comprehensions is terrible: we parse the head
// expression as if it's part of a comma expression, then when we see the "for"
// we transplant the parsed expression into the inside of a constructed
// for-of/for-in/for-each tail. Transplanting an already-parsed expression is
// tricky, but the LegacyCompExprTransplanter handles most of that.
//
// The one remaining thing to patch up is the block scope depth. We need to
// compute the maximum block scope depth of a function, so we know how much
// space to reserve in the fixed part of a stack frame. Normally this is done
// whenever we leave a statement, via AccumulateBlockScopeDepth. However if the
// head has a let expression, we need to re-assign that depth to the tail of the
// comprehension.
//
// Thing is, we don't actually know what that depth is, because the only
// information we keep is the maximum nested depth within a statement, so we
// just conservatively propagate the maximum nested depth from the top statement
// to the comprehension tail.
//
template <typename ParseHandler>
static unsigned
LegacyComprehensionHeadBlockScopeDepth(ParseContext<ParseHandler>* pc)
{
return pc->topStmt ? pc->topStmt->innerBlockScopeDepth : pc->blockScopeDepth;
}
/*
* Starting from a |for| keyword after the first array initialiser element or
* an expression in an open parenthesis, parse the tail of the comprehension
* or generator expression signified by this |for| keyword in context.
*
* Return null on failure, else return the top-most parse node for the array
* comprehension or generator expression, with a unary node as the body of the
* (possibly nested) for-loop, initialized by |kind, op, kid|.
*/
template <>
ParseNode*
Parser<FullParseHandler>::legacyComprehensionTail(ParseNode* bodyExpr, unsigned blockid,
GeneratorKind comprehensionKind,
ParseContext<FullParseHandler>* outerpc,
unsigned innerBlockScopeDepth)
{
/*
* If we saw any inner functions while processing the generator expression
* then they may have upvars referring to the let vars in this generator
* which were not correctly processed. Bail out and start over without
* allowing lazy parsing.
*/
if (handler.syntaxParser) {
handler.disableSyntaxParser();
abortedSyntaxParse = true;
return nullptr;
}
unsigned adjust;
ParseNode* pn, *pn3, **pnp;
StmtInfoPC stmtInfo(context);
BindData<FullParseHandler> data(context);
TokenKind tt;
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR));
bool isGenexp = comprehensionKind != NotGenerator;
if (isGenexp) {
MOZ_ASSERT(comprehensionKind == LegacyGenerator);
/*
* Generator expression desugars to an immediately applied lambda that
* yields the next value from a for-in loop (possibly nested, and with
* optional if guard). Make pn be the TOK_LC body node.
*/
pn = pushLexicalScope(&stmtInfo);
if (!pn)
return null();
adjust = pn->pn_blockid - blockid;
} else {
/*
* Make a parse-node and literal object representing the block scope of
* this array comprehension. Our caller in primaryExpr, the TOK_LB case
* aka the array initialiser case, has passed the blockid to claim for
* the comprehension's block scope. We allocate that id or one above it
* here, by calling PushLexicalScope.
*
* In the case of a comprehension expression that has nested blocks
* (e.g., let expressions), we will allocate a higher blockid but then
* slide all blocks "to the right" to make room for the comprehension's
* block scope.
*/
adjust = pc->blockid();
pn = pushLexicalScope(&stmtInfo);
if (!pn)
return null();
MOZ_ASSERT(blockid <= pn->pn_blockid);
MOZ_ASSERT(blockid < pc->blockidGen);
MOZ_ASSERT(pc->bodyid < blockid);
pn->pn_blockid = stmtInfo.blockid = blockid;
MOZ_ASSERT(adjust < blockid);
adjust = blockid - adjust;
}
handler.setBeginPosition(pn, bodyExpr);
pnp = &pn->pn_expr;
LegacyCompExprTransplanter transplanter(bodyExpr, this, outerpc, comprehensionKind, adjust);
if (!transplanter.init())
return null();
if (!transplanter.transplant(bodyExpr))
return null();
MOZ_ASSERT(pc->staticScope && pc->staticScope == pn->pn_objbox->object);
data.initLexical(HoistVars, &pc->staticScope->as<StaticBlockObject>(),
JSMSG_ARRAY_INIT_TOO_BIG);
while (true) {
/*
* FOR node is binary, left is loop control and right is body. Use
* index to count each block-local let-variable on the left-hand side
* of the in/of.
*/
ParseNode* pn2 = handler.new_<BinaryNode>(PNK_FOR, JSOP_ITER, pos(),
nullptr, nullptr);
if (!pn2)
return null();
pn2->pn_iflags = JSITER_ENUMERATE;
if (allowsForEachIn()) {
bool matched;
if (!tokenStream.matchContextualKeyword(&matched, context->names().each))
return null();
if (matched) {
pn2->pn_iflags |= JSITER_FOREACH;
addTelemetry(JSCompartment::DeprecatedForEach);
if (versionNumber() < JSVERSION_LATEST) {
if (!report(ParseWarning, pc->sc->strict, pn2, JSMSG_DEPRECATED_FOR_EACH))
return null();
}
}
}
MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_AFTER_FOR);
uint32_t startYieldOffset = pc->lastYieldOffset;
RootedPropertyName name(context);
if (!tokenStream.getToken(&tt))
return null();
switch (tt) {
case TOK_LB:
case TOK_LC:
pc->inDeclDestructuring = true;
pn3 = primaryExpr(tt);
pc->inDeclDestructuring = false;
if (!pn3)
return null();
break;
case TOK_NAME:
name = tokenStream.currentName();
/*
* Create a name node with pn_op JSOP_GETNAME. We can't set pn_op to
* JSOP_GETLOCAL here, because we don't yet know the block's depth
* in the operand stack frame. The code generator computes that,
* and it tries to bind all names to slots, so we must let it do
* the deed.
*/
pn3 = newBindingNode(name, false);
if (!pn3)
return null();
break;
default:
report(ParseError, false, null(), JSMSG_NO_VARIABLE_NAME);
return null();
}
bool isForIn, isForOf;
if (!matchInOrOf(&isForIn, &isForOf))
return null();
if (!isForIn && !isForOf) {
report(ParseError, false, null(), JSMSG_IN_AFTER_FOR_NAME);
return null();
}
ParseNodeKind headKind = PNK_FORIN;
if (isForOf) {
if (pn2->pn_iflags != JSITER_ENUMERATE) {
MOZ_ASSERT(pn2->pn_iflags == (JSITER_FOREACH | JSITER_ENUMERATE));
report(ParseError, false, null(), JSMSG_BAD_FOR_EACH_LOOP);
return null();
}
pn2->pn_iflags = 0;
headKind = PNK_FOROF;
}
ParseNode* pn4 = expr();
if (!pn4)
return null();
MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_FOR_CTRL);
if (isGenexp && pc->lastYieldOffset != startYieldOffset) {
reportWithOffset(ParseError, false, pc->lastYieldOffset,
JSMSG_BAD_GENEXP_BODY, js_yield_str);
return null();
}
switch (tt) {
case TOK_LB:
case TOK_LC:
if (!checkDestructuring(&data, pn3))
return null();
if (versionNumber() == JSVERSION_1_7 &&
!(pn2->pn_iflags & JSITER_FOREACH) &&
!isForOf)
{
/* Destructuring requires [key, value] enumeration in JS1.7. */
if (!pn3->isKind(PNK_ARRAY) || pn3->pn_count != 2) {
report(ParseError, false, null(), JSMSG_BAD_FOR_LEFTSIDE);
return null();
}
MOZ_ASSERT(pn2->isOp(JSOP_ITER));
MOZ_ASSERT(pn2->pn_iflags & JSITER_ENUMERATE);
MOZ_ASSERT(headKind == PNK_FORIN);
pn2->pn_iflags |= JSITER_FOREACH | JSITER_KEYVALUE;
}
break;
case TOK_NAME:
data.pn = pn3;
if (!data.binder(&data, name, this))
return null();
break;
default:;
}
/*
* Synthesize a declaration. Every definition must appear in the parse
* tree in order for ComprehensionTranslator to work.
*
* These are lets to tell the bytecode emitter to emit initialization
* code for the temporal dead zone.
*/
ParseNode* lets = handler.newList(PNK_LET, pn3);
if (!lets)
return null();
lets->pn_xflags |= PNX_POPVAR;
/* Definitions can't be passed directly to EmitAssignment as lhs. */
pn3 = cloneLeftHandSide(pn3);
if (!pn3)
return null();
pn2->pn_left = handler.newTernary(headKind, lets, pn3, pn4);
if (!pn2->pn_left)
return null();
*pnp = pn2;
pnp = &pn2->pn_right;
bool matched;
if (!tokenStream.matchToken(&matched, TOK_FOR))
return null();
if (!matched)
break;
}
bool matched;
if (!tokenStream.matchToken(&matched, TOK_IF))
return null();
if (matched) {
ParseNode* cond = condition();
if (!cond)
return null();
ParseNode* ifNode = handler.new_<TernaryNode>(PNK_IF, JSOP_NOP, cond, nullptr, nullptr,
cond->pn_pos);
if (!ifNode)
return null();
*pnp = ifNode;
pnp = &ifNode->pn_kid2;
}
ParseNode* bodyStmt;
if (isGenexp) {
ParseNode* yieldExpr = newYieldExpression(bodyExpr->pn_pos.begin, bodyExpr);
if (!yieldExpr)
return null();
yieldExpr->setInParens(true);
bodyStmt = handler.newExprStatement(yieldExpr, bodyExpr->pn_pos.end);
if (!bodyStmt)
return null();
} else {
bodyStmt = handler.newUnary(PNK_ARRAYPUSH, JSOP_ARRAYPUSH,
bodyExpr->pn_pos.begin, bodyExpr);
if (!bodyStmt)
return null();
}
*pnp = bodyStmt;
pc->topStmt->innerBlockScopeDepth += innerBlockScopeDepth;
PopStatementPC(tokenStream, pc);
handler.setEndPosition(pn, pos().end);
return pn;
}
template <>
SyntaxParseHandler::Node
Parser<SyntaxParseHandler>::legacyComprehensionTail(SyntaxParseHandler::Node bodyStmt,
unsigned blockid,
GeneratorKind comprehensionKind,
ParseContext<SyntaxParseHandler>* outerpc,
unsigned innerBlockScopeDepth)
{
abortIfSyntaxParser();
return null();
}
template <>
ParseNode*
Parser<FullParseHandler>::legacyArrayComprehension(ParseNode* array)
{
// Discard our presumed array literal containing only a single element, and
// instead return an array comprehension node. Extract the few bits of
// information needed from the array literal, then free it.
MOZ_ASSERT(array->isKind(PNK_ARRAY));
MOZ_ASSERT(array->pn_count == 1);
uint32_t arrayBegin = handler.getPosition(array).begin;
uint32_t blockid = array->pn_blockid;
ParseNode* bodyExpr = array->pn_head;
array->pn_count = 0;
array->pn_tail = &array->pn_head;
*array->pn_tail = nullptr;
handler.freeTree(array);
ParseNode* comp = legacyComprehensionTail(bodyExpr, blockid, NotGenerator, nullptr,
LegacyComprehensionHeadBlockScopeDepth(pc));
if (!comp)
return null();
MUST_MATCH_TOKEN(TOK_RB, JSMSG_BRACKET_AFTER_ARRAY_COMPREHENSION);
return handler.newArrayComprehension(comp, blockid, TokenPos(arrayBegin, pos().end));
}
template <>
SyntaxParseHandler::Node
Parser<SyntaxParseHandler>::legacyArrayComprehension(Node array)
{
abortIfSyntaxParser();
return null();
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::generatorComprehensionLambda(GeneratorKind comprehensionKind,
unsigned begin, Node innerExpr)
{
MOZ_ASSERT(comprehensionKind == LegacyGenerator || comprehensionKind == StarGenerator);
MOZ_ASSERT(!!innerExpr == (comprehensionKind == LegacyGenerator));
Node genfn = handler.newFunctionDefinition();
if (!genfn)
return null();
handler.setOp(genfn, JSOP_LAMBDA);
ParseContext<ParseHandler>* outerpc = pc;
// If we are off the main thread, the generator meta-objects have
// already been created by js::StartOffThreadParseScript, so cx will not
// be necessary.
RootedObject proto(context);
if (comprehensionKind == StarGenerator) {
JSContext* cx = context->maybeJSContext();
proto = GlobalObject::getOrCreateStarGeneratorFunctionPrototype(cx, context->global());
if (!proto)
return null();
}
RootedFunction fun(context, newFunction(/* atom = */ NullPtr(), Expression, proto));
if (!fun)
return null();
// Create box for fun->object early to root it.
Directives directives(/* strict = */ outerpc->sc->strict);
FunctionBox* genFunbox = newFunctionBox(genfn, fun, outerpc, directives, comprehensionKind);
if (!genFunbox)
return null();
ParseContext<ParseHandler> genpc(this, outerpc, genfn, genFunbox,
/* newDirectives = */ nullptr,
outerpc->staticLevel + 1, outerpc->blockidGen,
/* blockScopeDepth = */ 0);
if (!genpc.init(tokenStream))
return null();
/*
* We assume conservatively that any deoptimization flags in pc->sc
* come from the kid. So we propagate these flags into genfn. For code
* simplicity we also do not detect if the flags were only set in the
* kid and could be removed from pc->sc.
*/
genFunbox->anyCxFlags = outerpc->sc->anyCxFlags;
if (outerpc->sc->isFunctionBox())
genFunbox->funCxFlags = outerpc->sc->asFunctionBox()->funCxFlags;
MOZ_ASSERT(genFunbox->generatorKind() == comprehensionKind);
genFunbox->inGenexpLambda = true;
handler.setBlockId(genfn, genpc.bodyid);
Node generator = newName(context->names().dotGenerator);
if (!generator)
return null();
if (!pc->define(tokenStream, context->names().dotGenerator, generator, Definition::VAR))
return null();
Node body = handler.newStatementList(pc->blockid(), TokenPos(begin, pos().end));
if (!body)
return null();
Node comp;
if (comprehensionKind == StarGenerator) {
comp = comprehension(StarGenerator);
if (!comp)
return null();
} else {
MOZ_ASSERT(comprehensionKind == LegacyGenerator);
comp = legacyComprehensionTail(innerExpr, outerpc->blockid(), LegacyGenerator,
outerpc, LegacyComprehensionHeadBlockScopeDepth(outerpc));
if (!comp)
return null();
}
if (comprehensionKind == StarGenerator)
MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_IN_PAREN);
handler.setBeginPosition(comp, begin);
handler.setEndPosition(comp, pos().end);
handler.addStatementToList(body, comp, pc);
handler.setEndPosition(body, pos().end);
handler.setBeginPosition(genfn, begin);
handler.setEndPosition(genfn, pos().end);
generator = newName(context->names().dotGenerator);
if (!generator)
return null();
if (!noteNameUse(context->names().dotGenerator, generator))
return null();
if (!handler.prependInitialYield(body, generator))
return null();
// Note that if we ever start syntax-parsing generators, we will also
// need to propagate the closed-over variable set to the inner
// lazyscript, as in finishFunctionDefinition.
handler.setFunctionBody(genfn, body);
PropagateTransitiveParseFlags(genFunbox, outerpc->sc);
if (!leaveFunction(genfn, outerpc))
return null();
return genfn;
}
#if JS_HAS_GENERATOR_EXPRS
/*
* Starting from a |for| keyword after an expression, parse the comprehension
* tail completing this generator expression. Wrap the expression at kid in a
* generator function that is immediately called to evaluate to the generator
* iterator that is the value of this legacy generator expression.
*
* |kid| must be the expression before the |for| keyword; we return an
* application of a generator function that includes the |for| loops and
* |if| guards, with |kid| as the operand of a |yield| expression as the
* innermost loop body.
*
* Note how unlike Python, we do not evaluate the expression to the right of
* the first |in| in the chain of |for| heads. Instead, a generator expression
* is merely sugar for a generator function expression and its application.
*/
template <>
ParseNode*
Parser<FullParseHandler>::legacyGeneratorExpr(ParseNode* expr)
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR));
// Make a new node for the desugared generator function.
ParseNode* genfn = generatorComprehensionLambda(LegacyGenerator, expr->pn_pos.begin, expr);
if (!genfn)
return null();
// Our result is a call expression that invokes the anonymous generator
// function object.
return handler.newList(PNK_GENEXP, genfn, JSOP_CALL);
}
template <>
SyntaxParseHandler::Node
Parser<SyntaxParseHandler>::legacyGeneratorExpr(Node kid)
{
JS_ALWAYS_FALSE(abortIfSyntaxParser());
return SyntaxParseHandler::NodeFailure;
}
static const char js_generator_str[] = "generator";
#endif /* JS_HAS_GENERATOR_EXPRS */
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::comprehensionFor(GeneratorKind comprehensionKind)
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR));
uint32_t begin = pos().begin;
MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_AFTER_FOR);
// FIXME: Destructuring binding (bug 980828).
MUST_MATCH_TOKEN(TOK_NAME, JSMSG_NO_VARIABLE_NAME);
RootedPropertyName name(context, tokenStream.currentName());
if (name == context->names().let) {
report(ParseError, false, null(), JSMSG_LET_COMP_BINDING);
return null();
}
bool matched;
if (!tokenStream.matchContextualKeyword(&matched, context->names().of))
return null();
if (!matched) {
report(ParseError, false, null(), JSMSG_OF_AFTER_FOR_NAME);
return null();
}
Node rhs = assignExpr();
if (!rhs)
return null();
MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_FOR_OF_ITERABLE);
TokenPos headPos(begin, pos().end);
StmtInfoPC stmtInfo(context);
BindData<ParseHandler> data(context);
RootedStaticBlockObject blockObj(context, StaticBlockObject::create(context));
if (!blockObj)
return null();
data.initLexical(DontHoistVars, blockObj, JSMSG_TOO_MANY_LOCALS);
Node lhs = newName(name);
if (!lhs)
return null();
Node decls = handler.newList(PNK_LET, lhs);
if (!decls)
return null();
data.pn = lhs;
if (!data.binder(&data, name, this))
return null();
Node letScope = pushLetScope(blockObj, &stmtInfo);
if (!letScope)
return null();
handler.setLexicalScopeBody(letScope, decls);
Node assignLhs = newName(name);
if (!assignLhs)
return null();
if (!noteNameUse(name, assignLhs))
return null();
handler.setOp(assignLhs, JSOP_SETNAME);
Node head = handler.newForHead(PNK_FOROF, letScope, assignLhs, rhs, headPos);
if (!head)
return null();
Node tail = comprehensionTail(comprehensionKind);
if (!tail)
return null();
PopStatementPC(tokenStream, pc);
return handler.newForStatement(begin, head, tail, JSOP_ITER);
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::comprehensionIf(GeneratorKind comprehensionKind)
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_IF));
uint32_t begin = pos().begin;
MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_BEFORE_COND);
Node cond = assignExpr();
if (!cond)
return null();
MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_COND);
/* Check for (a = b) and warn about possible (a == b) mistype. */
if (handler.isUnparenthesizedAssignment(cond)) {
if (!report(ParseExtraWarning, false, null(), JSMSG_EQUAL_AS_ASSIGN))
return null();
}
Node then = comprehensionTail(comprehensionKind);
if (!then)
return null();
return handler.newIfStatement(begin, cond, then, null());
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::comprehensionTail(GeneratorKind comprehensionKind)
{
JS_CHECK_RECURSION(context, return null());
bool matched;
if (!tokenStream.matchToken(&matched, TOK_FOR, TokenStream::Operand))
return null();
if (matched)
return comprehensionFor(comprehensionKind);
if (!tokenStream.matchToken(&matched, TOK_IF, TokenStream::Operand))
return null();
if (matched)
return comprehensionIf(comprehensionKind);
uint32_t begin = pos().begin;
Node bodyExpr = assignExpr();
if (!bodyExpr)
return null();
if (comprehensionKind == NotGenerator)
return handler.newUnary(PNK_ARRAYPUSH, JSOP_ARRAYPUSH, begin, bodyExpr);
MOZ_ASSERT(comprehensionKind == StarGenerator);
Node yieldExpr = newYieldExpression(begin, bodyExpr);
if (!yieldExpr)
return null();
yieldExpr = handler.parenthesize(yieldExpr);
return handler.newExprStatement(yieldExpr, pos().end);
}
// Parse an ES6 generator or array comprehension, starting at the first 'for'.
// The caller is responsible for matching the ending TOK_RP or TOK_RB.
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::comprehension(GeneratorKind comprehensionKind)
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR));
uint32_t startYieldOffset = pc->lastYieldOffset;
Node body = comprehensionFor(comprehensionKind);
if (!body)
return null();
if (comprehensionKind != NotGenerator && pc->lastYieldOffset != startYieldOffset) {
reportWithOffset(ParseError, false, pc->lastYieldOffset,
JSMSG_BAD_GENEXP_BODY, js_yield_str);
return null();
}
return body;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::arrayComprehension(uint32_t begin)
{
Node inner = comprehension(NotGenerator);
if (!inner)
return null();
MUST_MATCH_TOKEN(TOK_RB, JSMSG_BRACKET_AFTER_ARRAY_COMPREHENSION);
Node comp = handler.newList(PNK_ARRAYCOMP, inner);
if (!comp)
return null();
handler.setBeginPosition(comp, begin);
handler.setEndPosition(comp, pos().end);
return comp;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::generatorComprehension(uint32_t begin)
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR));
// We have no problem parsing generator comprehensions inside lazy
// functions, but the bytecode emitter currently can't handle them that way,
// because when it goes to emit the code for the inner generator function,
// it expects outer functions to have non-lazy scripts.
if (!abortIfSyntaxParser())
return null();
Node genfn = generatorComprehensionLambda(StarGenerator, begin, null());
if (!genfn)
return null();
Node result = handler.newList(PNK_GENEXP, genfn, JSOP_CALL);
if (!result)
return null();
handler.setBeginPosition(result, begin);
handler.setEndPosition(result, pos().end);
return result;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::assignExprWithoutYield(unsigned msg)
{
uint32_t startYieldOffset = pc->lastYieldOffset;
Node res = assignExpr();
if (res && pc->lastYieldOffset != startYieldOffset) {
reportWithOffset(ParseError, false, pc->lastYieldOffset,
msg, js_yield_str);
return null();
}
return res;
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::argumentList(Node listNode, bool* isSpread)
{
bool matched;
if (!tokenStream.matchToken(&matched, TOK_RP, TokenStream::Operand))
return false;
if (matched) {
handler.setEndPosition(listNode, pos().end);
return true;
}
uint32_t startYieldOffset = pc->lastYieldOffset;
bool arg0 = true;
while (true) {
bool spread = false;
uint32_t begin = 0;
if (!tokenStream.matchToken(&matched, TOK_TRIPLEDOT, TokenStream::Operand))
return false;
if (matched) {
spread = true;
begin = pos().begin;
*isSpread = true;
}
Node argNode = assignExpr();
if (!argNode)
return false;
if (spread) {
argNode = handler.newUnary(PNK_SPREAD, JSOP_NOP, begin, argNode);
if (!argNode)
return false;
}
if (handler.isUnparenthesizedYieldExpression(argNode)) {
TokenKind tt;
if (!tokenStream.peekToken(&tt))
return false;
if (tt == TOK_COMMA) {
report(ParseError, false, argNode, JSMSG_BAD_GENERATOR_SYNTAX, js_yield_str);
return false;
}
}
#if JS_HAS_GENERATOR_EXPRS
if (!spread) {
if (!tokenStream.matchToken(&matched, TOK_FOR))
return false;
if (matched) {
if (pc->lastYieldOffset != startYieldOffset) {
reportWithOffset(ParseError, false, pc->lastYieldOffset,
JSMSG_BAD_GENEXP_BODY, js_yield_str);
return false;
}
argNode = legacyGeneratorExpr(argNode);
if (!argNode)
return false;
if (!arg0) {
report(ParseError, false, argNode, JSMSG_BAD_GENERATOR_SYNTAX, js_generator_str);
return false;
}
TokenKind tt;
if (!tokenStream.peekToken(&tt))
return false;
if (tt == TOK_COMMA) {
report(ParseError, false, argNode, JSMSG_BAD_GENERATOR_SYNTAX, js_generator_str);
return false;
}
}
}
#endif
arg0 = false;
handler.addList(listNode, argNode);
bool matched;
if (!tokenStream.matchToken(&matched, TOK_COMMA))
return false;
if (!matched)
break;
}
TokenKind tt;
if (!tokenStream.getToken(&tt))
return false;
if (tt != TOK_RP) {
report(ParseError, false, null(), JSMSG_PAREN_AFTER_ARGS);
return false;
}
handler.setEndPosition(listNode, pos().end);
return true;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::memberExpr(TokenKind tt, bool allowCallSyntax, InvokedPrediction invoked)
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(tt));
Node lhs;
JS_CHECK_RECURSION(context, return null());
/* Check for new expression first. */
if (tt == TOK_NEW) {
lhs = handler.newList(PNK_NEW, JSOP_NEW);
if (!lhs)
return null();
if (!tokenStream.getToken(&tt, TokenStream::Operand))
return null();
Node ctorExpr = memberExpr(tt, false, PredictInvoked);
if (!ctorExpr)
return null();
handler.addList(lhs, ctorExpr);
bool matched;
if (!tokenStream.matchToken(&matched, TOK_LP))
return null();
if (matched) {
bool isSpread = false;
if (!argumentList(lhs, &isSpread))
return null();
if (isSpread)
handler.setOp(lhs, JSOP_SPREADNEW);
}
} else {
lhs = primaryExpr(tt, invoked);
if (!lhs)
return null();
}
while (true) {
if (!tokenStream.getToken(&tt))
return null();
if (tt == TOK_EOF)
break;
Node nextMember;
if (tt == TOK_DOT) {
if (!tokenStream.getToken(&tt, TokenStream::KeywordIsName))
return null();
if (tt == TOK_NAME) {
PropertyName* field = tokenStream.currentName();
nextMember = handler.newPropertyAccess(lhs, field, pos().end);
if (!nextMember)
return null();
} else {
report(ParseError, false, null(), JSMSG_NAME_AFTER_DOT);
return null();
}
} else if (tt == TOK_LB) {
Node propExpr = expr();
if (!propExpr)
return null();
MUST_MATCH_TOKEN(TOK_RB, JSMSG_BRACKET_IN_INDEX);
nextMember = handler.newPropertyByValue(lhs, propExpr, pos().end);
if (!nextMember)
return null();
} else if ((allowCallSyntax && tt == TOK_LP) ||
tt == TOK_TEMPLATE_HEAD ||
tt == TOK_NO_SUBS_TEMPLATE)
{
JSOp op = JSOP_CALL;
nextMember = handler.newList(tt == TOK_LP ? PNK_CALL : PNK_TAGGED_TEMPLATE, JSOP_CALL);
if (!nextMember)
return null();
if (JSAtom* atom = handler.isName(lhs)) {
if (tt == TOK_LP && atom == context->names().eval) {
/* Select JSOP_EVAL and flag pc as heavyweight. */
op = pc->sc->strict ? JSOP_STRICTEVAL : JSOP_EVAL;
pc->sc->setBindingsAccessedDynamically();
pc->sc->setHasDirectEval();
/*
* In non-strict mode code, direct calls to eval can add
* variables to the call object.
*/
if (pc->sc->isFunctionBox() && !pc->sc->strict)
pc->sc->asFunctionBox()->setHasExtensibleScope();
}
} else if (JSAtom* atom = handler.isGetProp(lhs)) {
/* Select JSOP_FUNAPPLY given foo.apply(...). */
if (atom == context->names().apply) {
op = JSOP_FUNAPPLY;
if (pc->sc->isFunctionBox())
pc->sc->asFunctionBox()->usesApply = true;
} else if (atom == context->names().call) {
op = JSOP_FUNCALL;
}
}
handler.setBeginPosition(nextMember, lhs);
handler.addList(nextMember, lhs);
if (tt == TOK_LP) {
bool isSpread = false;
if (!argumentList(nextMember, &isSpread))
return null();
if (isSpread) {
if (op == JSOP_EVAL)
op = JSOP_SPREADEVAL;
else if (op == JSOP_STRICTEVAL)
op = JSOP_STRICTSPREADEVAL;
else
op = JSOP_SPREADCALL;
}
} else {
if (!taggedTemplate(nextMember, tt))
return null();
}
handler.setOp(nextMember, op);
} else {
tokenStream.ungetToken();
return lhs;
}
lhs = nextMember;
}
return lhs;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::newName(PropertyName* name)
{
return handler.newName(name, pc->blockid(), pos());
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::identifierName()
{
RootedPropertyName name(context, tokenStream.currentName());
Node pn = newName(name);
if (!pn)
return null();
if (!pc->inDeclDestructuring && !noteNameUse(name, pn))
return null();
return pn;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::stringLiteral()
{
return handler.newStringLiteral(stopStringCompression(), pos());
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::noSubstitutionTemplate()
{
return handler.newTemplateStringLiteral(stopStringCompression(), pos());
}
template <typename ParseHandler>
JSAtom * Parser<ParseHandler>::stopStringCompression() {
JSAtom* atom = tokenStream.currentToken().atom();
// Large strings are fast to parse but slow to compress. Stop compression on
// them, so we don't wait for a long time for compression to finish at the
// end of compilation.
const size_t HUGE_STRING = 50000;
if (sct && sct->active() && atom->length() >= HUGE_STRING)
sct->abort();
return atom;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::newRegExp()
{
MOZ_ASSERT(!options().selfHostingMode);
// Create the regexp even when doing a syntax parse, to check the regexp's syntax.
const char16_t* chars = tokenStream.getTokenbuf().begin();
size_t length = tokenStream.getTokenbuf().length();
RegExpFlag flags = tokenStream.currentToken().regExpFlags();
Rooted<RegExpObject*> reobj(context);
RegExpStatics* res = context->global()->getRegExpStatics(context);
if (!res)
return null();
reobj = RegExpObject::create(context, res, chars, length, flags, &tokenStream, alloc);
if (!reobj)
return null();
return handler.newRegExp(reobj, pos(), *this);
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::arrayInitializer()
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_LB));
uint32_t begin = pos().begin;
Node literal = handler.newArrayLiteral(begin, pc->blockidGen);
if (!literal)
return null();
TokenKind tt;
if (!tokenStream.getToken(&tt, TokenStream::Operand))
return null();
// Handle an ES7 array comprehension first.
if (tt == TOK_FOR)
return arrayComprehension(begin);
if (tt == TOK_RB) {
/*
* Mark empty arrays as non-constant, since we cannot easily
* determine their type.
*/
handler.setListFlag(literal, PNX_NONCONST);
} else {
tokenStream.ungetToken();
bool spread = false, missingTrailingComma = false;
uint32_t index = 0;
for (; ; index++) {
if (index == NativeObject::NELEMENTS_LIMIT) {
report(ParseError, false, null(), JSMSG_ARRAY_INIT_TOO_BIG);
return null();
}
TokenKind tt;
if (!tokenStream.peekToken(&tt, TokenStream::Operand))
return null();
if (tt == TOK_RB)
break;
if (tt == TOK_COMMA) {
tokenStream.consumeKnownToken(TOK_COMMA);
if (!handler.addElision(literal, pos()))
return null();
} else if (tt == TOK_TRIPLEDOT) {
spread = true;
tokenStream.consumeKnownToken(TOK_TRIPLEDOT);
uint32_t begin = pos().begin;
Node inner = assignExpr();
if (!inner)
return null();
if (!handler.addSpreadElement(literal, begin, inner))
return null();
} else {
Node element = assignExpr();
if (!element)
return null();
if (foldConstants && !FoldConstants(context, &element, this))
return null();
handler.addArrayElement(literal, element);
}
if (tt != TOK_COMMA) {
/* If we didn't already match TOK_COMMA in above case. */
bool matched;
if (!tokenStream.matchToken(&matched, TOK_COMMA))
return null();
if (!matched) {
missingTrailingComma = true;
break;
}
}
}
/*
* At this point, (index == 0 && missingTrailingComma) implies one
* element initialiser was parsed.
*
* A legacy array comprehension of the form:
*
* [i * j for (i in o) for (j in p) if (i != j)]
*
* translates to roughly the following let expression:
*
* let (array = new Array, i, j) {
* for (i in o) let {
* for (j in p)
* if (i != j)
* array.push(i * j)
* }
* array
* }
*
* where array is a nameless block-local variable. The "roughly" means
* that an implementation may optimize away the array.push. A legacy
* array comprehension opens exactly one block scope, no matter how many
* for heads it contains.
*
* Each let () {...} or for (let ...) ... compiles to:
*
* JSOP_PUSHN <N> // Push space for block-scoped locals.
* (JSOP_PUSHBLOCKSCOPE <O>) // If a local is aliased, push on scope
* // chain.
* ...
* JSOP_DEBUGLEAVEBLOCK // Invalidate any DebugScope proxies.
* JSOP_POPBLOCKSCOPE? // Pop off scope chain, if needed.
* JSOP_POPN <N> // Pop space for block-scoped locals.
*
* where <o> is a literal object representing the block scope,
* with <n> properties, naming each var declared in the block.
*
* Each var declaration in a let-block binds a name in <o> at compile
* time. A block-local var is accessed by the JSOP_GETLOCAL and
* JSOP_SETLOCAL ops. These ops have an immediate operand, the local
* slot's stack index from fp->spbase.
*
* The legacy array comprehension iteration step, array.push(i * j) in
* the example above, is done by <i * j>; JSOP_ARRAYPUSH <array>, where
* <array> is the index of array's stack slot.
*/
if (index == 0 && !spread) {
bool matched;
if (!tokenStream.matchToken(&matched, TOK_FOR))
return null();
if (matched && missingTrailingComma)
return legacyArrayComprehension(literal);
}
MUST_MATCH_TOKEN(TOK_RB, JSMSG_BRACKET_AFTER_LIST);
}
handler.setEndPosition(literal, pos().end);
return literal;
}
static JSAtom*
DoubleToAtom(ExclusiveContext* cx, double value)
{
// This is safe because doubles can not be moved.
Value tmp = DoubleValue(value);
return ToAtom<CanGC>(cx, HandleValue::fromMarkedLocation(&tmp));
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::computedPropertyName(Node literal)
{
uint32_t begin = pos().begin;
// Turn off the inDeclDestructuring flag when parsing computed property
// names. In short, when parsing 'let {[x + y]: z} = obj;', noteNameUse()
// should be called on x and y, but not on z. See the comment on
// Parser<>::checkDestructuring() for details.
bool saved = pc->inDeclDestructuring;
pc->inDeclDestructuring = false;
Node assignNode = assignExpr();
pc->inDeclDestructuring = saved;
if (!assignNode)
return null();
MUST_MATCH_TOKEN(TOK_RB, JSMSG_COMP_PROP_UNTERM_EXPR);
Node propname = handler.newComputedName(assignNode, begin, pos().end);
if (!propname)
return null();
handler.setListFlag(literal, PNX_NONCONST);
return propname;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::objectLiteral()
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_LC));
Node literal = handler.newObjectLiteral(pos().begin);
if (!literal)
return null();
bool seenPrototypeMutation = false;
RootedAtom atom(context);
for (;;) {
TokenKind ltok;
if (!tokenStream.getToken(<ok, TokenStream::KeywordIsName))
return null();
if (ltok == TOK_RC)
break;
bool isGenerator = false;
if (ltok == TOK_MUL) {
isGenerator = true;
if (!tokenStream.getToken(<ok, TokenStream::KeywordIsName))
return null();
}
atom = nullptr;
JSOp op = JSOP_INITPROP;
Node propname;
switch (ltok) {
case TOK_NUMBER:
atom = DoubleToAtom(context, tokenStream.currentToken().number());
if (!atom)
return null();
propname = newNumber(tokenStream.currentToken());
if (!propname)
return null();
break;
case TOK_LB: {
propname = computedPropertyName(literal);
if (!propname)
return null();
break;
}
case TOK_NAME: {
atom = tokenStream.currentName();
// Do not look for accessor syntax on generators
if (!isGenerator &&
(atom == context->names().get ||
atom == context->names().set))
{
op = atom == context->names().get ? JSOP_INITPROP_GETTER
: JSOP_INITPROP_SETTER;
} else {
propname = handler.newObjectLiteralPropertyName(atom, pos());
if (!propname)
return null();
break;
}
// We have parsed |get| or |set|. Look for an accessor property
// name next.
TokenKind tt;
if (!tokenStream.getToken(&tt, TokenStream::KeywordIsName))
return null();
if (tt == TOK_NAME) {
atom = tokenStream.currentName();
propname = handler.newObjectLiteralPropertyName(atom, pos());
if (!propname)
return null();
} else if (tt == TOK_STRING) {
atom = tokenStream.currentToken().atom();
uint32_t index;
if (atom->isIndex(&index)) {
propname = handler.newNumber(index, NoDecimal, pos());
if (!propname)
return null();
atom = DoubleToAtom(context, index);
if (!atom)
return null();
} else {
propname = stringLiteral();
if (!propname)
return null();
}
} else if (tt == TOK_NUMBER) {
atom = DoubleToAtom(context, tokenStream.currentToken().number());
if (!atom)
return null();
propname = newNumber(tokenStream.currentToken());
if (!propname)
return null();
} else if (tt == TOK_LB) {
propname = computedPropertyName(literal);
if (!propname)
return null();
} else {
// Not an accessor property after all.
tokenStream.ungetToken();
propname = handler.newObjectLiteralPropertyName(atom, pos());
if (!propname)
return null();
op = JSOP_INITPROP;
break;
}
MOZ_ASSERT(op == JSOP_INITPROP_GETTER || op == JSOP_INITPROP_SETTER);
break;
}
case TOK_STRING: {
atom = tokenStream.currentToken().atom();
uint32_t index;
if (atom->isIndex(&index)) {
propname = handler.newNumber(index, NoDecimal, pos());
if (!propname)
return null();
} else {
propname = stringLiteral();
if (!propname)
return null();
}
break;
}
default:
report(ParseError, false, null(), JSMSG_BAD_PROP_ID);
return null();
}
if (op == JSOP_INITPROP) {
TokenKind tt;
if (!tokenStream.getToken(&tt))
return null();
if (tt == TOK_COLON) {
if (isGenerator) {
report(ParseError, false, null(), JSMSG_BAD_PROP_ID);
return null();
}
Node propexpr = assignExpr();
if (!propexpr)
return null();
if (foldConstants && !FoldConstants(context, &propexpr, this))
return null();
if (atom == context->names().proto) {
if (seenPrototypeMutation) {
report(ParseError, false, propname, JSMSG_DUPLICATE_PROPERTY, "__proto__");
return null();
}
seenPrototypeMutation = true;
// Note: this occurs *only* if we observe TOK_COLON! Only
// __proto__: v mutates [[Prototype]]. Getters, setters,
// method/generator definitions, computed property name
// versions of all of these, and shorthands do not.
uint32_t begin = handler.getPosition(propname).begin;
if (!handler.addPrototypeMutation(literal, begin, propexpr))
return null();
} else {
if (!handler.isConstant(propexpr))
handler.setListFlag(literal, PNX_NONCONST);
if (!handler.addPropertyDefinition(literal, propname, propexpr))
return null();
}
} else if (ltok == TOK_NAME && (tt == TOK_COMMA || tt == TOK_RC)) {
/*
* Support, e.g., |var {x, y} = o| as destructuring shorthand
* for |var {x: x, y: y} = o|, per proposed JS2/ES4 for JS1.8.
*/
if (isGenerator) {
report(ParseError, false, null(), JSMSG_BAD_PROP_ID);
return null();
}
tokenStream.ungetToken();
if (!tokenStream.checkForKeyword(atom, nullptr))
return null();
Node nameExpr = identifierName();
if (!nameExpr)
return null();
if (!handler.addShorthand(literal, propname, nameExpr))
return null();
} else if (tt == TOK_LP) {
tokenStream.ungetToken();
if (!methodDefinition(literal, propname, Normal, Method,
isGenerator ? StarGenerator : NotGenerator, op)) {
return null();
}
} else {
report(ParseError, false, null(), JSMSG_COLON_AFTER_ID);
return null();
}
} else {
/* NB: Getter function in { get x(){} } is unnamed. */
if (!methodDefinition(literal, propname, op == JSOP_INITPROP_GETTER ? Getter : Setter,
Expression, NotGenerator, op)) {
return null();
}
}
TokenKind tt;
if (!tokenStream.getToken(&tt))
return null();
if (tt == TOK_RC)
break;
if (tt != TOK_COMMA) {
report(ParseError, false, null(), JSMSG_CURLY_AFTER_LIST);
return null();
}
}
handler.setEndPosition(literal, pos().end);
return literal;
}
template <typename ParseHandler>
bool
Parser<ParseHandler>::methodDefinition(Node literal, Node propname, FunctionType type,
FunctionSyntaxKind kind, GeneratorKind generatorKind,
JSOp op)
{
RootedPropertyName funName(context);
if (kind == Method && tokenStream.isCurrentTokenType(TOK_NAME))
funName = tokenStream.currentName();
else
funName = nullptr;
Node fn = functionDef(funName, type, kind, generatorKind);
if (!fn)
return false;
if (!handler.addMethodDefinition(literal, propname, fn, op))
return false;
return true;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::primaryExpr(TokenKind tt, InvokedPrediction invoked)
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(tt));
JS_CHECK_RECURSION(context, return null());
switch (tt) {
case TOK_FUNCTION:
return functionExpr(invoked);
case TOK_LB:
return arrayInitializer();
case TOK_LC:
return objectLiteral();
case TOK_LET:
return deprecatedLetBlockOrExpression(LetExpression);
case TOK_LP: {
TokenKind next;
if (!tokenStream.peekToken(&next, TokenStream::Operand))
return null();
if (next != TOK_RP)
return parenExprOrGeneratorComprehension();
// Not valid expression syntax, but this is valid in an arrow function
// with no params: `() => body`.
tokenStream.consumeKnownToken(next);
if (!tokenStream.peekToken(&next))
return null();
if (next != TOK_ARROW) {
report(ParseError, false, null(), JSMSG_UNEXPECTED_TOKEN,
"expression", TokenKindToDesc(TOK_RP));
return null();
}
// Now just return something that will allow parsing to continue.
// It doesn't matter what; when we reach the =>, we will rewind and
// reparse the whole arrow function. See Parser::assignExpr.
return handler.newNullLiteral(pos());
}
case TOK_TEMPLATE_HEAD:
return templateLiteral();
case TOK_NO_SUBS_TEMPLATE:
return noSubstitutionTemplate();
case TOK_STRING:
return stringLiteral();
case TOK_YIELD:
if (!checkYieldNameValidity())
return null();
// Fall through.
case TOK_NAME:
return identifierName();
case TOK_REGEXP:
return newRegExp();
case TOK_NUMBER:
return newNumber(tokenStream.currentToken());
case TOK_TRUE:
return handler.newBooleanLiteral(true, pos());
case TOK_FALSE:
return handler.newBooleanLiteral(false, pos());
case TOK_THIS:
if (pc->sc->isFunctionBox())
pc->sc->asFunctionBox()->usesThis = true;
return handler.newThisLiteral(pos());
case TOK_NULL:
return handler.newNullLiteral(pos());
case TOK_TRIPLEDOT: {
TokenKind next;
// This isn't valid expression syntax, but it's valid in an arrow
// function as a trailing rest param: `(a, b, ...rest) => body`. Check
// for a name, closing parenthesis, and arrow, and allow it only if all
// are present.
if (!tokenStream.getToken(&next))
return null();
if (next != TOK_NAME) {
report(ParseError, false, null(), JSMSG_UNEXPECTED_TOKEN,
"rest argument name", TokenKindToDesc(next));
return null();
}
if (!tokenStream.getToken(&next))
return null();
if (next != TOK_RP) {
report(ParseError, false, null(), JSMSG_UNEXPECTED_TOKEN,
"closing parenthesis", TokenKindToDesc(next));
return null();
}
if (!tokenStream.peekToken(&next))
return null();
if (next != TOK_ARROW) {
report(ParseError, false, null(), JSMSG_UNEXPECTED_TOKEN,
"'=>' after argument list", TokenKindToDesc(next));
return null();
}
tokenStream.ungetToken(); // put back right paren
// Return an arbitrary expression node. See case TOK_RP above.
return handler.newNullLiteral(pos());
}
default:
report(ParseError, false, null(), JSMSG_UNEXPECTED_TOKEN,
"expression", TokenKindToDesc(tt));
return null();
}
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::parenExprOrGeneratorComprehension()
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_LP));
uint32_t begin = pos().begin;
uint32_t startYieldOffset = pc->lastYieldOffset;
bool matched;
if (!tokenStream.matchToken(&matched, TOK_FOR, TokenStream::Operand))
return null();
if (matched)
return generatorComprehension(begin);
/*
* Always accept the 'in' operator in a parenthesized expression,
* where it's unambiguous, even if we might be parsing the init of a
* for statement.
*/
bool oldParsingForInit = pc->parsingForInit;
pc->parsingForInit = false;
Node pn = expr(PredictInvoked);
pc->parsingForInit = oldParsingForInit;
if (!pn)
return null();
#if JS_HAS_GENERATOR_EXPRS
if (!tokenStream.matchToken(&matched, TOK_FOR))
return null();
if (matched) {
if (pc->lastYieldOffset != startYieldOffset) {
reportWithOffset(ParseError, false, pc->lastYieldOffset,
JSMSG_BAD_GENEXP_BODY, js_yield_str);
return null();
}
if (handler.isUnparenthesizedCommaExpression(pn)) {
report(ParseError, false, null(),
JSMSG_BAD_GENERATOR_SYNTAX, js_generator_str);
return null();
}
pn = legacyGeneratorExpr(pn);
if (!pn)
return null();
handler.setBeginPosition(pn, begin);
TokenKind tt;
if (!tokenStream.getToken(&tt))
return null();
if (tt != TOK_RP) {
report(ParseError, false, null(),
JSMSG_BAD_GENERATOR_SYNTAX, js_generator_str);
return null();
}
handler.setEndPosition(pn, pos().end);
return handler.parenthesize(pn);
}
#endif /* JS_HAS_GENERATOR_EXPRS */
pn = handler.parenthesize(pn);
MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_IN_PAREN);
return pn;
}
// Legacy generator comprehensions can sometimes appear without parentheses.
// For example:
//
// foo(x for (x in bar))
//
// In this case the parens are part of the call, and not part of the generator
// comprehension. This can happen in these contexts:
//
// if (_)
// while (_) {}
// do {} while (_)
// switch (_) {}
// with (_) {}
// foo(_) // must be first and only argument
//
// This is not the case for ES6 generator comprehensions; they must always be in
// parentheses.
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::exprInParens()
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_LP));
uint32_t begin = pos().begin;
uint32_t startYieldOffset = pc->lastYieldOffset;
/*
* Always accept the 'in' operator in a parenthesized expression,
* where it's unambiguous, even if we might be parsing the init of a
* for statement.
*/
bool oldParsingForInit = pc->parsingForInit;
pc->parsingForInit = false;
Node pn = expr(PredictInvoked);
pc->parsingForInit = oldParsingForInit;
if (!pn)
return null();
#if JS_HAS_GENERATOR_EXPRS
bool matched;
if (!tokenStream.matchToken(&matched, TOK_FOR))
return null();
if (matched) {
if (pc->lastYieldOffset != startYieldOffset) {
reportWithOffset(ParseError, false, pc->lastYieldOffset,
JSMSG_BAD_GENEXP_BODY, js_yield_str);
return null();
}
if (handler.isUnparenthesizedCommaExpression(pn)) {
report(ParseError, false, null(),
JSMSG_BAD_GENERATOR_SYNTAX, js_generator_str);
return null();
}
pn = legacyGeneratorExpr(pn);
if (!pn)
return null();
handler.setBeginPosition(pn, begin);
}
#endif /* JS_HAS_GENERATOR_EXPRS */
return pn;
}
template <typename ParseHandler>
void
Parser<ParseHandler>::addTelemetry(JSCompartment::DeprecatedLanguageExtension e)
{
JSContext* cx = context->maybeJSContext();
if (!cx)
return;
cx->compartment()->addTelemetry(getFilename(), e);
}
template class Parser<FullParseHandler>;
template class Parser<SyntaxParseHandler>;
} /* namespace frontend */
} /* namespace js */
```
|
John William Loudon (born August 14, 1967) is a former Republican member of the Missouri Senate for the 7th District from 2000 until 2008 and a member of the Missouri House of Representatives from 1995 through 2000. He is the chairman of Florida Citizen Voters and Citizen Voters Inc, a member of Mar-a-Lago, and a former advisor to America First Policies.
Early life
Loudon was born and raised in St. Louis, one of four children of Robert and Janice Loudon. He graduated from Westminster College in Fulton, Missouri, with a Bachelor of Arts degree in 1989.
Career
Political career
Loudon served in the Missouri House of Representatives from 1994 through 1998. He was elected to the Missouri State Senate in 2000, and again in 2004. While in the Senate, Loudon founded and chaired the Senate’s Small Business, Insurance, and Industrial Relations Committee, was vice-chair of the Governmental Accountability and Fiscal Oversight Committee, and a member of the committees on education, gubernatorial appointments, and judiciary and civil and criminal Jurisprudence.
Towards the end of his career as senator, Loudon introduced an amendment to a health insurance bill that legalized the practice of midwifery in Missouri. (Missouri had previously been one of a minority of states that prohibited anyone other than registered nurses from serving as a midwife.) The Missouri State Medical Association, which represents physicians in the state, sued to block the controversial provision, arguing that it violated the state's single-subject rule for legislation. In 2008, the Missouri Supreme Court voted, 5–2, to uphold the legislation, finding that the Missouri State Medical Association lacked standing to sue.
Loudon is the chair of both Florida Citizen Voters and Citizen Voters Inc. Both organizations are working in Florida and nationally to change state constitutions to explicitly state that only citizens may vote in elections. As of July 2019, the Florida organization had raised $4.7 million and collected more than 1.5 million signatures, more than twice what was needed to place the measure on the 2020 ballot in Florida.
In May 2018, it was reported that Loudon had used inflammatory and derogatory language against women, Muslims and Democrats. He promoted conspiracy theories about President Obama's birth and religion, suggesting that Obama was a Kenyan-born Muslim.
Private sector
Missouri law limits state senators to eight years, so Loudon retired in 2008. He worked for a time for an association of nonunion contractors in California. Loudon is a former policy advisor for America First Policies, a pro-Trump organization and is a member of Mar-a-Lago. His wife, Gina Loudon, is a member of the Trump campaign's media advisory board and is a published author.
Personal life
Loudon married Gina (Gentry) Loudon in 1990. They have five children.
Loudon appeared on ABC’s Wife Swap in 2013.
References
External links
Missouri Senate - John William Loudon
Project Vote Smart - John William Loudon (MO) profile
Follow the Money - John William Loudon
2004 2000 1998 1996 Senator campaign contributions
2006 Auditor campaign contributions
1967 births
Living people
Politicians from St. Louis
Politicians from San Diego
American Presbyterians
Republican Party Missouri state senators
Republican Party members of the Missouri House of Representatives
Westminster College (Missouri) alumni
20th-century American politicians
21st-century American politicians
California Republicans
|
```xml
import {
IAbstractManipulatorInitialValues,
vtkAbstractManipulator,
} from '../AbstractManipulator';
import { Vector3 } from '../../../types';
/**
*
*/
export interface ITrackballManipulatorInitialValues
extends IAbstractManipulatorInitialValues {}
export interface vtkTrackballManipulator extends vtkAbstractManipulator {
/**
*
*/
reset(callData: any): void;
}
/**
* Method use to decorate a given object (publicAPI+model) with vtkTrackballManipulator characteristics.
*
* @param publicAPI object on which methods will be bounds (public)
* @param model object on which data structure will be bounds (protected)
* @param {ITrackballManipulatorInitialValues} [initialValues] (default: {})
*/
export function extend(
publicAPI: object,
model: object,
initialValues?: ITrackballManipulatorInitialValues
): void;
/**
* Method use to create a new instance of vtkTrackballManipulator
*/
export function newInstance(
initialValues?: ITrackballManipulatorInitialValues
): vtkTrackballManipulator;
/**
*
* @param {Number} prevX
* @param {Number} prevY
* @param {Number} curX
* @param {Number} curY
* @param {Vector3} origin
* @param {Vector3} direction
* @param renderer
* @param glRenderWindow
*/
export function trackballRotate(
prevX: number,
prevY: number,
curX: number,
curY: number,
origin: Vector3,
direction: Vector3,
renderer: any,
glRenderWindow: any
): void;
/**
* vtkTrackballManipulator.
*/
export declare const vtkTrackballManipulator: {
newInstance: typeof newInstance;
extend: typeof extend;
trackballRotate: typeof trackballRotate;
};
export default vtkTrackballManipulator;
```
|
```objective-c
#ifndef _NPY_ENDIAN_H_
#define _NPY_ENDIAN_H_
/*
* NPY_BYTE_ORDER is set to the same value as BYTE_ORDER set by glibc in
* endian.h
*/
#if defined(NPY_HAVE_ENDIAN_H) || defined(NPY_HAVE_SYS_ENDIAN_H)
/* Use endian.h if available */
#if defined(NPY_HAVE_ENDIAN_H)
#include <endian.h>
#elif defined(NPY_HAVE_SYS_ENDIAN_H)
#include <sys/endian.h>
#endif
#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && defined(LITTLE_ENDIAN)
#define NPY_BYTE_ORDER BYTE_ORDER
#define NPY_LITTLE_ENDIAN LITTLE_ENDIAN
#define NPY_BIG_ENDIAN BIG_ENDIAN
#elif defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN)
#define NPY_BYTE_ORDER _BYTE_ORDER
#define NPY_LITTLE_ENDIAN _LITTLE_ENDIAN
#define NPY_BIG_ENDIAN _BIG_ENDIAN
#elif defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN)
#define NPY_BYTE_ORDER __BYTE_ORDER
#define NPY_LITTLE_ENDIAN __LITTLE_ENDIAN
#define NPY_BIG_ENDIAN __BIG_ENDIAN
#endif
#endif
#ifndef NPY_BYTE_ORDER
/* Set endianness info using target CPU */
#include "npy_cpu.h"
#define NPY_LITTLE_ENDIAN 1234
#define NPY_BIG_ENDIAN 4321
#if defined(NPY_CPU_X86) \
|| defined(NPY_CPU_AMD64) \
|| defined(NPY_CPU_IA64) \
|| defined(NPY_CPU_ALPHA) \
|| defined(NPY_CPU_ARMEL) \
|| defined(NPY_CPU_AARCH64) \
|| defined(NPY_CPU_SH_LE) \
|| defined(NPY_CPU_MIPSEL) \
|| defined(NPY_CPU_PPC64LE) \
|| defined(NPY_CPU_ARCEL)
#define NPY_BYTE_ORDER NPY_LITTLE_ENDIAN
#elif defined(NPY_CPU_PPC) \
|| defined(NPY_CPU_SPARC) \
|| defined(NPY_CPU_S390) \
|| defined(NPY_CPU_HPPA) \
|| defined(NPY_CPU_PPC64) \
|| defined(NPY_CPU_ARMEB) \
|| defined(NPY_CPU_SH_BE) \
|| defined(NPY_CPU_MIPSEB) \
|| defined(NPY_CPU_OR1K) \
|| defined(NPY_CPU_M68K) \
|| defined(NPY_CPU_ARCEB)
#define NPY_BYTE_ORDER NPY_BIG_ENDIAN
#else
#error Unknown CPU: can not set endianness
#endif
#endif
#endif
```
|
```c++
//==- WebAssemblyAsmParser.cpp - Assembler for WebAssembly -*- C++ -*-==//
//
// See path_to_url for license information.
//
//===your_sha256_hash------===//
///
/// \file
/// This file is part of the WebAssembly Assembler.
///
/// It contains code to translate a parsed .s file into MCInsts.
///
//===your_sha256_hash------===//
#include "AsmParser/WebAssemblyAsmTypeCheck.h"
#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
#include "MCTargetDesc/WebAssemblyTargetStreamer.h"
#include "TargetInfo/WebAssemblyTargetInfo.h"
#include "Utils/WebAssemblyTypeUtilities.h"
#include "Utils/WebAssemblyUtilities.h"
#include "WebAssembly.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCParser/MCAsmLexer.h"
#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
#include "llvm/MC/MCParser/MCTargetAsmParser.h"
#include "llvm/MC/MCSectionWasm.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCSymbolWasm.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/SourceMgr.h"
using namespace llvm;
#define DEBUG_TYPE "wasm-asm-parser"
static const char *getSubtargetFeatureName(uint64_t Val);
namespace {
/// WebAssemblyOperand - Instances of this class represent the operands in a
/// parsed Wasm machine instruction.
struct WebAssemblyOperand : public MCParsedAsmOperand {
enum KindTy { Token, Integer, Float, Symbol, BrList } Kind;
SMLoc StartLoc, EndLoc;
struct TokOp {
StringRef Tok;
};
struct IntOp {
int64_t Val;
};
struct FltOp {
double Val;
};
struct SymOp {
const MCExpr *Exp;
};
struct BrLOp {
std::vector<unsigned> List;
};
union {
struct TokOp Tok;
struct IntOp Int;
struct FltOp Flt;
struct SymOp Sym;
struct BrLOp BrL;
};
WebAssemblyOperand(KindTy K, SMLoc Start, SMLoc End, TokOp T)
: Kind(K), StartLoc(Start), EndLoc(End), Tok(T) {}
WebAssemblyOperand(KindTy K, SMLoc Start, SMLoc End, IntOp I)
: Kind(K), StartLoc(Start), EndLoc(End), Int(I) {}
WebAssemblyOperand(KindTy K, SMLoc Start, SMLoc End, FltOp F)
: Kind(K), StartLoc(Start), EndLoc(End), Flt(F) {}
WebAssemblyOperand(KindTy K, SMLoc Start, SMLoc End, SymOp S)
: Kind(K), StartLoc(Start), EndLoc(End), Sym(S) {}
WebAssemblyOperand(KindTy K, SMLoc Start, SMLoc End)
: Kind(K), StartLoc(Start), EndLoc(End), BrL() {}
~WebAssemblyOperand() {
if (isBrList())
BrL.~BrLOp();
}
bool isToken() const override { return Kind == Token; }
bool isImm() const override { return Kind == Integer || Kind == Symbol; }
bool isFPImm() const { return Kind == Float; }
bool isMem() const override { return false; }
bool isReg() const override { return false; }
bool isBrList() const { return Kind == BrList; }
unsigned getReg() const override {
llvm_unreachable("Assembly inspects a register operand");
return 0;
}
StringRef getToken() const {
assert(isToken());
return Tok.Tok;
}
SMLoc getStartLoc() const override { return StartLoc; }
SMLoc getEndLoc() const override { return EndLoc; }
void addRegOperands(MCInst &, unsigned) const {
// Required by the assembly matcher.
llvm_unreachable("Assembly matcher creates register operands");
}
void addImmOperands(MCInst &Inst, unsigned N) const {
assert(N == 1 && "Invalid number of operands!");
if (Kind == Integer)
Inst.addOperand(MCOperand::createImm(Int.Val));
else if (Kind == Symbol)
Inst.addOperand(MCOperand::createExpr(Sym.Exp));
else
llvm_unreachable("Should be integer immediate or symbol!");
}
void addFPImmf32Operands(MCInst &Inst, unsigned N) const {
assert(N == 1 && "Invalid number of operands!");
if (Kind == Float)
Inst.addOperand(
MCOperand::createSFPImm(bit_cast<uint32_t>(float(Flt.Val))));
else
llvm_unreachable("Should be float immediate!");
}
void addFPImmf64Operands(MCInst &Inst, unsigned N) const {
assert(N == 1 && "Invalid number of operands!");
if (Kind == Float)
Inst.addOperand(MCOperand::createDFPImm(bit_cast<uint64_t>(Flt.Val)));
else
llvm_unreachable("Should be float immediate!");
}
void addBrListOperands(MCInst &Inst, unsigned N) const {
assert(N == 1 && isBrList() && "Invalid BrList!");
for (auto Br : BrL.List)
Inst.addOperand(MCOperand::createImm(Br));
}
void print(raw_ostream &OS) const override {
switch (Kind) {
case Token:
OS << "Tok:" << Tok.Tok;
break;
case Integer:
OS << "Int:" << Int.Val;
break;
case Float:
OS << "Flt:" << Flt.Val;
break;
case Symbol:
OS << "Sym:" << Sym.Exp;
break;
case BrList:
OS << "BrList:" << BrL.List.size();
break;
}
}
};
// Perhaps this should go somewhere common.
static wasm::WasmLimits DefaultLimits() {
return {wasm::WASM_LIMITS_FLAG_NONE, 0, 0};
}
static MCSymbolWasm *GetOrCreateFunctionTableSymbol(MCContext &Ctx,
const StringRef &Name) {
MCSymbolWasm *Sym = cast_or_null<MCSymbolWasm>(Ctx.lookupSymbol(Name));
if (Sym) {
if (!Sym->isFunctionTable())
Ctx.reportError(SMLoc(), "symbol is not a wasm funcref table");
} else {
Sym = cast<MCSymbolWasm>(Ctx.getOrCreateSymbol(Name));
Sym->setFunctionTable();
// The default function table is synthesized by the linker.
Sym->setUndefined();
}
return Sym;
}
class WebAssemblyAsmParser final : public MCTargetAsmParser {
MCAsmParser &Parser;
MCAsmLexer &Lexer;
// Much like WebAssemblyAsmPrinter in the backend, we have to own these.
std::vector<std::unique_ptr<wasm::WasmSignature>> Signatures;
std::vector<std::unique_ptr<std::string>> Names;
// Order of labels, directives and instructions in a .s file have no
// syntactical enforcement. This class is a callback from the actual parser,
// and yet we have to be feeding data to the streamer in a very particular
// order to ensure a correct binary encoding that matches the regular backend
// (the streamer does not enforce this). This "state machine" enum helps
// guarantee that correct order.
enum ParserState {
FileStart,
FunctionLabel,
FunctionStart,
FunctionLocals,
Instructions,
EndFunction,
DataSection,
} CurrentState = FileStart;
// For ensuring blocks are properly nested.
enum NestingType {
Function,
Block,
Loop,
Try,
CatchAll,
If,
Else,
Undefined,
};
struct Nested {
NestingType NT;
wasm::WasmSignature Sig;
};
std::vector<Nested> NestingStack;
MCSymbolWasm *DefaultFunctionTable = nullptr;
MCSymbol *LastFunctionLabel = nullptr;
bool is64;
WebAssemblyAsmTypeCheck TC;
// Don't type check if -no-type-check was set.
bool SkipTypeCheck;
public:
WebAssemblyAsmParser(const MCSubtargetInfo &STI, MCAsmParser &Parser,
const MCInstrInfo &MII, const MCTargetOptions &Options)
: MCTargetAsmParser(Options, STI, MII), Parser(Parser),
Lexer(Parser.getLexer()),
is64(STI.getTargetTriple().isArch64Bit()),
TC(Parser, MII, is64), SkipTypeCheck(Options.MCNoTypeCheck) {
setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits()));
// Don't type check if this is inline asm, since that is a naked sequence of
// instructions without a function/locals decl.
auto &SM = Parser.getSourceManager();
auto BufferName =
SM.getBufferInfo(SM.getMainFileID()).Buffer->getBufferIdentifier();
if (BufferName == "<inline asm>")
SkipTypeCheck = true;
}
void Initialize(MCAsmParser &Parser) override {
MCAsmParserExtension::Initialize(Parser);
DefaultFunctionTable = GetOrCreateFunctionTableSymbol(
getContext(), "__indirect_function_table");
if (!STI->checkFeatures("+reference-types"))
DefaultFunctionTable->setOmitFromLinkingSection();
}
#define GET_ASSEMBLER_HEADER
#include "WebAssemblyGenAsmMatcher.inc"
// TODO: This is required to be implemented, but appears unused.
bool parseRegister(MCRegister & /*RegNo*/, SMLoc & /*StartLoc*/,
SMLoc & /*EndLoc*/) override {
llvm_unreachable("parseRegister is not implemented.");
}
OperandMatchResultTy tryParseRegister(MCRegister & /*RegNo*/,
SMLoc & /*StartLoc*/,
SMLoc & /*EndLoc*/) override {
llvm_unreachable("tryParseRegister is not implemented.");
}
bool error(const Twine &Msg, const AsmToken &Tok) {
return Parser.Error(Tok.getLoc(), Msg + Tok.getString());
}
bool error(const Twine &Msg, SMLoc Loc = SMLoc()) {
return Parser.Error(Loc.isValid() ? Loc : Lexer.getTok().getLoc(), Msg);
}
void addSignature(std::unique_ptr<wasm::WasmSignature> &&Sig) {
Signatures.push_back(std::move(Sig));
}
StringRef storeName(StringRef Name) {
std::unique_ptr<std::string> N = std::make_unique<std::string>(Name);
Names.push_back(std::move(N));
return *Names.back();
}
std::pair<StringRef, StringRef> nestingString(NestingType NT) {
switch (NT) {
case Function:
return {"function", "end_function"};
case Block:
return {"block", "end_block"};
case Loop:
return {"loop", "end_loop"};
case Try:
return {"try", "end_try/delegate"};
case CatchAll:
return {"catch_all", "end_try"};
case If:
return {"if", "end_if"};
case Else:
return {"else", "end_if"};
default:
llvm_unreachable("unknown NestingType");
}
}
void push(NestingType NT) { NestingStack.push_back({NT, wasm::WasmSignature()}); }
bool pop(StringRef Ins, NestingType NT1, NestingType NT2 = Undefined) {
if (NestingStack.empty())
return error(Twine("End of block construct with no start: ") + Ins);
auto Top = NestingStack.back();
if (Top.NT != NT1 && Top.NT != NT2)
return error(Twine("Block construct type mismatch, expected: ") +
nestingString(Top.NT).second + ", instead got: " + Ins);
TC.setLastSig(Top.Sig);
NestingStack.pop_back();
return false;
}
bool ensureEmptyNestingStack(SMLoc Loc = SMLoc()) {
auto Err = !NestingStack.empty();
while (!NestingStack.empty()) {
error(Twine("Unmatched block construct(s) at function end: ") +
nestingString(NestingStack.back().NT).first,
Loc);
NestingStack.pop_back();
}
return Err;
}
bool isNext(AsmToken::TokenKind Kind) {
auto Ok = Lexer.is(Kind);
if (Ok)
Parser.Lex();
return Ok;
}
bool expect(AsmToken::TokenKind Kind, const char *KindName) {
if (!isNext(Kind))
return error(std::string("Expected ") + KindName + ", instead got: ",
Lexer.getTok());
return false;
}
StringRef expectIdent() {
if (!Lexer.is(AsmToken::Identifier)) {
error("Expected identifier, got: ", Lexer.getTok());
return StringRef();
}
auto Name = Lexer.getTok().getString();
Parser.Lex();
return Name;
}
bool parseRegTypeList(SmallVectorImpl<wasm::ValType> &Types) {
while (Lexer.is(AsmToken::Identifier)) {
auto Type = WebAssembly::parseType(Lexer.getTok().getString());
if (!Type)
return error("unknown type: ", Lexer.getTok());
Types.push_back(*Type);
Parser.Lex();
if (!isNext(AsmToken::Comma))
break;
}
return false;
}
void parseSingleInteger(bool IsNegative, OperandVector &Operands) {
auto &Int = Lexer.getTok();
int64_t Val = Int.getIntVal();
if (IsNegative)
Val = -Val;
Operands.push_back(std::make_unique<WebAssemblyOperand>(
WebAssemblyOperand::Integer, Int.getLoc(), Int.getEndLoc(),
WebAssemblyOperand::IntOp{Val}));
Parser.Lex();
}
bool parseSingleFloat(bool IsNegative, OperandVector &Operands) {
auto &Flt = Lexer.getTok();
double Val;
if (Flt.getString().getAsDouble(Val, false))
return error("Cannot parse real: ", Flt);
if (IsNegative)
Val = -Val;
Operands.push_back(std::make_unique<WebAssemblyOperand>(
WebAssemblyOperand::Float, Flt.getLoc(), Flt.getEndLoc(),
WebAssemblyOperand::FltOp{Val}));
Parser.Lex();
return false;
}
bool parseSpecialFloatMaybe(bool IsNegative, OperandVector &Operands) {
if (Lexer.isNot(AsmToken::Identifier))
return true;
auto &Flt = Lexer.getTok();
auto S = Flt.getString();
double Val;
if (S.compare_insensitive("infinity") == 0) {
Val = std::numeric_limits<double>::infinity();
} else if (S.compare_insensitive("nan") == 0) {
Val = std::numeric_limits<double>::quiet_NaN();
} else {
return true;
}
if (IsNegative)
Val = -Val;
Operands.push_back(std::make_unique<WebAssemblyOperand>(
WebAssemblyOperand::Float, Flt.getLoc(), Flt.getEndLoc(),
WebAssemblyOperand::FltOp{Val}));
Parser.Lex();
return false;
}
bool checkForP2AlignIfLoadStore(OperandVector &Operands, StringRef InstName) {
// FIXME: there is probably a cleaner way to do this.
auto IsLoadStore = InstName.contains(".load") ||
InstName.contains(".store") ||
InstName.contains("prefetch");
auto IsAtomic = InstName.contains("atomic.");
if (IsLoadStore || IsAtomic) {
// Parse load/store operands of the form: offset:p2align=align
if (IsLoadStore && isNext(AsmToken::Colon)) {
auto Id = expectIdent();
if (Id != "p2align")
return error("Expected p2align, instead got: " + Id);
if (expect(AsmToken::Equal, "="))
return true;
if (!Lexer.is(AsmToken::Integer))
return error("Expected integer constant");
parseSingleInteger(false, Operands);
} else {
// v128.{load,store}{8,16,32,64}_lane has both a memarg and a lane
// index. We need to avoid parsing an extra alignment operand for the
// lane index.
auto IsLoadStoreLane = InstName.contains("_lane");
if (IsLoadStoreLane && Operands.size() == 4)
return false;
// Alignment not specified (or atomics, must use default alignment).
// We can't just call WebAssembly::GetDefaultP2Align since we don't have
// an opcode until after the assembly matcher, so set a default to fix
// up later.
auto Tok = Lexer.getTok();
Operands.push_back(std::make_unique<WebAssemblyOperand>(
WebAssemblyOperand::Integer, Tok.getLoc(), Tok.getEndLoc(),
WebAssemblyOperand::IntOp{-1}));
}
}
return false;
}
void addBlockTypeOperand(OperandVector &Operands, SMLoc NameLoc,
WebAssembly::BlockType BT) {
if (BT != WebAssembly::BlockType::Void) {
wasm::WasmSignature Sig({static_cast<wasm::ValType>(BT)}, {});
TC.setLastSig(Sig);
NestingStack.back().Sig = Sig;
}
Operands.push_back(std::make_unique<WebAssemblyOperand>(
WebAssemblyOperand::Integer, NameLoc, NameLoc,
WebAssemblyOperand::IntOp{static_cast<int64_t>(BT)}));
}
bool parseLimits(wasm::WasmLimits *Limits) {
auto Tok = Lexer.getTok();
if (!Tok.is(AsmToken::Integer))
return error("Expected integer constant, instead got: ", Tok);
int64_t Val = Tok.getIntVal();
assert(Val >= 0);
Limits->Minimum = Val;
Parser.Lex();
if (isNext(AsmToken::Comma)) {
Limits->Flags |= wasm::WASM_LIMITS_FLAG_HAS_MAX;
auto Tok = Lexer.getTok();
if (!Tok.is(AsmToken::Integer))
return error("Expected integer constant, instead got: ", Tok);
int64_t Val = Tok.getIntVal();
assert(Val >= 0);
Limits->Maximum = Val;
Parser.Lex();
}
return false;
}
bool parseFunctionTableOperand(std::unique_ptr<WebAssemblyOperand> *Op) {
if (STI->checkFeatures("+reference-types")) {
// If the reference-types feature is enabled, there is an explicit table
// operand. To allow the same assembly to be compiled with or without
// reference types, we allow the operand to be omitted, in which case we
// default to __indirect_function_table.
auto &Tok = Lexer.getTok();
if (Tok.is(AsmToken::Identifier)) {
auto *Sym =
GetOrCreateFunctionTableSymbol(getContext(), Tok.getString());
const auto *Val = MCSymbolRefExpr::create(Sym, getContext());
*Op = std::make_unique<WebAssemblyOperand>(
WebAssemblyOperand::Symbol, Tok.getLoc(), Tok.getEndLoc(),
WebAssemblyOperand::SymOp{Val});
Parser.Lex();
return expect(AsmToken::Comma, ",");
} else {
const auto *Val =
MCSymbolRefExpr::create(DefaultFunctionTable, getContext());
*Op = std::make_unique<WebAssemblyOperand>(
WebAssemblyOperand::Symbol, SMLoc(), SMLoc(),
WebAssemblyOperand::SymOp{Val});
return false;
}
} else {
// For the MVP there is at most one table whose number is 0, but we can't
// write a table symbol or issue relocations. Instead we just ensure the
// table is live and write a zero.
getStreamer().emitSymbolAttribute(DefaultFunctionTable, MCSA_NoDeadStrip);
*Op = std::make_unique<WebAssemblyOperand>(WebAssemblyOperand::Integer,
SMLoc(), SMLoc(),
WebAssemblyOperand::IntOp{0});
return false;
}
}
bool ParseInstruction(ParseInstructionInfo & /*Info*/, StringRef Name,
SMLoc NameLoc, OperandVector &Operands) override {
// Note: Name does NOT point into the sourcecode, but to a local, so
// use NameLoc instead.
Name = StringRef(NameLoc.getPointer(), Name.size());
// WebAssembly has instructions with / in them, which AsmLexer parses
// as separate tokens, so if we find such tokens immediately adjacent (no
// whitespace), expand the name to include them:
for (;;) {
auto &Sep = Lexer.getTok();
if (Sep.getLoc().getPointer() != Name.end() ||
Sep.getKind() != AsmToken::Slash)
break;
// Extend name with /
Name = StringRef(Name.begin(), Name.size() + Sep.getString().size());
Parser.Lex();
// We must now find another identifier, or error.
auto &Id = Lexer.getTok();
if (Id.getKind() != AsmToken::Identifier ||
Id.getLoc().getPointer() != Name.end())
return error("Incomplete instruction name: ", Id);
Name = StringRef(Name.begin(), Name.size() + Id.getString().size());
Parser.Lex();
}
// Now construct the name as first operand.
Operands.push_back(std::make_unique<WebAssemblyOperand>(
WebAssemblyOperand::Token, NameLoc, SMLoc::getFromPointer(Name.end()),
WebAssemblyOperand::TokOp{Name}));
// If this instruction is part of a control flow structure, ensure
// proper nesting.
bool ExpectBlockType = false;
bool ExpectFuncType = false;
std::unique_ptr<WebAssemblyOperand> FunctionTable;
if (Name == "block") {
push(Block);
ExpectBlockType = true;
} else if (Name == "loop") {
push(Loop);
ExpectBlockType = true;
} else if (Name == "try") {
push(Try);
ExpectBlockType = true;
} else if (Name == "if") {
push(If);
ExpectBlockType = true;
} else if (Name == "else") {
if (pop(Name, If))
return true;
push(Else);
} else if (Name == "catch") {
if (pop(Name, Try))
return true;
push(Try);
} else if (Name == "catch_all") {
if (pop(Name, Try))
return true;
push(CatchAll);
} else if (Name == "end_if") {
if (pop(Name, If, Else))
return true;
} else if (Name == "end_try") {
if (pop(Name, Try, CatchAll))
return true;
} else if (Name == "delegate") {
if (pop(Name, Try))
return true;
} else if (Name == "end_loop") {
if (pop(Name, Loop))
return true;
} else if (Name == "end_block") {
if (pop(Name, Block))
return true;
} else if (Name == "end_function") {
ensureLocals(getStreamer());
CurrentState = EndFunction;
if (pop(Name, Function) || ensureEmptyNestingStack())
return true;
} else if (Name == "call_indirect" || Name == "return_call_indirect") {
// These instructions have differing operand orders in the text format vs
// the binary formats. The MC instructions follow the binary format, so
// here we stash away the operand and append it later.
if (parseFunctionTableOperand(&FunctionTable))
return true;
ExpectFuncType = true;
}
if (ExpectFuncType || (ExpectBlockType && Lexer.is(AsmToken::LParen))) {
// This has a special TYPEINDEX operand which in text we
// represent as a signature, such that we can re-build this signature,
// attach it to an anonymous symbol, which is what WasmObjectWriter
// expects to be able to recreate the actual unique-ified type indices.
auto Loc = Parser.getTok();
auto Signature = std::make_unique<wasm::WasmSignature>();
if (parseSignature(Signature.get()))
return true;
// Got signature as block type, don't need more
ExpectBlockType = false;
TC.setLastSig(*Signature.get());
if (ExpectBlockType)
NestingStack.back().Sig = *Signature.get();
auto &Ctx = getContext();
// The "true" here will cause this to be a nameless symbol.
MCSymbol *Sym = Ctx.createTempSymbol("typeindex", true);
auto *WasmSym = cast<MCSymbolWasm>(Sym);
WasmSym->setSignature(Signature.get());
addSignature(std::move(Signature));
WasmSym->setType(wasm::WASM_SYMBOL_TYPE_FUNCTION);
const MCExpr *Expr = MCSymbolRefExpr::create(
WasmSym, MCSymbolRefExpr::VK_WASM_TYPEINDEX, Ctx);
Operands.push_back(std::make_unique<WebAssemblyOperand>(
WebAssemblyOperand::Symbol, Loc.getLoc(), Loc.getEndLoc(),
WebAssemblyOperand::SymOp{Expr}));
}
while (Lexer.isNot(AsmToken::EndOfStatement)) {
auto &Tok = Lexer.getTok();
switch (Tok.getKind()) {
case AsmToken::Identifier: {
if (!parseSpecialFloatMaybe(false, Operands))
break;
auto &Id = Lexer.getTok();
if (ExpectBlockType) {
// Assume this identifier is a block_type.
auto BT = WebAssembly::parseBlockType(Id.getString());
if (BT == WebAssembly::BlockType::Invalid)
return error("Unknown block type: ", Id);
addBlockTypeOperand(Operands, NameLoc, BT);
Parser.Lex();
} else {
// Assume this identifier is a label.
const MCExpr *Val;
SMLoc Start = Id.getLoc();
SMLoc End;
if (Parser.parseExpression(Val, End))
return error("Cannot parse symbol: ", Lexer.getTok());
Operands.push_back(std::make_unique<WebAssemblyOperand>(
WebAssemblyOperand::Symbol, Start, End,
WebAssemblyOperand::SymOp{Val}));
if (checkForP2AlignIfLoadStore(Operands, Name))
return true;
}
break;
}
case AsmToken::Minus:
Parser.Lex();
if (Lexer.is(AsmToken::Integer)) {
parseSingleInteger(true, Operands);
if (checkForP2AlignIfLoadStore(Operands, Name))
return true;
} else if(Lexer.is(AsmToken::Real)) {
if (parseSingleFloat(true, Operands))
return true;
} else if (!parseSpecialFloatMaybe(true, Operands)) {
} else {
return error("Expected numeric constant instead got: ",
Lexer.getTok());
}
break;
case AsmToken::Integer:
parseSingleInteger(false, Operands);
if (checkForP2AlignIfLoadStore(Operands, Name))
return true;
break;
case AsmToken::Real: {
if (parseSingleFloat(false, Operands))
return true;
break;
}
case AsmToken::LCurly: {
Parser.Lex();
auto Op = std::make_unique<WebAssemblyOperand>(
WebAssemblyOperand::BrList, Tok.getLoc(), Tok.getEndLoc());
if (!Lexer.is(AsmToken::RCurly))
for (;;) {
Op->BrL.List.push_back(Lexer.getTok().getIntVal());
expect(AsmToken::Integer, "integer");
if (!isNext(AsmToken::Comma))
break;
}
expect(AsmToken::RCurly, "}");
Operands.push_back(std::move(Op));
break;
}
default:
return error("Unexpected token in operand: ", Tok);
}
if (Lexer.isNot(AsmToken::EndOfStatement)) {
if (expect(AsmToken::Comma, ","))
return true;
}
}
if (ExpectBlockType && Operands.size() == 1) {
// Support blocks with no operands as default to void.
addBlockTypeOperand(Operands, NameLoc, WebAssembly::BlockType::Void);
}
if (FunctionTable)
Operands.push_back(std::move(FunctionTable));
Parser.Lex();
return false;
}
bool parseSignature(wasm::WasmSignature *Signature) {
if (expect(AsmToken::LParen, "("))
return true;
if (parseRegTypeList(Signature->Params))
return true;
if (expect(AsmToken::RParen, ")"))
return true;
if (expect(AsmToken::MinusGreater, "->"))
return true;
if (expect(AsmToken::LParen, "("))
return true;
if (parseRegTypeList(Signature->Returns))
return true;
if (expect(AsmToken::RParen, ")"))
return true;
return false;
}
bool CheckDataSection() {
if (CurrentState != DataSection) {
auto WS = cast<MCSectionWasm>(getStreamer().getCurrentSection().first);
if (WS && WS->getKind().isText())
return error("data directive must occur in a data segment: ",
Lexer.getTok());
}
CurrentState = DataSection;
return false;
}
// This function processes wasm-specific directives streamed to
// WebAssemblyTargetStreamer, all others go to the generic parser
// (see WasmAsmParser).
bool ParseDirective(AsmToken DirectiveID) override {
// This function has a really weird return value behavior that is different
// from all the other parsing functions:
// - return true && no tokens consumed -> don't know this directive / let
// the generic parser handle it.
// - return true && tokens consumed -> a parsing error occurred.
// - return false -> processed this directive successfully.
assert(DirectiveID.getKind() == AsmToken::Identifier);
auto &Out = getStreamer();
auto &TOut =
reinterpret_cast<WebAssemblyTargetStreamer &>(*Out.getTargetStreamer());
auto &Ctx = Out.getContext();
// TODO: any time we return an error, at least one token must have been
// consumed, otherwise this will not signal an error to the caller.
if (DirectiveID.getString() == ".globaltype") {
auto SymName = expectIdent();
if (SymName.empty())
return true;
if (expect(AsmToken::Comma, ","))
return true;
auto TypeTok = Lexer.getTok();
auto TypeName = expectIdent();
if (TypeName.empty())
return true;
auto Type = WebAssembly::parseType(TypeName);
if (!Type)
return error("Unknown type in .globaltype directive: ", TypeTok);
// Optional mutable modifier. Default to mutable for historical reasons.
// Ideally we would have gone with immutable as the default and used `mut`
// as the modifier to match the `.wat` format.
bool Mutable = true;
if (isNext(AsmToken::Comma)) {
TypeTok = Lexer.getTok();
auto Id = expectIdent();
if (Id == "immutable")
Mutable = false;
else
// Should we also allow `mutable` and `mut` here for clarity?
return error("Unknown type in .globaltype modifier: ", TypeTok);
}
// Now set this symbol with the correct type.
auto WasmSym = cast<MCSymbolWasm>(Ctx.getOrCreateSymbol(SymName));
WasmSym->setType(wasm::WASM_SYMBOL_TYPE_GLOBAL);
WasmSym->setGlobalType(wasm::WasmGlobalType{uint8_t(*Type), Mutable});
// And emit the directive again.
TOut.emitGlobalType(WasmSym);
return expect(AsmToken::EndOfStatement, "EOL");
}
if (DirectiveID.getString() == ".tabletype") {
// .tabletype SYM, ELEMTYPE[, MINSIZE[, MAXSIZE]]
auto SymName = expectIdent();
if (SymName.empty())
return true;
if (expect(AsmToken::Comma, ","))
return true;
auto ElemTypeTok = Lexer.getTok();
auto ElemTypeName = expectIdent();
if (ElemTypeName.empty())
return true;
std::optional<wasm::ValType> ElemType =
WebAssembly::parseType(ElemTypeName);
if (!ElemType)
return error("Unknown type in .tabletype directive: ", ElemTypeTok);
wasm::WasmLimits Limits = DefaultLimits();
if (isNext(AsmToken::Comma) && parseLimits(&Limits))
return true;
// Now that we have the name and table type, we can actually create the
// symbol
auto WasmSym = cast<MCSymbolWasm>(Ctx.getOrCreateSymbol(SymName));
WasmSym->setType(wasm::WASM_SYMBOL_TYPE_TABLE);
wasm::WasmTableType Type = {uint8_t(*ElemType), Limits};
WasmSym->setTableType(Type);
TOut.emitTableType(WasmSym);
return expect(AsmToken::EndOfStatement, "EOL");
}
if (DirectiveID.getString() == ".functype") {
// This code has to send things to the streamer similar to
// WebAssemblyAsmPrinter::EmitFunctionBodyStart.
// TODO: would be good to factor this into a common function, but the
// assembler and backend really don't share any common code, and this code
// parses the locals separately.
auto SymName = expectIdent();
if (SymName.empty())
return true;
auto WasmSym = cast<MCSymbolWasm>(Ctx.getOrCreateSymbol(SymName));
if (WasmSym->isDefined()) {
// We push 'Function' either when a label is parsed or a .functype
// directive is parsed. The reason it is not easy to do this uniformly
// in a single place is,
// 1. We can't do this at label parsing time only because there are
// cases we don't have .functype directive before a function label,
// in which case we don't know if the label is a function at the time
// of parsing.
// 2. We can't do this at .functype parsing time only because we want to
// detect a function started with a label and not ended correctly
// without encountering a .functype directive after the label.
if (CurrentState != FunctionLabel) {
// This .functype indicates a start of a function.
if (ensureEmptyNestingStack())
return true;
push(Function);
}
CurrentState = FunctionStart;
LastFunctionLabel = WasmSym;
}
auto Signature = std::make_unique<wasm::WasmSignature>();
if (parseSignature(Signature.get()))
return true;
TC.funcDecl(*Signature);
WasmSym->setSignature(Signature.get());
addSignature(std::move(Signature));
WasmSym->setType(wasm::WASM_SYMBOL_TYPE_FUNCTION);
TOut.emitFunctionType(WasmSym);
// TODO: backend also calls TOut.emitIndIdx, but that is not implemented.
return expect(AsmToken::EndOfStatement, "EOL");
}
if (DirectiveID.getString() == ".export_name") {
auto SymName = expectIdent();
if (SymName.empty())
return true;
if (expect(AsmToken::Comma, ","))
return true;
auto ExportName = expectIdent();
auto WasmSym = cast<MCSymbolWasm>(Ctx.getOrCreateSymbol(SymName));
WasmSym->setExportName(storeName(ExportName));
TOut.emitExportName(WasmSym, ExportName);
}
if (DirectiveID.getString() == ".import_module") {
auto SymName = expectIdent();
if (SymName.empty())
return true;
if (expect(AsmToken::Comma, ","))
return true;
auto ImportModule = expectIdent();
auto WasmSym = cast<MCSymbolWasm>(Ctx.getOrCreateSymbol(SymName));
WasmSym->setImportModule(storeName(ImportModule));
TOut.emitImportModule(WasmSym, ImportModule);
}
if (DirectiveID.getString() == ".import_name") {
auto SymName = expectIdent();
if (SymName.empty())
return true;
if (expect(AsmToken::Comma, ","))
return true;
auto ImportName = expectIdent();
auto WasmSym = cast<MCSymbolWasm>(Ctx.getOrCreateSymbol(SymName));
WasmSym->setImportName(storeName(ImportName));
TOut.emitImportName(WasmSym, ImportName);
}
if (DirectiveID.getString() == ".tagtype") {
auto SymName = expectIdent();
if (SymName.empty())
return true;
auto WasmSym = cast<MCSymbolWasm>(Ctx.getOrCreateSymbol(SymName));
auto Signature = std::make_unique<wasm::WasmSignature>();
if (parseRegTypeList(Signature->Params))
return true;
WasmSym->setSignature(Signature.get());
addSignature(std::move(Signature));
WasmSym->setType(wasm::WASM_SYMBOL_TYPE_TAG);
TOut.emitTagType(WasmSym);
// TODO: backend also calls TOut.emitIndIdx, but that is not implemented.
return expect(AsmToken::EndOfStatement, "EOL");
}
if (DirectiveID.getString() == ".local") {
if (CurrentState != FunctionStart)
return error(".local directive should follow the start of a function: ",
Lexer.getTok());
SmallVector<wasm::ValType, 4> Locals;
if (parseRegTypeList(Locals))
return true;
TC.localDecl(Locals);
TOut.emitLocal(Locals);
CurrentState = FunctionLocals;
return expect(AsmToken::EndOfStatement, "EOL");
}
if (DirectiveID.getString() == ".int8" ||
DirectiveID.getString() == ".int16" ||
DirectiveID.getString() == ".int32" ||
DirectiveID.getString() == ".int64") {
if (CheckDataSection()) return true;
const MCExpr *Val;
SMLoc End;
if (Parser.parseExpression(Val, End))
return error("Cannot parse .int expression: ", Lexer.getTok());
size_t NumBits = 0;
DirectiveID.getString().drop_front(4).getAsInteger(10, NumBits);
Out.emitValue(Val, NumBits / 8, End);
return expect(AsmToken::EndOfStatement, "EOL");
}
if (DirectiveID.getString() == ".asciz") {
if (CheckDataSection()) return true;
std::string S;
if (Parser.parseEscapedString(S))
return error("Cannot parse string constant: ", Lexer.getTok());
Out.emitBytes(StringRef(S.c_str(), S.length() + 1));
return expect(AsmToken::EndOfStatement, "EOL");
}
return true; // We didn't process this directive.
}
// Called either when the first instruction is parsed of the function ends.
void ensureLocals(MCStreamer &Out) {
if (CurrentState == FunctionStart) {
// We haven't seen a .local directive yet. The streamer requires locals to
// be encoded as a prelude to the instructions, so emit an empty list of
// locals here.
auto &TOut = reinterpret_cast<WebAssemblyTargetStreamer &>(
*Out.getTargetStreamer());
TOut.emitLocal(SmallVector<wasm::ValType, 0>());
CurrentState = FunctionLocals;
}
}
bool MatchAndEmitInstruction(SMLoc IDLoc, unsigned & /*Opcode*/,
OperandVector &Operands, MCStreamer &Out,
uint64_t &ErrorInfo,
bool MatchingInlineAsm) override {
MCInst Inst;
Inst.setLoc(IDLoc);
FeatureBitset MissingFeatures;
unsigned MatchResult = MatchInstructionImpl(
Operands, Inst, ErrorInfo, MissingFeatures, MatchingInlineAsm);
switch (MatchResult) {
case Match_Success: {
ensureLocals(Out);
// Fix unknown p2align operands.
auto Align = WebAssembly::GetDefaultP2AlignAny(Inst.getOpcode());
if (Align != -1U) {
auto &Op0 = Inst.getOperand(0);
if (Op0.getImm() == -1)
Op0.setImm(Align);
}
if (is64) {
// Upgrade 32-bit loads/stores to 64-bit. These mostly differ by having
// an offset64 arg instead of offset32, but to the assembler matcher
// they're both immediates so don't get selected for.
auto Opc64 = WebAssembly::getWasm64Opcode(
static_cast<uint16_t>(Inst.getOpcode()));
if (Opc64 >= 0) {
Inst.setOpcode(Opc64);
}
}
if (!SkipTypeCheck && TC.typeCheck(IDLoc, Inst, Operands))
return true;
Out.emitInstruction(Inst, getSTI());
if (CurrentState == EndFunction) {
onEndOfFunction(IDLoc);
} else {
CurrentState = Instructions;
}
return false;
}
case Match_MissingFeature: {
assert(MissingFeatures.count() > 0 && "Expected missing features");
SmallString<128> Message;
raw_svector_ostream OS(Message);
OS << "instruction requires:";
for (unsigned i = 0, e = MissingFeatures.size(); i != e; ++i)
if (MissingFeatures.test(i))
OS << ' ' << getSubtargetFeatureName(i);
return Parser.Error(IDLoc, Message);
}
case Match_MnemonicFail:
return Parser.Error(IDLoc, "invalid instruction");
case Match_NearMisses:
return Parser.Error(IDLoc, "ambiguous instruction");
case Match_InvalidTiedOperand:
case Match_InvalidOperand: {
SMLoc ErrorLoc = IDLoc;
if (ErrorInfo != ~0ULL) {
if (ErrorInfo >= Operands.size())
return Parser.Error(IDLoc, "too few operands for instruction");
ErrorLoc = Operands[ErrorInfo]->getStartLoc();
if (ErrorLoc == SMLoc())
ErrorLoc = IDLoc;
}
return Parser.Error(ErrorLoc, "invalid operand for instruction");
}
}
llvm_unreachable("Implement any new match types added!");
}
void doBeforeLabelEmit(MCSymbol *Symbol, SMLoc IDLoc) override {
// Code below only applies to labels in text sections.
auto CWS = cast<MCSectionWasm>(getStreamer().getCurrentSection().first);
if (!CWS || !CWS->getKind().isText())
return;
auto WasmSym = cast<MCSymbolWasm>(Symbol);
// Unlike other targets, we don't allow data in text sections (labels
// declared with .type @object).
if (WasmSym->getType() == wasm::WASM_SYMBOL_TYPE_DATA) {
Parser.Error(IDLoc,
"Wasm doesn\'t support data symbols in text sections");
return;
}
// Start a new section for the next function automatically, since our
// object writer expects each function to have its own section. This way
// The user can't forget this "convention".
auto SymName = Symbol->getName();
if (SymName.startswith(".L"))
return; // Local Symbol.
// TODO: If the user explicitly creates a new function section, we ignore
// its name when we create this one. It would be nice to honor their
// choice, while still ensuring that we create one if they forget.
// (that requires coordination with WasmAsmParser::parseSectionDirective)
auto SecName = ".text." + SymName;
auto *Group = CWS->getGroup();
// If the current section is a COMDAT, also set the flag on the symbol.
// TODO: Currently the only place that the symbols' comdat flag matters is
// for importing comdat functions. But there's no way to specify that in
// assembly currently.
if (Group)
WasmSym->setComdat(true);
auto *WS =
getContext().getWasmSection(SecName, SectionKind::getText(), 0, Group,
MCContext::GenericSectionID, nullptr);
getStreamer().switchSection(WS);
// Also generate DWARF for this section if requested.
if (getContext().getGenDwarfForAssembly())
getContext().addGenDwarfSection(WS);
if (WasmSym->isFunction()) {
// We give the location of the label (IDLoc) here, because otherwise the
// lexer's next location will be used, which can be confusing. For
// example:
//
// test0: ; This function does not end properly
// ...
//
// test1: ; We would like to point to this line for error
// ... . Not this line, which can contain any instruction
ensureEmptyNestingStack(IDLoc);
CurrentState = FunctionLabel;
LastFunctionLabel = Symbol;
push(Function);
}
}
void onEndOfFunction(SMLoc ErrorLoc) {
if (!SkipTypeCheck)
TC.endOfFunction(ErrorLoc);
// Reset the type checker state.
TC.Clear();
}
void onEndOfFile() override { ensureEmptyNestingStack(); }
};
} // end anonymous namespace
// Force static initialization.
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeWebAssemblyAsmParser() {
RegisterMCAsmParser<WebAssemblyAsmParser> X(getTheWebAssemblyTarget32());
RegisterMCAsmParser<WebAssemblyAsmParser> Y(getTheWebAssemblyTarget64());
}
#define GET_REGISTER_MATCHER
#define GET_SUBTARGET_FEATURE_NAME
#define GET_MATCHER_IMPLEMENTATION
#include "WebAssemblyGenAsmMatcher.inc"
StringRef GetMnemonic(unsigned Opc) {
// FIXME: linear search!
for (auto &ME : MatchTable0) {
if (ME.Opcode == Opc) {
return ME.getMnemonic();
}
}
assert(false && "mnemonic not found");
return StringRef();
}
```
|
In telecommunication, the term multiple homing has the following meanings:
telephone systems, the connection of a terminal facility so that it can be served by one or several switching centers. Multiple homing may use a single directory number.
In telephone systems, the connection of a terminal facility to more than one switching center by separate access lines. Separate directory numbers are applicable to each switching center accessed.
In military, such as Missiles and loitering munitions, it is ability of a single weapon system or projectile to select, focus and simultaneously engage multiple targets.
See also
Homing pigeon
Infrared homing
Missile guidance
References
Communication circuits
Military terminology
|
Ernst M. E. Ehrenbaum (20 December 1861 – 6 March 1942) was a German biologist (especially fishes) and oceanographer.
Biography
Ehrenbaum was born in Perleberg, Province of Brandenburg, Prussia. He studied natural sciences at the universities of Berlin, Würzburg and Kiel, receiving his degree at the latter institution in 1884. From 1888 to 1892 he was head of a wanderstation for German sea fishermen, and afterwards served as custodian for sea fishing at the Biological Institute Helgoland. From 1910 to 1931 he was director of the fish laboratory at the Museum of Natural History in Hamburg. He died in Marburg an der Lahn.
Colleagues
Harry Macdonald Kyle (1872–1951), was a Scottish ichthyologist and fisheries scientist.
Erna Mohr (11 July 189410 September 1968) was a German zoologist who made contributions to ichthyology and mammalogy.
Taxa
Pellioditis ehrenbaumi, nematode species described by Ernst Bresslau and Jacobus Hermanus Schuurmans Stekhoven (1935).
Pleistophora ehrenbaumi, microsporidean species described by Eduard Reichenow (1929).
Rhabditis ehrenbaumi, nematode species described by Jacobus Hermanus Schuurmans Stekhoven (1935), synonymous with Rhabditis nidrosiensis.
Published works
Untersuchungen uber die struktur und bildung der schale der in der Kieler bucht hauftig vorkommenden muscheln, 1884 – Studies on the structure and formation of the shell of common mussels in Kiel Bay.
Zur naturgeschichte von Crangon vulgaris Fabr., 1890 – On the natural history of Crangon vulgaris.
Berichte über eine reise nach den wichtigsten fischereiplätzen der Vereinigten Staaten und über die fischereiabtheilung auf der Weltausstellung in Chicago im jahre 1893 (1894) – Reports on a journey to the most important fishing areas of the United States and on the fishery section at the World Exhibition in Chicago in 1893.
Eier und larven von fischen der deutschen bucht, 1897 – Eggs and larvae of fish from German bays.
Künstliche Zucht und Wachstum des Hummers, 1907 – Artificial breeding and the growth of lobsters.
Seemuscheln als Nahrungsmittel, 1915 – Sea mussels as food.
Die wichtigsten Seefische in Bildern, 1925 – Saltwater fish in pictures.
Naturgeschichte und wirrtschaftliche Bedeutung der Seefische Nordeuropas, 1936 – Natural history and economic importance of marine fish in Northern Europe.
See also
:Category:Taxa named by Ernst Ehrenbaum
References
External links
Biographies index at scilib.ucsd.edu
20th-century German biologists
19th-century German scientists
German oceanographers
University of Kiel alumni
Scientists from the Province of Brandenburg
People from Perleberg
1861 births
1942 deaths
|
```yaml
description: TI SimpleLink CC13xx / CC26xx SPI node
compatible: "ti,cc13xx-cc26xx-spi"
include: [spi-controller.yaml, pinctrl-device.yaml, base.yaml]
properties:
reg:
required: true
```
|
```c
/**
* @file lv_draw_sw_letter.c
*
*/
/*********************
* INCLUDES
*********************/
#include "blend/lv_draw_sw_blend_private.h"
#include "../lv_draw_label_private.h"
#include "lv_draw_sw.h"
#if LV_USE_DRAW_SW
#include "../../display/lv_display.h"
#include "../../misc/lv_math.h"
#include "../../misc/lv_assert.h"
#include "../../misc/lv_area.h"
#include "../../misc/lv_style.h"
#include "../../font/lv_font.h"
#include "../../core/lv_refr_private.h"
#include "../../stdlib/lv_string.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static void /* LV_ATTRIBUTE_FAST_MEM */ draw_letter_cb(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * glyph_draw_dsc,
lv_draw_fill_dsc_t * fill_draw_dsc, const lv_area_t * fill_area);
/**********************
* STATIC VARIABLES
**********************/
/**********************
* GLOBAL VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
void lv_draw_sw_label(lv_draw_unit_t * draw_unit, const lv_draw_label_dsc_t * dsc, const lv_area_t * coords)
{
if(dsc->opa <= LV_OPA_MIN) return;
LV_PROFILER_BEGIN;
lv_draw_label_iterate_characters(draw_unit, dsc, coords, draw_letter_cb);
LV_PROFILER_END;
}
/**********************
* STATIC FUNCTIONS
**********************/
static void LV_ATTRIBUTE_FAST_MEM draw_letter_cb(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * glyph_draw_dsc,
lv_draw_fill_dsc_t * fill_draw_dsc, const lv_area_t * fill_area)
{
if(glyph_draw_dsc) {
switch(glyph_draw_dsc->format) {
case LV_FONT_GLYPH_FORMAT_NONE: {
#if LV_USE_FONT_PLACEHOLDER
/* Draw a placeholder rectangle*/
lv_draw_border_dsc_t border_draw_dsc;
lv_draw_border_dsc_init(&border_draw_dsc);
border_draw_dsc.opa = glyph_draw_dsc->opa;
border_draw_dsc.color = glyph_draw_dsc->color;
border_draw_dsc.width = 1;
lv_draw_sw_border(draw_unit, &border_draw_dsc, glyph_draw_dsc->bg_coords);
#endif
}
break;
case LV_FONT_GLYPH_FORMAT_A1:
case LV_FONT_GLYPH_FORMAT_A2:
case LV_FONT_GLYPH_FORMAT_A4:
case LV_FONT_GLYPH_FORMAT_A8: {
lv_area_t mask_area = *glyph_draw_dsc->letter_coords;
mask_area.x2 = mask_area.x1 + lv_draw_buf_width_to_stride(lv_area_get_width(&mask_area), LV_COLOR_FORMAT_A8) - 1;
lv_draw_sw_blend_dsc_t blend_dsc;
lv_memzero(&blend_dsc, sizeof(blend_dsc));
blend_dsc.color = glyph_draw_dsc->color;
blend_dsc.opa = glyph_draw_dsc->opa;
lv_draw_buf_t * draw_buf = glyph_draw_dsc->glyph_data;
blend_dsc.mask_buf = draw_buf->data;
blend_dsc.mask_area = &mask_area;
blend_dsc.mask_stride = draw_buf->header.stride;
blend_dsc.blend_area = glyph_draw_dsc->letter_coords;
blend_dsc.mask_res = LV_DRAW_SW_MASK_RES_CHANGED;
lv_draw_sw_blend(draw_unit, &blend_dsc);
}
break;
case LV_FONT_GLYPH_FORMAT_IMAGE: {
#if LV_USE_IMGFONT
lv_draw_image_dsc_t img_dsc;
lv_draw_image_dsc_init(&img_dsc);
img_dsc.rotation = 0;
img_dsc.scale_x = LV_SCALE_NONE;
img_dsc.scale_y = LV_SCALE_NONE;
img_dsc.opa = glyph_draw_dsc->opa;
img_dsc.src = glyph_draw_dsc->glyph_data;
lv_draw_sw_image(draw_unit, &img_dsc, glyph_draw_dsc->letter_coords);
#endif
}
break;
default:
break;
}
}
if(fill_draw_dsc && fill_area) {
lv_draw_sw_fill(draw_unit, fill_draw_dsc, fill_area);
}
}
#endif /*LV_USE_DRAW_SW*/
```
|
Brooke Mackenzie Henderson (born 10 September 1997) is a Canadian professional golfer on the LPGA Tour.
Henderson was named the Canadian Press female athlete of the year for 2015, 2017 and 2018. She won her first major at age 18 in 2016 at the KPMG Women's PGA Championship, becoming the event's youngest winner. With 13 LPGA wins as of January 2023, Henderson has the most victories of any Canadian golfer on major professional tours. She won her second career major title at the 2022 Evian Championship.
In November 2019, she was named the winner of the 2019 Founders Award by a vote of fellow golfers on the LPGA Tour as someone "whose behaviour and deeds best exemplify the spirit, ideals, and values of the LPGA."
Early years, family and education
Henderson was raised in Smiths Falls, Ontario and initially learned golf at the Rideau Lakes Golf and Country Club. Her parents are Dave and Darlene. Henderson's sister, Brittany older by seven years and a former professional player was a role model for Henderson to play golf competitively. Henderson attended the Smiths Falls District Collegiate Institute through 2014.
Henderson won the Canadian Women's Amateur in 2013, and finished runner-up at the 2014 U.S. Women's Amateur. While still an amateur, she won three events on the CN Canadian Women's Tour, and finished tied for 10th place in the U.S. Women's Open at age 16. She won numerous amateur tournaments and was the top-ranked female amateur golfer in the world before turning professional in December 2014, passing up the chance to play college golf at the University of Florida.
Throughout her professional career, Henderson's father has been her coach and her sister has been her caddy.
Development and sponsorships
Henderson has signed several corporate sponsorships:
IMG to manage her professional affairs
Royal Bank of Canada for banking and financial services
Sunice Golf for golf apparel and outerwear
To begin the 2023 season, Henderson signed a multiyear sponsorship with TaylorMade
Skechers Performance for Go Golf footwear
Henderson has signed other sponsorship deals with Canadian Pacific, MasterCard, Rolex, BMW, BioSteel, and Golf Town. As of 2017, Henderson became a resident touring professional at Miromar Lakes Beach and Golf Club, Miromar Lakes, Florida.
Professional career
2015
Henderson set a tournament record with her 36-hole score at the LPGA Tour's Swinging Skirts LPGA Classic in April 2015, at the Lake Merced Golf Club, just south of San Francisco. Her second round 65 (−7) gave her 135 (−9), breaking the record set by Stacy Lewis in 2014 by three shots. She finished third, one stroke behind Lydia Ko, the playoff winner, and runner-up Morgan Pressel.
At age 17, Henderson had to play her way into LPGA Tour events through Monday qualifiers, and to rely on sponsor exemptions, after her request for an age waiver to compete at the LPGA Tour Q School in late 2014 was denied. She earned a Symetra Tour card after winning her first event as a professional, the Four Winds Invitational in Indiana in June 2015. With a final round 66 (−4), Henderson tied for fifth at the U.S. Women's Open in July.
After Monday-qualifying for the Cambia Portland Classic in Oregon in August, Henderson won the event by eight shots, the largest victory margin on tour since 2012, and became the tour's third-youngest winner. She was only the second Monday qualifier to win on tour, and the first since Laurel Kean in 2000. Henderson was also the first Canadian to win on the LPGA Tour since Lorie Kane in 2001, and was granted immediate LPGA Tour membership.
2016
In June 2016, Henderson won her first major championship, at the KPMG Women's PGA Championship at Sahalee Country Club near Seattle. Her final round 65 (−6) propelled her into a tie with top-ranked Lydia Ko, followed by a playoff which Henderson won with a birdie on the first hole. At age 18, she became the youngest to win that major, the second-youngest in any women's major, and the first Canadian woman to win a major in 48 years. It was Henderson's second tour win, both in the Pacific Northwest, and her first as a tour member; it moved her from fourth to second in the world rankings.
With her win as defending champion at the Cambia Portland Classic in June 2016, Henderson joined Sandra Post and Lorie Kane as the only Canadians to win multiple LPGA events in the same season.
Henderson was a member of the Canadian Olympic Team for the 2016 Summer Olympics in Rio de Janeiro in the women's Olympic golf tournament, placing seventh.
2017
In June 2017, Henderson won the Meijer LPGA Classic. Her win on 2 October 2017 at the McKayson New Zealand Women's Open was her first LPGA championship outside North America.
2018
On 14 April, Henderson won the Lotte Championship, her sixth victory on the LPGA Tour finishing at −12 to win by four strokes over Azahara Muñoz.
On 26 August, Henderson became the first Canadian in 45 years – after Jocelyne Bourassa in 1973 – to win the Canadian Women's Open at the Wascana Country Club in Regina, Saskatchewan.
By finishing second (to Ariya Jutanugarn) in the 2018 season-ending Race to the CME Globe, Henderson was awarded $150,000 from the bonus pool purse. She was awarded the Bobbie Rosenfeld Award in December 2018 as The Canadian Press Female Athlete of the Year for the third time.
2019
On 20 April 2019, Henderson defended her title at the Lotte Championship in Hawaii. This marked her eighth victory on the LPGA Tour, tying Sandra Post, Mike Weir and George Knudson for the most victories by a Canadian golfer on the LPGA or PGA Tours.
On 16 June 2019, Henderson won the Meijer LPGA Classic in Michigan for the second time – the third LPGA event where she has multiple victories. This was her ninth victory on the LPGA, giving her the most victories on major tours of any professional golfer in Canadian history.
2021
Henderson won the Hugel-Air Premia LA Open on 24 April 2021 for her tenth LPGA Tour victory.
2022
Henderson increased her LPGA victory total to 11 with her win at the ShopRite LPGA Classic in a playoff over Lindsey Weaver-Wright on 12 June 2022.
Henderson won her second career major at the 2022 Evian Championship, in which she was the first player in LPGA history to begin a major with two rounds of 64 or lower.
On 12 November, the day after shooting a first round, one-over-par 71 at the Pelican Women's Championship, she wrote in a statement that she had to withdraw, "due to an injury in my upper back, it was recommended that I rest as much as possible coming into the week. While I plan to address any medical concerns and recover fully in the off season, I am trying to do everything I can to compete this week. I appreciate all of the support."
2023
On 22 January, Henderson won the 2023 Hilton Grand Vacations Tournament of Champions at Lake Nona Golf & Country Club in Orlando, completing all four rounds in the lead, and achieving her 13th victory on the LPGA Tour.
In July, Henderson finished second to Céline Boutier at the 2023 Evian Championship, the season's fourth major tournament.
Amateur wins
2010 CN du Quebec
2011 CN Future Links Ontario, Ontario Junior Girls Championship, Optimist Junior 13-14, Genesis Junior
2012 Ravenwood Junior Girls Championship, Ontario Junior Girls Championship, Canadian Junior Girls Championship
2013 South American Amateur, CN Future Links Pacific Championship, Canadian Women's Amateur
2014 Junior Orange Bowl International, South Atlantic Ladies' Amateur Championship (SALLY Tournament), Scott Robertson Memorial, Porter Cup, Ontario Women's Amateur, Espirito Santo Trophy (individual winner)
Source:
Professional wins (20)
LPGA Tour wins (13)
LPGA Tour playoff record (2–1)
Symetra Tour wins (1)
CN Canadian Women's Tour (4)
2012 Beloeil Golf Club event (as an amateur)
2014 Legends of Niagara event, PGA Women's Championship of Canada (both as an amateur)
2015 PGA Women's Championship of Canada
Other wins (2)
2015 SunCoast Series at Winter Garden, SunCoast Series Winter Championship
Major championships
Wins (2)
1 Defeated Ko in a sudden-death playoff: Henderson (3) and Ko (4).
Results timeline
Results not in chronological order before.
LA = Low amateur
CUT = missed the half-way cut
WD = withdrew
NT = No tournament
T = tied
Summary
Most consecutive cuts made – 18 (2013 U.S. Open – 2018 ANA)
Longest streak of top-10s – 2 (four times)
LPGA Tour career summary
^ Official as of 29 October 2023
*Includes matchplay and other tournaments without a cut.
World ranking
Position in Women's World Golf Rankings at the end of each calendar year.
^ As of 30 October 2023
Team appearances
Amateur
Espirito Santo Trophy (representing Canada): 2012, 2014
Awards
2015 Ontario Athlete of the Year (Syl Apps Athlete of the Year Award)
2015 Canadian Press Female Athlete of the Year (Bobbie Rosenfeld Award)
2017 Ottawa Person of the Year by The Athletic
2017 Canadian Press Female Athlete of the Year (Bobbie Rosenfeld Award)
2018 Canadian Press Female Athlete of the Year (Bobbie Rosenfeld Award)
2019 ESPY Award, Best Female Golfer
2019 LPGA Founders Award
2019 Canada's Sports Hall of Fame People's Choice Award
See also
List of golfers with most LPGA Tour wins
References
External links
Canadian female golfers
LPGA Tour golfers
Winners of LPGA major golf championships
Olympic golfers for Canada
Golfers at the 2016 Summer Olympics
Golfers at the 2020 Summer Olympics
Golfing people from Ontario
People from Smiths Falls
Sportspeople from Lanark County
1997 births
Living people
|
```objective-c
/*
* Compatibility section
* This section sets new-style macros based on old-style ones, for compatibility
*/
#if defined (__STL_DEBUG) && !defined (_STLP_DEBUG)
# define _STLP_DEBUG __STL_DEBUG
#endif
#if defined (__STL_NO_ANACHRONISMS) && !defined (_STLP_NO_ANACHRONISMS)
# define _STLP_NO_ANACHRONISMS __STL_NO_ANACHRONISMS
#endif
#if defined (__STL_NO_EXTENSIONS) && !defined (_STLP_NO_EXTENSIONS)
# define _STLP_NO_EXTENSIONS __STL_NO_EXTENSIONS
#endif
#if defined (__STL_NO_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTIONS)
# define _STLP_NO_EXCEPTIONS __STL_NO_EXCEPTIONS
#endif
#if defined (__STL_NO_NAMESPACES) && !defined (_STLP_NO_NAMESPACES)
# define _STLP_NO_NAMESPACES __STL_NO_NAMESPACES
#endif
#if defined (__STL_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
# define _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS __STL_MINIMUM_DEFAULT_TEMPLATE_PARAMS
#endif
#if defined (__STL_NO_OWN_NAMESPACE) && !defined (_STLP_NO_OWN_NAMESPACE)
# define _STLP_NO_OWN_NAMESPACE __STL_NO_OWN_NAMESPACE
#endif
#if defined (__STL_NO_RELOPS_NAMESPACE) && !defined (_STLP_NO_RELOPS_NAMESPACE)
# define _STLP_NO_RELOPS_NAMESPACE __STL_NO_RELOPS_NAMESPACE
#endif
#if defined (__STL_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_UNINITIALIZED)
# define _STLP_DEBUG_UNINITIALIZED __STL_DEBUG_UNINITIALIZED
#endif
#if defined (__STL_SHRED_BYTE) && !defined (_STLP_SHRED_BYTE)
# define _STLP_SHRED_BYTE __STL_SHRED_BYTE
#endif
#if defined (__STL_USE_MFC) && !defined (_STLP_USE_MFC)
# define _STLP_USE_MFC __STL_USE_MFC
#endif
#if defined (__STL_USE_NEWALLOC) && !defined (_STLP_USE_NEWALLOC)
# define _STLP_USE_NEWALLOC __STL_USE_NEWALLOC
#endif
#if defined (__STL_USE_MALLOC) && !defined (_STLP_USE_MALLOC)
# define _STLP_USE_MALLOC __STL_USE_MALLOC
#endif
#if defined (__STL_DEBUG_ALLOC) && !defined (_STLP_DEBUG_ALLOC)
# define _STLP_DEBUG_ALLOC __STL_DEBUG_ALLOC
#endif
#if defined (__STL_DEBUG_MESSAGE) && !defined (_STLP_DEBUG_MESSAGE)
# define _STLP_DEBUG_MESSAGE __STL_DEBUG_MESSAGE
#endif
#if defined (__STL_DEBUG_TERMINATE) && !defined (_STLP_DEBUG_TERMINATE)
# define _STLP_DEBUG_TERMINATE __STL_DEBUG_TERMINATE
#endif
#if defined (__STL_USE_ABBREVS) && !defined (_STLP_USE_ABBREVS)
# define _STLP_USE_ABBREVS __STL_USE_ABBREVS
#endif
#if defined (__STL_NO_MSVC50_COMPATIBILITY) && !defined (_STLP_NO_MSVC50_COMPATIBILITY)
# define _STLP_NO_MSVC50_COMPATIBILITY __STL_NO_MSVC50_COMPATIBILITY
#endif
/* STLport do not support anymore the iostream wrapper mode so this macro should
* always been define for other libraries that was using it:
*/
#if !defined (_STLP_OWN_IOSTREAMS)
# define _STLP_OWN_IOSTREAMS
#endif
#if defined (_STLP_NO_OWN_IOSTREAMS)
# error STLport do not support anymore the wrapper mode. If you want to use STLport \
use its iostreams implementation or no iostreams at all.
#endif
```
|
```shell
#!/bin/bash
#Include utils
source ../utils/utils.sh
make-bare-remote-repo
clone-remote-to-exercise
git commit --allow-empty -m "Initial commit"
git tag v0.0
git push origin master
git push origin v0.0
echo "Hello" > hello.code
git add hello.code
git commit -m "Helo Volrd feature"
echo "HelloWrld?" > hello.code
echo "Unrelated stuff!" > other.code
git add -A
git commit -am "Finished HW feature"
echo "Hello World!" > hello.code
git commit -am "Really made the thingy done"
echo "println DEBUG" >> hello.code
git commit -am "debugging"
echo "4321pass" > private.secret
git add private.secret
git commit -m "important secret"
echo "# THE Hello World program" > README.md
git add README.md
git commit -m "Add doc - step 1"
echo "# THE Ultimate Hello World program" > README.md
git commit -am "Add doc - step 2"
echo "" >> README.md
echo "This program does exactly what it says" >> README.md
git commit -am "Add doc - step 3"
echo "does_it_work(hello.code)" > hello.test
git add hello.test
git commit -m "Test for feature hello world"
echo "does_it_work(hello.code);" > hello.test
git commit -am "I forgot a semicolon"
```
|
Zhiping may refer to:
Locations in China
Zhiping, Gansu (治平镇), Jingning County, Gansu
Zhiping Town, Chongqing (支坪镇), Jiangjin District, Chongqing
Zhiping Township, Chongqing (治平乡), Chengkou County, Chongqing
Zhiping She Ethnic Township (治平畲族乡), Ninghua County, Fujian
Historical eras
Zhiping (治平, 1064–1067), era name used by Emperor Yingzong of Song
Zhiping (治平, 1351–1355), era name used by Xu Shouhui
|
Nik Bonaddio is an American Internet entrepreneur best known for founding and serving as the CEO of the popular sports analytics site numberFire. In 2017, he was named Chief Product Officer at FanDuel, who acquired numberFire in September 2015.
Career
After graduation, Bonaddio began work at Yahoo! as a software engineer. Bonaddio founded numberFire in 2009, after a successful appearance on ABC's Who Wants to Be a Millionaire with Regis Philbin. During the show's 10th anniversary run, Bonaddio won $100,000, which was then used to found numberFire.
Since its founding, numberFire has grown to over 600,000 subscribers and has gained recognition in the marketplace for accurate predictions, including correctly predicting winners of the Super Bowl and the NCAA Men's Division I Basketball Championship.
numberFire was purchased by FanDuel in September 2015. Terms were not disclosed.
After spending three years as the Chief Product Officer at FanDuel, Bonaddio left in 2020 to start BigBrain, an online gaming company.
Education
Bonaddio was raised in Wexford, Pennsylvania, a suburb in the North Hills neighborhood of Pittsburgh, and graduated from nearby North Allegheny Senior High School. During his time at North Allegheny, he was featured multiple times in local newspapers for awards received for his online design collective, Lockjaw and was active in the soccer and tennis programs.
He received a B.S. in 2004 from Carnegie Mellon University in Information Systems, followed by a M.S. in Information Systems Management in 2005. During his time at Carnegie Mellon, he was a two-time All-American athlete and record holder in track and field and a member of the Kappa Delta Rho fraternity.
Awards
A prominent member of the emerging NYC tech scene, Bonaddio has been featured in a variety of publications and conferences. In addition to routinely contributing to ESPN, he has been featured in Sports Illustrated in 2011, FastCompany in 2012, and Under30CEO and Entrepreneur magazine amongst others in 2013.
Other ventures
In addition to his professional life, Bonaddio is also a highly-ranked and successful high-stakes daily fantasy sports player. In 2022, he finished 3rd in FanDuel's World Fantasy Baseball Championship, and 1st in FanDuel's World Fantasy Football Championship. In March 2023, Bonaddio also finished 1st in FanDuel's World Fantasy Basketball Championship, becoming the first non-professional in the industry's history to win back-to-back live final titles, as well as the first to finish in the top three in three straight finals.
References
External links
Official website
Company website
Living people
American computer businesspeople
Heinz College of Information Systems and Public Policy alumni
1982 births
21st-century American businesspeople
|
```xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<vector xmlns:android="path_to_url" android:height="24dp" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="24dp">
<path android:fillColor="#FFFFFF" android:pathData="M19,7h-8v6h8L19,7zM21,3L3,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,1.98 2,1.98h18c1.1,0 2,-0.88 2,-1.98L23,5c0,-1.1 -0.9,-2 -2,-2zM21,19.01L3,19.01L3,4.98h18v14.03z"/>
</vector>
```
|
```xml
import { BuilderElement, createStringElement, OnOffElement, XmlComponent } from "@file/xml-components";
// <xsd:complexType name="CT_Font">
// <xsd:sequence>
// <xsd:element name="altName" type="CT_String" minOccurs="0" maxOccurs="1"/>
// <xsd:element name="panose1" type="CT_Panose" minOccurs="0" maxOccurs="1"/>
// <xsd:element name="charset" type="CT_Charset" minOccurs="0" maxOccurs="1"/>
// <xsd:element name="family" type="CT_FontFamily" minOccurs="0" maxOccurs="1"/>
// <xsd:element name="notTrueType" type="CT_OnOff" minOccurs="0" maxOccurs="1"/>
// <xsd:element name="pitch" type="CT_Pitch" minOccurs="0" maxOccurs="1"/>
// <xsd:element name="sig" type="CT_FontSig" minOccurs="0" maxOccurs="1"/>
// <xsd:element name="embedRegular" type="CT_FontRel" minOccurs="0" maxOccurs="1"/>
// <xsd:element name="embedBold" type="CT_FontRel" minOccurs="0" maxOccurs="1"/>
// <xsd:element name="embedItalic" type="CT_FontRel" minOccurs="0" maxOccurs="1"/>
// <xsd:element name="embedBoldItalic" type="CT_FontRel" minOccurs="0" maxOccurs="1"/>
// </xsd:sequence>
// <xsd:attribute name="name" type="s:ST_String" use="required"/>
// </xsd:complexType>
// <xsd:complexType name="CT_FontRel">
// <xsd:complexContent>
// <xsd:extension base="CT_Rel">
// <xsd:attribute name="fontKey" type="s:ST_Guid" />
// <xsd:attribute name="subsetted" type="s:ST_OnOff" />
// </xsd:extension>
// </xsd:complexContent>
// </xsd:complexType>
// path_to_url
export interface IFontRelationshipOptions {
/**
* Relationship to Part
*/
readonly id: string;
/**
* Embedded Font Obfuscation Key
*/
readonly fontKey?: string;
/**
* Embedded Font Is Subsetted
*/
readonly subsetted?: boolean;
}
export const CharacterSet = {
ANSI: "00",
DEFAULT: "01",
SYMBOL: "02",
MAC: "4D",
JIS: "80",
HANGUL: "81",
JOHAB: "82",
GB_2312: "86",
CHINESEBIG5: "88",
GREEK: "A1",
TURKISH: "A2",
VIETNAMESE: "A3",
HEBREW: "B1",
ARABIC: "B2",
BALTIC: "BA",
RUSSIAN: "CC",
THAI: "DE",
EASTEUROPE: "EE",
OEM: "FF",
} as const;
export type FontOptions = {
readonly name: string;
readonly altName?: string;
readonly panose1?: string;
readonly charset?: (typeof CharacterSet)[keyof typeof CharacterSet];
readonly family?: string;
readonly notTrueType?: boolean;
readonly pitch?: string;
readonly sig?: {
readonly usb0: string;
readonly usb1: string;
readonly usb2: string;
readonly usb3: string;
readonly csb0: string;
readonly csb1: string;
};
readonly embedRegular?: IFontRelationshipOptions;
readonly embedBold?: IFontRelationshipOptions;
readonly embedItalic?: IFontRelationshipOptions;
readonly embedBoldItalic?: IFontRelationshipOptions;
};
const createFontRelationship = ({ id, fontKey, subsetted }: IFontRelationshipOptions, name: string): XmlComponent =>
new BuilderElement({
name,
attributes: {
id: { key: "r:id", value: id },
...(fontKey ? { fontKey: { key: "w:fontKey", value: `{${fontKey}}` } } : {}),
},
children: [...(subsetted ? [new OnOffElement("w:subsetted", subsetted)] : [])],
});
export const createFont = ({
name,
altName,
panose1,
charset,
family,
notTrueType,
pitch,
sig,
embedRegular,
embedBold,
embedItalic,
embedBoldItalic,
}: FontOptions): XmlComponent =>
// path_to_url
new BuilderElement({
name: "w:font",
attributes: {
name: { key: "w:name", value: name },
},
children: [
// path_to_url
...(altName ? [createStringElement("w:altName", altName)] : []),
// path_to_url
...(panose1 ? [createStringElement("w:panose1", panose1)] : []),
// path_to_url
...(charset ? [createStringElement("w:charset", charset)] : []),
// path_to_url
...(family ? [createStringElement("w:family", family)] : []),
// path_to_url
...(notTrueType ? [new OnOffElement("w:notTrueType", notTrueType)] : []),
...(pitch ? [createStringElement("w:pitch", pitch)] : []),
// path_to_url
...(sig
? [
new BuilderElement({
name: "w:sig",
attributes: {
usb0: { key: "w:usb0", value: sig.usb0 },
usb1: { key: "w:usb1", value: sig.usb1 },
usb2: { key: "w:usb2", value: sig.usb2 },
usb3: { key: "w:usb3", value: sig.usb3 },
csb0: { key: "w:csb0", value: sig.csb0 },
csb1: { key: "w:csb1", value: sig.csb1 },
},
}),
]
: []),
// path_to_url
...(embedRegular ? [createFontRelationship(embedRegular, "w:embedRegular")] : []),
// path_to_url
...(embedBold ? [createFontRelationship(embedBold, "w:embedBold")] : []),
// path_to_url
...(embedItalic ? [createFontRelationship(embedItalic, "w:embedItalic")] : []),
// path_to_url
...(embedBoldItalic ? [createFontRelationship(embedBoldItalic, "w:embedBoldItalic")] : []),
],
});
```
|
The 1805 State of the Union Address was given by the third president of the United States, Thomas Jefferson, on Tuesday, December 3, 1805. He did not give it directly to the 9th United States Congress, but only presented his written address. It was the first of his second term in the White House. He began with, "At a moment when the nations of Europe are in commotion and arming against each other, and when those with whom we have principal intercourse are engaged in the general contest, and when the countenance of some of them toward our peaceable country threatens that even that may not be unaffected by what is passing on the general theater, a meeting of the representatives of the nation in both Houses of Congress has become more than usually desirable." He ended with, "On this first occasion of addressing Congress since, by the choice of my constituents, I have entered on a second term of administration, I embrace the opportunity to give this public assurance that I will exert my best endeavors to administer faithfully the executive department, and will zealously cooperate with you in every measure which may tend to secure the liberty, property, and personal safety of our fellow citizens, and to consolidate the republican forms and principles of our Government."
References
State of the Union addresses
Presidency of Thomas Jefferson
State of the Union Address
Works by Thomas Jefferson
State of the Union Address
State of the Union Address
State of the Union Address
9th United States Congress
December 1805 events
State of the Union
|
```html
<html>
<head>
<title>NVIDIA(R) PhysX(R) SDK 3.4 API Reference: Class Members - Functions</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK HREF="NVIDIA.css" REL="stylesheet" TYPE="text/css">
</head>
<body bgcolor="#FFFFFF">
<div id="header">
<hr class="first">
<img alt="" src="images/PhysXlogo.png" align="middle"> <br>
<center>
<a class="qindex" href="main.html">Main Page</a>
<a class="qindex" href="hierarchy.html">Class Hierarchy</a>
<a class="qindex" href="annotated.html">Compound List</a>
<a class="qindex" href="functions.html">Compound Members</a>
</center>
<hr class="second">
</div>
<!-- Generated by Doxygen 1.5.8 -->
<div class="tabs">
<ul>
<li><a href="functions.html"><span>All</span></a></li>
<li class="current"><a href="functions_func.html"><span>Functions</span></a></li>
<li><a href="functions_vars.html"><span>Variables</span></a></li>
<li><a href="functions_type.html"><span>Typedefs</span></a></li>
<li><a href="functions_enum.html"><span>Enumerations</span></a></li>
<li><a href="functions_eval.html"><span>Enumerator</span></a></li>
<li><a href="functions_rela.html"><span>Related Functions</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="functions_func.html#index_a"><span>a</span></a></li>
<li><a href="functions_func_0x62.html#index_b"><span>b</span></a></li>
<li><a href="functions_func_0x63.html#index_c"><span>c</span></a></li>
<li><a href="functions_func_0x64.html#index_d"><span>d</span></a></li>
<li><a href="functions_func_0x65.html#index_e"><span>e</span></a></li>
<li><a href="functions_func_0x66.html#index_f"><span>f</span></a></li>
<li><a href="functions_func_0x67.html#index_g"><span>g</span></a></li>
<li><a href="functions_func_0x68.html#index_h"><span>h</span></a></li>
<li><a href="functions_func_0x69.html#index_i"><span>i</span></a></li>
<li><a href="functions_func_0x6c.html#index_l"><span>l</span></a></li>
<li><a href="functions_func_0x6d.html#index_m"><span>m</span></a></li>
<li><a href="functions_func_0x6e.html#index_n"><span>n</span></a></li>
<li><a href="functions_func_0x6f.html#index_o"><span>o</span></a></li>
<li><a href="functions_func_0x70.html#index_p"><span>p</span></a></li>
<li><a href="functions_func_0x72.html#index_r"><span>r</span></a></li>
<li class="current"><a href="functions_func_0x73.html#index_s"><span>s</span></a></li>
<li><a href="functions_func_0x74.html#index_t"><span>t</span></a></li>
<li><a href="functions_func_0x75.html#index_u"><span>u</span></a></li>
<li><a href="functions_func_0x76.html#index_v"><span>v</span></a></li>
<li><a href="functions_func_0x77.html#index_w"><span>w</span></a></li>
<li><a href="functions_func_0x7a.html#index_z"><span>z</span></a></li>
<li><a href="functions_func_0x7e.html#index_~"><span>~</span></a></li>
</ul>
</div>
<div class="contents">
<p>
<h3><a class="anchor" name="index_s">- s -</a></h3><ul>
<li>save()
: <a class="el" href="classPxClothFabricCooker.html#6d9657cf26e9eece0d0fe66dfaf5f12a">PxClothFabricCooker</a>
<li>saveCells()
: <a class="el" href="classPxHeightField.html#d509e93fd7d7fc43726160540faeb610">PxHeightField</a>
<li>scale()
: <a class="el" href="classPxMat44.html#00550660a7488827dd9fe2b1520bba90">PxMat44</a>
<li>scaleFast()
: <a class="el" href="group__foundation.html#ge942e76eff12ad0827a6d3870afb9bc9">PxBounds3</a>
<li>scaleInertia()
: <a class="el" href="classPxMassProperties.html#4ba3bf338320c9f0bf558b5d3a9046bd">PxMassProperties</a>
<li>scaleRestlengths()
: <a class="el" href="classPxClothFabric.html#56084286b66bf374e3fe37fbd097a83b">PxClothFabric</a>
<li>scaleSafe()
: <a class="el" href="group__foundation.html#g34f70075ac4a52e2d7fb8afc03afc6e2">PxBounds3</a>
<li>sceneQueriesUpdate()
: <a class="el" href="classPxScene.html#a2b103c61cc84c1df17b82266a17413f">PxScene</a>
<li>seek()
: <a class="el" href="classPxDefaultMemoryInputData.html#7344d413c8bdf97731fd63d06ba26b54">PxDefaultMemoryInputData</a>
, <a class="el" href="classPxDefaultFileInputData.html#234ab504e8d281b6e0319e40dcac7c4d">PxDefaultFileInputData</a>
, <a class="el" href="classPxInputData.html#c80d55021a6bae02a1cc64d27a98c575">PxInputData</a>
<li>seekRead()
: <a class="el" href="classPxFileBuf.html#e706ac6909e4fe16db22cbe1ca2dc53d">PxFileBuf</a>
<li>seekWrite()
: <a class="el" href="classPxFileBuf.html#7fab04894cb6b2c4440e87ca33d66340">PxFileBuf</a>
<li>serializeCollectionToBinary()
: <a class="el" href="classPxSerialization.html#1d6242bea0c7513bfbfb24670e5cfb03">PxSerialization</a>
<li>serializeCollectionToXml()
: <a class="el" href="classPxSerialization.html#cbb99dac3e71e78338ab3eec4ab0ab75">PxSerialization</a>
<li>set()
: <a class="el" href="structPxExtendedVec3.html#16e7d8daf70ae2dc2c9553f92e1e74e3">PxExtendedVec3</a>
, <a class="el" href="group__foundation.html#gf9d14cf14cd5e1a4c3849f323d4a5c71">PxFlags< enumtype, storagetype ></a>
<li>setAckermannGeometryData()
: <a class="el" href="classPxVehicleDriveSimData4W.html#5a0a4baf4721c3b213258978ed7003fb">PxVehicleDriveSimData4W</a>
<li>setActorFlag()
: <a class="el" href="classPxActor.html#e24ff3f3ed0cb2a138b382fd0720b94f">PxActor</a>
<li>setActorFlags()
: <a class="el" href="classPxActor.html#f60720e190324e8ff36281a2360c6043">PxActor</a>
<li>setActors()
: <a class="el" href="classPxConstraint.html#ad3f1f8c8e4220238c8fcb00c440e701">PxConstraint</a>
, <a class="el" href="classPxJoint.html#e3f3bbd628f77104c438a16a1e9bff2f">PxJoint</a>
<li>setAnalogAccel()
: <a class="el" href="classPxVehicleDrive4WRawInputData.html#f9c058df3af57913173e106fd51645d9">PxVehicleDrive4WRawInputData</a>
, <a class="el" href="classPxVehicleDriveTankRawInputData.html#1af6a6d1b1fb77d0bcc7e5af1e350a14">PxVehicleDriveTankRawInputData</a>
<li>setAnalogBrake()
: <a class="el" href="classPxVehicleDrive4WRawInputData.html#96d32688f239c2f9379616c6fbbde422">PxVehicleDrive4WRawInputData</a>
<li>setAnalogHandbrake()
: <a class="el" href="classPxVehicleDrive4WRawInputData.html#b2541ef77142c3fc2b4c8a2ce197f512">PxVehicleDrive4WRawInputData</a>
<li>setAnalogInput()
: <a class="el" href="classPxVehicleDriveDynData.html#702f9f3b98ba914cb313383aef4b45d5">PxVehicleDriveDynData</a>
<li>setAnalogLeftBrake()
: <a class="el" href="classPxVehicleDriveTankRawInputData.html#b1694ab536feae168670452b88804d08">PxVehicleDriveTankRawInputData</a>
<li>setAnalogLeftThrust()
: <a class="el" href="classPxVehicleDriveTankRawInputData.html#5e456c1b780b26b900d47afe0c0509ef">PxVehicleDriveTankRawInputData</a>
<li>setAnalogRightBrake()
: <a class="el" href="classPxVehicleDriveTankRawInputData.html#ba110cc558497adbe79c2abb3d45504c">PxVehicleDriveTankRawInputData</a>
<li>setAnalogRightThrust()
: <a class="el" href="classPxVehicleDriveTankRawInputData.html#1dacc730a946b0e23d57968a22d9ff72">PxVehicleDriveTankRawInputData</a>
<li>setAnalogSteer()
: <a class="el" href="classPxVehicleDrive4WRawInputData.html#55b3e0151ca011438b5de595741e0ccf">PxVehicleDrive4WRawInputData</a>
<li>setAngularDamping()
: <a class="el" href="classPxRigidDynamic.html#5435556860f16008b2c88ae6c36025dd">PxRigidDynamic</a>
<li>setAngularDragCoefficient()
: <a class="el" href="classPxCloth.html#39a4c1f5258832f51940aaf9a44aa10f">PxCloth</a>
<li>setAngularInertiaScale()
: <a class="el" href="classPxCloth.html#5deea84f3f38b4b98f358e56acff221e">PxCloth</a>
<li>setAngularVelocity()
: <a class="el" href="classPxRigidBody.html#d49850630db14af26e019d2550ecfd27">PxRigidBody</a>
<li>setAntiRollBarData()
: <a class="el" href="classPxVehicleWheelsSimData.html#e8706a8f39a630ba469414fb814fe206">PxVehicleWheelsSimData</a>
<li>setAutoBoxData()
: <a class="el" href="classPxVehicleDriveSimData.html#c7128888b46d993ff574d7eb3078e36d">PxVehicleDriveSimData</a>
<li>setAutoBoxSwitchTime()
: <a class="el" href="classPxVehicleDriveDynData.html#0de28a83d795f037d4042f0a5601087b">PxVehicleDriveDynData</a>
<li>setBaseFlag()
: <a class="el" href="classPxBase.html#1dd20bb574075df904e1878f2e771ef9">PxBase</a>
<li>setBaseFlags()
: <a class="el" href="classPxBase.html#fb391b692c561df0a54c413785e4ebd0">PxBase</a>
<li>setBit()
: <a class="el" href="classPxBitAndDataT.html#4f9b369d7f1da505910cb6b6b900d95f">PxBitAndDataT< storageType, bitMask ></a>
<li>setBounceThresholdVelocity()
: <a class="el" href="classPxScene.html#1e102ec1b29dea3b588b7507561e656e">PxScene</a>
<li>setBrakeTorque()
: <a class="el" href="classPxVehicleNoDrive.html#3150f58d865082068a1bf7c674cec010">PxVehicleNoDrive</a>
<li>setBreakForce()
: <a class="el" href="classPxConstraint.html#dc0b069b41e76b7c017632cfc24f08d3">PxConstraint</a>
, <a class="el" href="classPxJoint.html#1cfe86fe5c8131cea1b9b5ff9df7a014">PxJoint</a>
<li>setBroadPhaseCallback()
: <a class="el" href="classPxScene.html#c1110386fc2ffad70aa771aabc51d026">PxScene</a>
<li>setCCDContactModifyCallback()
: <a class="el" href="classPxScene.html#593d339e0fd64e47fa3b68016ce723ec">PxScene</a>
<li>setCCDMaxPasses()
: <a class="el" href="classPxScene.html#ed46505d6eac63a508c7a2d7e39cd5fb">PxScene</a>
<li>setCentrifugalInertiaScale()
: <a class="el" href="classPxCloth.html#4c765fceb26e3c72c0b1c526ea5773f6">PxCloth</a>
<li>setChassisMass()
: <a class="el" href="classPxVehicleWheelsSimData.html#c022268fa66b80edb6bb9b078923ba99">PxVehicleWheelsSimData</a>
<li>setChildPose()
: <a class="el" href="classPxArticulationJoint.html#1ede77555b69f0f137d1d20c8a8ea69c">PxArticulationJoint</a>
<li>setClientBehaviorFlags()
: <a class="el" href="classPxActor.html#d7b70236ed41524eda4c92636922d599">PxActor</a>
, <a class="el" href="classPxScene.html#6f61e48083f63f6fac343a3b1d8b2ddc">PxScene</a>
<li>setClimbingMode()
: <a class="el" href="classPxCapsuleController.html#256d6b281406c5bd1fa30dbc99e5a2df">PxCapsuleController</a>
<li>setClothFlag()
: <a class="el" href="classPxCloth.html#3d3ee58e3b3960efb9d1e22422806c9d">PxCloth</a>
<li>setClothFlags()
: <a class="el" href="classPxCloth.html#6bc462eec7ba57909611c047a40003b6">PxCloth</a>
<li>setClothInterCollisionDistance()
: <a class="el" href="classPxScene.html#b42513ab6ce4137698565ca8629eea1c">PxScene</a>
<li>setClothInterCollisionNbIterations()
: <a class="el" href="classPxScene.html#7197a1ce70671bfc81e6f3088920ac16">PxScene</a>
<li>setClothInterCollisionStiffness()
: <a class="el" href="classPxScene.html#85444db1420db29be5c0b748197b4fed">PxScene</a>
<li>setClutchData()
: <a class="el" href="classPxVehicleDriveSimData.html#0edff168e18a4d5c923460cb0ee3fe8b">PxVehicleDriveSimData</a>
<li>setCMassLocalPose()
: <a class="el" href="classPxRigidBody.html#b152773926fe7b222d61e982c3cb6adf">PxRigidBody</a>
<li>setCollisionMassScale()
: <a class="el" href="classPxCloth.html#64d468f1f5bab0e2cfabcb02b9fe9f0b">PxCloth</a>
<li>setCollisionPlanes()
: <a class="el" href="classPxCloth.html#c9fb679ec22ccad7ba5ea9b2397873d6">PxCloth</a>
<li>setCollisionSpheres()
: <a class="el" href="classPxCloth.html#d4bde7978010861d13207ba2dcd36b7a">PxCloth</a>
<li>setCollisionTriangles()
: <a class="el" href="classPxCloth.html#62d56093aa47f45a263c62721bd12530">PxCloth</a>
<li>setCompletionTask()
: <a class="el" href="classphysx_1_1PxGpuTask.html#70580dd1b3cfde44c4cbb66064cdab4c">physx::PxGpuTask</a>
<li>setConstraintFlag()
: <a class="el" href="classPxJoint.html#5bbf2a4196e036d711eea9bd5e542ce9">PxJoint</a>
<li>setConstraintFlags()
: <a class="el" href="classPxJoint.html#857ea5abc40d94b0e1537b566a9d45bf">PxJoint</a>
<li>setConstraintFunctions()
: <a class="el" href="classPxConstraint.html#3fb6da793a10be50c30bb8e3fb175d68">PxConstraint</a>
<li>setContactModifyCallback()
: <a class="el" href="classPxScene.html#eec3367a4461c1ab2e552acdb8c0609e">PxScene</a>
<li>setContactOffset()
: <a class="el" href="classPxShape.html#07c638b68e14de5e284a03dbcc128d27">PxShape</a>
, <a class="el" href="classPxController.html#6bf15ba0b66b3f271fdb2f2c6cb8c68b">PxController</a>
, <a class="el" href="classPxCloth.html#04c2915cae434276ab7b60dcffa6f096">PxCloth</a>
, <a class="el" href="classPxParticleBase.html#1daf9cb4e5b4a0abbfee215c144582e4">PxParticleBase</a>
<li>setContactReportThreshold()
: <a class="el" href="classPxRigidDynamic.html#bfd510964f2287e81fe76a1a9e1725b5">PxRigidDynamic</a>
<li>setContextId()
: <a class="el" href="classphysx_1_1PxBaseTask.html#0fa6ca56b758ea6b8be5c3acc8e89364">physx::PxBaseTask</a>
<li>setContinuation()
: <a class="el" href="classphysx_1_1PxLightCpuTask.html#56ef764508a2bbc98d82bb6dbb09fa3e">physx::PxLightCpuTask</a>
<li>setCpuDispatcher()
: <a class="el" href="classphysx_1_1PxTaskManager.html#c391319b63678f793dc6800b5ecda801">physx::PxTaskManager</a>
<li>setCurrentGear()
: <a class="el" href="classPxVehicleDriveDynData.html#a7f0d12794afa5fcfa1b5ede6bd2539d">PxVehicleDriveDynData</a>
<li>setDamping()
: <a class="el" href="classPxArticulationJoint.html#e9a7c940a51ae6df5e7e2370692a1f4b">PxArticulationJoint</a>
, <a class="el" href="classPxDistanceJoint.html#1fcc6660ac4544d477582057ebff39de">PxDistanceJoint</a>
, <a class="el" href="classPxParticleBase.html#8fb190deeb6744368762b296d8819eeb">PxParticleBase</a>
<li>setDampingCoefficient()
: <a class="el" href="classPxCloth.html#6d636bc91871e6cde3535c72bfbc2f53">PxCloth</a>
<li>setDebugRenderingFlags()
: <a class="el" href="classPxControllerManager.html#6748551f35cb6eee1048e810f09fb9b9">PxControllerManager</a>
<li>setDiffData()
: <a class="el" href="classPxVehicleDriveSimData4W.html#6a0bd7a643cdba6571de4470ddb8533b">PxVehicleDriveSimData4W</a>
, <a class="el" href="classPxVehicleDriveSimDataNW.html#ff36d113c311cc254834efe8cc3d3964">PxVehicleDriveSimDataNW</a>
<li>setDigitalAccel()
: <a class="el" href="classPxVehicleDrive4WRawInputData.html#39a229c2fbc12f23ab146a6ce6b014ee">PxVehicleDrive4WRawInputData</a>
, <a class="el" href="classPxVehicleDriveTankRawInputData.html#ba1a38302de5b91b35c83d79053fc564">PxVehicleDriveTankRawInputData</a>
<li>setDigitalBrake()
: <a class="el" href="classPxVehicleDrive4WRawInputData.html#a5a7c8943c3ad9b20901988388614505">PxVehicleDrive4WRawInputData</a>
<li>setDigitalHandbrake()
: <a class="el" href="classPxVehicleDrive4WRawInputData.html#d63aa0083730fbafb77e60b76fc9c985">PxVehicleDrive4WRawInputData</a>
<li>setDigitalLeftBrake()
: <a class="el" href="classPxVehicleDriveTankRawInputData.html#96183c87242fda2d2ed1ca56fb24977d">PxVehicleDriveTankRawInputData</a>
<li>setDigitalLeftThrust()
: <a class="el" href="classPxVehicleDriveTankRawInputData.html#e5379f5da9762716cf7d567af369ed1e">PxVehicleDriveTankRawInputData</a>
<li>setDigitalRightBrake()
: <a class="el" href="classPxVehicleDriveTankRawInputData.html#d98a22d3fcdbaf1f2731e3072d3315c6">PxVehicleDriveTankRawInputData</a>
<li>setDigitalRightThrust()
: <a class="el" href="classPxVehicleDriveTankRawInputData.html#a4981fac8d036a4616ba2980f757e3ab">PxVehicleDriveTankRawInputData</a>
<li>setDigitalSteerLeft()
: <a class="el" href="classPxVehicleDrive4WRawInputData.html#c0bee2d84b744b13af694bf34384bb76">PxVehicleDrive4WRawInputData</a>
<li>setDigitalSteerRight()
: <a class="el" href="classPxVehicleDrive4WRawInputData.html#a4654bf9fa296e6e2fe3433cc1a79918">PxVehicleDrive4WRawInputData</a>
<li>setDistanceJointFlag()
: <a class="el" href="classPxDistanceJoint.html#ec3a1147c1d87db4fdf4573f9f190bfa">PxDistanceJoint</a>
<li>setDistanceJointFlags()
: <a class="el" href="classPxDistanceJoint.html#7ecea55140d9946b94279b1730507062">PxDistanceJoint</a>
<li>setDominanceGroup()
: <a class="el" href="classPxActor.html#614c46687cf76eb219ce47927fc90824">PxActor</a>
<li>setDominanceGroupPair()
: <a class="el" href="classPxScene.html#b6d9e986e6af967d2bd60a63a0b550c4">PxScene</a>
<li>setDownRatios()
: <a class="el" href="classPxVehicleAutoBoxData.html#a2353fe51236e4d02924eff9bccd94b2">PxVehicleAutoBoxData</a>
<li>setDragCoefficient()
: <a class="el" href="classPxCloth.html#e985ceb77e39016e6945b1bfbf51cd36">PxCloth</a>
<li>setDrive()
: <a class="el" href="classPxD6Joint.html#85811f1770be8ff4ea79b4e49b313599">PxD6Joint</a>
<li>setDriveForceLimit()
: <a class="el" href="classPxRevoluteJoint.html#2c51c5a515957c48e7a82d78947a1b0f">PxRevoluteJoint</a>
<li>setDriveGearRatio()
: <a class="el" href="classPxRevoluteJoint.html#b5bd3ea301323d7e8ef6b1db08b8834c">PxRevoluteJoint</a>
<li>setDriveModel()
: <a class="el" href="classPxVehicleDriveTank.html#dc228416d792c11e78d41028bf24fad6">PxVehicleDriveTank</a>
<li>setDrivenWheel()
: <a class="el" href="classPxVehicleDifferentialNWData.html#c8976b0853cae0c7baf95603aa1909f9">PxVehicleDifferentialNWData</a>
<li>setDrivenWheelStatus()
: <a class="el" href="classPxVehicleDifferentialNWData.html#9041277bd53d21ad9992365185f9a06e">PxVehicleDifferentialNWData</a>
<li>setDrivePosition()
: <a class="el" href="classPxD6Joint.html#22471ee961a299903402b10d786d36c7">PxD6Joint</a>
<li>setDriveTorque()
: <a class="el" href="classPxVehicleNoDrive.html#2cee320c1b39eb72f8350e63ae5fd749">PxVehicleNoDrive</a>
<li>setDriveType()
: <a class="el" href="classPxArticulationJoint.html#d9ca201e90b380133e8913fb756a52e2">PxArticulationJoint</a>
<li>setDriveVelocity()
: <a class="el" href="classPxD6Joint.html#f23b422a5ed89350c0f04664ae2351cc">PxD6Joint</a>
, <a class="el" href="classPxRevoluteJoint.html#3b468f55536921dd3f505883df1aa661">PxRevoluteJoint</a>
<li>setDynamicFriction()
: <a class="el" href="classPxContactSet.html#360344f51cce5d01c69701e3dcc3747b">PxContactSet</a>
, <a class="el" href="classPxMaterial.html#971a4c6a385310c28aaeaa1f5ead78e9">PxMaterial</a>
, <a class="el" href="classPxParticleBase.html#d95b342c529785ca7e126605804ccfbb">PxParticleBase</a>
<li>setDynamicTreeRebuildRateHint()
: <a class="el" href="classPxScene.html#bf2322887ca4db2fdea0229a44e2892c">PxScene</a>
<li>setEmpty()
: <a class="el" href="group__foundation.html#g9e31f59de4ce4f4ad1f1e51c401ac5fd">PxBounds3</a>
<li>setEndianMode()
: <a class="el" href="classPxFileBuf.html#f72ea9fc1222848db164855a3d8f8b70">PxFileBuf</a>
<li>setEngineData()
: <a class="el" href="classPxVehicleDriveSimData.html#7bc4349466a64ab5b50f8e0a847e1a2f">PxVehicleDriveSimData</a>
<li>setEngineRotationSpeed()
: <a class="el" href="classPxVehicleDriveDynData.html#881b76d5ad721e3e48fa68466e3dbee6">PxVehicleDriveDynData</a>
<li>setErrorLevel()
: <a class="el" href="classPxFoundation.html#ac16a599bd1ffc725f849703e7eb5696">PxFoundation</a>
<li>setExternalAcceleration()
: <a class="el" href="classPxCloth.html#e13130b689712c14e2c98f4d98d5fd1a">PxCloth</a>
, <a class="el" href="classPxParticleBase.html#b43431b492105e432f1f5eb33fabd0c4">PxParticleBase</a>
<li>setExternalCompliance()
: <a class="el" href="classPxArticulationJoint.html#cba73835e3bdfb85a362e59ba979a959">PxArticulationJoint</a>
<li>setExternalDriveIterations()
: <a class="el" href="classPxArticulation.html#767fb3ec58b891bcd8dd0d769a5789cf">PxArticulation</a>
<li>setFilterShaderData()
: <a class="el" href="classPxScene.html#5ab05d2a2c908d98aed4ca642c5f394d">PxScene</a>
<li>setFlag()
: <a class="el" href="classPxConstraint.html#95488eea1d5847d3d1408c3d5cdf2576">PxConstraint</a>
, <a class="el" href="classPxMaterial.html#3dbcd175e805766442291c1285eafe8c">PxMaterial</a>
, <a class="el" href="classPxScene.html#6610c08a5a92c894dcac9d658e48b7de">PxScene</a>
, <a class="el" href="classPxShape.html#3c879df184ef40514589c5aa3d1f2a33">PxShape</a>
<li>setFlags()
: <a class="el" href="classPxConstraint.html#2d697724814976973b1de9e303e15b3f">PxConstraint</a>
, <a class="el" href="classPxMaterial.html#452856bae712ad60a281ec45a4bd69a9">PxMaterial</a>
, <a class="el" href="classPxShape.html#fc179cb4b2146af98c76623d2fc0db6e">PxShape</a>
<li>setFootPosition()
: <a class="el" href="classPxController.html#b09889972859bf03168d1d48434094ff">PxController</a>
<li>setFrictionCoefficient()
: <a class="el" href="classPxCloth.html#11c07c5b385688e921d950f50ccf8e24">PxCloth</a>
<li>setFrictionCombineMode()
: <a class="el" href="classPxMaterial.html#15c32fcd28a63a02caad0247dd2e9835">PxMaterial</a>
<li>setFrictionType()
: <a class="el" href="classPxScene.html#9ff7784b4d51acf2d56b9462e256b58b">PxScene</a>
<li>setGearChange()
: <a class="el" href="classPxVehicleDriveDynData.html#ea22183763d8431279917949fb5be912">PxVehicleDriveDynData</a>
<li>setGearDown()
: <a class="el" href="classPxVehicleDriveDynData.html#0e31ae1c0d74b575ac10494e94fb325c">PxVehicleDriveDynData</a>
, <a class="el" href="classPxVehicleDrive4WRawInputData.html#5849bbe5d93b0a6178fe05413fd2f38e">PxVehicleDrive4WRawInputData</a>
, <a class="el" href="classPxVehicleDriveTankRawInputData.html#4ff7609f917b69e7bc329540b2c3aaa2">PxVehicleDriveTankRawInputData</a>
<li>setGearRatio()
: <a class="el" href="classPxVehicleGearsData.html#3e3deb6f0ea5abe0eb4602adb0d3291d">PxVehicleGearsData</a>
<li>setGearsData()
: <a class="el" href="classPxVehicleDriveSimData.html#6596d7535d54f6a43a6575b8f4c51748">PxVehicleDriveSimData</a>
<li>setGearSwitchTime()
: <a class="el" href="classPxVehicleDriveDynData.html#8a42ae9182f4e9375b94a19787dafa30">PxVehicleDriveDynData</a>
<li>setGearUp()
: <a class="el" href="classPxVehicleDriveDynData.html#fd97592ae5714d45c494957808fa7020">PxVehicleDriveDynData</a>
, <a class="el" href="classPxVehicleDrive4WRawInputData.html#dd91327bf12c6c5578e20d9df82d0432">PxVehicleDrive4WRawInputData</a>
, <a class="el" href="classPxVehicleDriveTankRawInputData.html#0093f8a955f714617b1269a652f0c709">PxVehicleDriveTankRawInputData</a>
<li>setGeometry()
: <a class="el" href="classPxShape.html#c6112e8c0ee9803eb3436bbaf673d98a">PxShape</a>
<li>setGlobalPose()
: <a class="el" href="classPxRigidActor.html#26994d9594ed9a04bd412bdeb2a55f3e">PxRigidActor</a>
, <a class="el" href="classPxCloth.html#e5b64a8e0ff184cf5ef76a5c6dd52ede">PxCloth</a>
<li>setGpuDispatcher()
: <a class="el" href="classphysx_1_1PxTaskManager.html#2222879a9e1f258c3d46579f56d65275">physx::PxTaskManager</a>
<li>setGravity()
: <a class="el" href="classPxScene.html#575ed34c73adbd61892d728a688479f3">PxScene</a>
<li>setGridSize()
: <a class="el" href="classPxParticleBase.html#f484aea29669a33f8bf78465d2d2f8b4">PxParticleBase</a>
<li>setHalfForwardExtent()
: <a class="el" href="classPxBoxController.html#cae44a6bab0ca9da6d47b84345d03e61">PxBoxController</a>
<li>setHalfHeight()
: <a class="el" href="classPxBoxController.html#f959bc51b41f2c00156cd28bd19fc240">PxBoxController</a>
<li>setHalfSideExtent()
: <a class="el" href="classPxBoxController.html#f1b0b85810c79821ddb61cb42d0ef730">PxBoxController</a>
<li>setHeight()
: <a class="el" href="classPxCapsuleController.html#8068e1a64b40a6c6a96bd30ba1db0883">PxCapsuleController</a>
<li>setHighForwardSpeedSubStepCount()
: <a class="el" href="classPxVehicleWheelsSimData.html#d959b05b234cf8b132d3e0a62072641a">PxVehicleWheelsSimData</a>
<li>setIncrementalRebuildRate()
: <a class="el" href="classPxSpatialIndex.html#c1d1711a3dc99f9bb244ca0d2ea78f5f">PxSpatialIndex</a>
<li>setInertiaScale()
: <a class="el" href="classPxCloth.html#ae66828d50e4ee25ed06a5abdf87bb5c">PxCloth</a>
<li>setInternalCompliance()
: <a class="el" href="classPxArticulationJoint.html#023d58f64e1e29a984beb935ca2a4f54">PxArticulationJoint</a>
<li>setInternalDriveIterations()
: <a class="el" href="classPxArticulation.html#cda14790e09cb759007038d35885065a">PxArticulation</a>
<li>setInvInertiaScale0()
: <a class="el" href="classPxContactSet.html#e145d9eec7403316390478f401837dcf">PxContactSet</a>
, <a class="el" href="classPxJoint.html#97cc4d817e404177af4c2a598bb944c3">PxJoint</a>
<li>setInvInertiaScale1()
: <a class="el" href="classPxContactSet.html#74a22b5ae3140aba546b66415427a7d5">PxContactSet</a>
, <a class="el" href="classPxJoint.html#d733659ee380ebf04a5d1d50fcf46222">PxJoint</a>
<li>setInvMassScale0()
: <a class="el" href="classPxContactSet.html#74648acc75bce20cfd555e76298b514f">PxContactSet</a>
, <a class="el" href="classPxJoint.html#df8d09205b60811980a2202f1265562b">PxJoint</a>
<li>setInvMassScale1()
: <a class="el" href="classPxContactSet.html#d77be76292fb196ff129d70c372c5d97">PxContactSet</a>
, <a class="el" href="classPxJoint.html#2f5f6c66b5e6933f8578a880a4a957ad">PxJoint</a>
<li>setKinematicTarget()
: <a class="el" href="classPxRigidDynamic.html#4464d188e7a1e94582c9cf35da9bbc93">PxRigidDynamic</a>
<li>setLatency()
: <a class="el" href="classPxVehicleAutoBoxData.html#b58a308ce4750594e3335d953d70281c">PxVehicleAutoBoxData</a>
<li>setLimit()
: <a class="el" href="classPxPrismaticJoint.html#7831c090d462d38eb7ba8e2fd25bc751">PxPrismaticJoint</a>
, <a class="el" href="classPxRevoluteJoint.html#d28e13ae7149b0a09f8b5a9d8beaae60">PxRevoluteJoint</a>
<li>setLimitCone()
: <a class="el" href="classPxSphericalJoint.html#7ca415d2d986e63c5d5fa86dde583e6c">PxSphericalJoint</a>
<li>setLimits()
: <a class="el" href="classPxScene.html#1c9025d9a26efa7b90c8c75cb7126b92">PxScene</a>
<li>setLinearDamping()
: <a class="el" href="classPxRigidDynamic.html#003953e985ace5966375acb0674f7b0b">PxRigidDynamic</a>
<li>setLinearDragCoefficient()
: <a class="el" href="classPxCloth.html#04fcc059b87d0011a1fc01979ea47bd2">PxCloth</a>
<li>setLinearInertiaScale()
: <a class="el" href="classPxCloth.html#a7ea423a0eca321e2b6aebd436792832">PxCloth</a>
<li>setLinearLimit()
: <a class="el" href="classPxD6Joint.html#8ceb03a43499c3f85a01ba00eea0c034">PxD6Joint</a>
<li>setLinearVelocity()
: <a class="el" href="classPxRigidBody.html#0aed51d5ddcf81b09a104ad7f0f30c05">PxRigidBody</a>
<li>setLocalPose()
: <a class="el" href="classPxShape.html#9f32c7cea3b5701de3f815cd64c978df">PxShape</a>
, <a class="el" href="classPxJoint.html#7bb7f7676c3660945356ef6e726c48b3">PxJoint</a>
<li>setLowForwardSpeedSubStepCount()
: <a class="el" href="classPxVehicleWheelsSimData.html#0fd598dcbca75814aab13fb002cac976">PxVehicleWheelsSimData</a>
<li>setMass()
: <a class="el" href="classPxRigidBody.html#8a697a7a4b9bdd2c83a68e84b9bc3a35">PxRigidBody</a>
<li>setMassAndPreserveNaturalFrequency()
: <a class="el" href="classPxVehicleSuspensionData.html#2bec1ac8b8808407d0af0accfcc21e57">PxVehicleSuspensionData</a>
<li>setMassAndUpdateInertia()
: <a class="el" href="classPxRigidBodyExt.html#b8f6af57a0fde875c41e5d747dec49fb">PxRigidBodyExt</a>
<li>setMassSpaceInertiaTensor()
: <a class="el" href="classPxRigidBody.html#755d0c8a8d1dd8b29e59d50a6dfda5fd">PxRigidBody</a>
<li>setMaterials()
: <a class="el" href="classPxShape.html#14fbf4de00134d17b85194487d68ff30">PxShape</a>
<li>setMaxAngularVelocity()
: <a class="el" href="classPxRigidDynamic.html#d90b8ba1636cfef0e3e2386bc21dc3f1">PxRigidDynamic</a>
<li>setMaxContactImpulse()
: <a class="el" href="classPxRigidBody.html#1a3bbe100e644995742f80f19ea8f250">PxRigidBody</a>
<li>setMaxDepenetrationVelocity()
: <a class="el" href="classPxRigidBody.html#261ce18fdc6cb81c0bfb46590db0867d">PxRigidBody</a>
<li>setMaxDistance()
: <a class="el" href="classPxDistanceJoint.html#a1f0551bbf0f5cac9878e41525d67e9a">PxDistanceJoint</a>
<li>setMaximal()
: <a class="el" href="group__foundation.html#g125e6c8496174f5aee6b53c2ecd9ba75">PxBounds3</a>
<li>setMaxImpulse()
: <a class="el" href="classPxContactSet.html#145d98e983e46057f0fa57903f671c06">PxContactSet</a>
<li>setMaxMotionDistance()
: <a class="el" href="classPxParticleBase.html#0e768c7a7e0375b870078d45c890721e">PxParticleBase</a>
<li>setMaxNbDynamicShapes()
: <a class="el" href="classPxVolumeCache.html#30048238aa971768c4bf24c56d186d7c">PxVolumeCache</a>
<li>setMaxNbStaticShapes()
: <a class="el" href="classPxVolumeCache.html#7c239abc1d93b2dea0cec7ae68d93319">PxVolumeCache</a>
<li>setMaxProjectionIterations()
: <a class="el" href="classPxArticulation.html#4154ccfb1afad6e3b8145a67e7f580bd">PxArticulation</a>
<li>setMetaData()
: <a class="el" href="classPxBinaryConverter.html#475c6a6dc11b63b3570f2fc5d21b5c0e">PxBinaryConverter</a>
<li>setMinCCDAdvanceCoefficient()
: <a class="el" href="classPxRigidBody.html#c6f4fe582726801cb09c2381de0c144d">PxRigidBody</a>
<li>setMinDistance()
: <a class="el" href="classPxDistanceJoint.html#1b58a39c6c0fa2cca1ea52a8da949e9b">PxDistanceJoint</a>
<li>setMinLongSlipDenominator()
: <a class="el" href="classPxVehicleWheelsSimData.html#940016ddd052f0c763a21fe776fdcc9d">PxVehicleWheelsSimData</a>
<li>setMinResponseThreshold()
: <a class="el" href="classPxConstraint.html#9ddd5450fca029d9574b5c854b77d3d6">PxConstraint</a>
<li>setMinusInfinity()
: <a class="el" href="structPxExtendedVec3.html#a69612b215b58d3cdafb51f66a622a7b">PxExtendedVec3</a>
<li>setMotion()
: <a class="el" href="classPxD6Joint.html#6253223e558ef6c3fd22a4d558dee97d">PxD6Joint</a>
<li>setMotionConstraintConfig()
: <a class="el" href="classPxCloth.html#161c0d634e0650187b0f737873bcca17">PxCloth</a>
<li>setMotionConstraints()
: <a class="el" href="classPxCloth.html#0ccf1ef6c461898826b66f285e8c9f6a">PxCloth</a>
<li>setName()
: <a class="el" href="classPxActor.html#fdcfb185892a5c8311fd0d825b0ce758">PxActor</a>
, <a class="el" href="classPxArticulation.html#1efa57c3102cb6258ee90ac70a3c2657">PxArticulation</a>
, <a class="el" href="classPxShape.html#51a289ac174c48ccc8d0b09d3fd90508">PxShape</a>
, <a class="el" href="classPxJoint.html#79fbf86820e6ac2b1e5aedf13478e3c4">PxJoint</a>
<li>setNbContactDataBlocks()
: <a class="el" href="classPxScene.html#148be23880c4e2d67f9f772066a9f966">PxScene</a>
<li>setNonWalkableMode()
: <a class="el" href="classPxController.html#8f30123d5e7d45c6fdb1992cf8c748ef">PxController</a>
<li>setNormal()
: <a class="el" href="classPxContactSet.html#fdc45b285e1aaedd29690571b2098daa">PxContactSet</a>
<li>setOverlapRecoveryModule()
: <a class="el" href="classPxControllerManager.html#7b82dfa1f30ab934fa287f1e3aabf3cf">PxControllerManager</a>
<li>setOwnerClient()
: <a class="el" href="classPxActor.html#9bb8613863cf1d73e4d0c0227f25bc6e">PxActor</a>
<li>setParams()
: <a class="el" href="classPxCooking.html#febe112057bd03660dd78dee384d5321">PxCooking</a>
<li>setParentPose()
: <a class="el" href="classPxArticulationJoint.html#8dd529f6924fa777f99c1d646ef3bca6">PxArticulationJoint</a>
<li>setParticleAccelerations()
: <a class="el" href="classPxCloth.html#4f41c83d95eef0f7ed3894920cb7556d">PxCloth</a>
<li>setParticleBaseFlag()
: <a class="el" href="classPxParticleBase.html#4445c7746cfd5cbcda51173d0cf5c93a">PxParticleBase</a>
<li>setParticleMass()
: <a class="el" href="classPxParticleBase.html#80881666e5ee6743b6ac2c1f8723ce19">PxParticleBase</a>
<li>setParticleReadDataFlag()
: <a class="el" href="classPxParticleBase.html#9fbba67f740bc2b915ce0eb8d5c1b099">PxParticleBase</a>
<li>setParticles()
: <a class="el" href="classPxCloth.html#45c9ddfe6fdadcb99dc26c41eea2afb9">PxCloth</a>
<li>setPlusInfinity()
: <a class="el" href="structPxExtendedVec3.html#6b892692e4990c404ba6170cd3da5d13">PxExtendedVec3</a>
<li>setPoint()
: <a class="el" href="classPxContactSet.html#21cfe31aa14065c8b3ee6390c312e178">PxContactSet</a>
<li>setPosition()
: <a class="el" href="classPxController.html#2687b4fabb77f2998ce31bffccc74a78">PxController</a>
, <a class="el" href="classPxMat44.html#54b4c7e35d3ac0e4639dedba56d39e71">PxMat44</a>
<li>setPositions()
: <a class="el" href="classPxParticleBase.html#4fba51bed2ec1b3445885916350b10d5">PxParticleBase</a>
<li>setPreciseSweeps()
: <a class="el" href="classPxControllerManager.html#aa88f335b64ec33775ec73fb532c920f">PxControllerManager</a>
<li>setPreventVerticalSlidingAgainstCeiling()
: <a class="el" href="classPxControllerManager.html#aa9553cd92772fcfc583aff5678f7ef0">PxControllerManager</a>
<li>setPrismaticJointFlag()
: <a class="el" href="classPxPrismaticJoint.html#6d20577d885f919eeee64e9daba76679">PxPrismaticJoint</a>
<li>setPrismaticJointFlags()
: <a class="el" href="classPxPrismaticJoint.html#0041ced8b6962072214dc81032ed2a2d">PxPrismaticJoint</a>
<li>setProjectionAngularTolerance()
: <a class="el" href="classPxFixedJoint.html#cb90411048d18e7e09aa3f1e4ece7609">PxFixedJoint</a>
, <a class="el" href="classPxD6Joint.html#ba8db764141f62a0a160a0752e7e65d7">PxD6Joint</a>
, <a class="el" href="classPxPrismaticJoint.html#f1a04172a838d1a1ee741d7471f4d62d">PxPrismaticJoint</a>
, <a class="el" href="classPxRevoluteJoint.html#3b088a58542f57366da55fa0fcf56f25">PxRevoluteJoint</a>
<li>setProjectionLinearTolerance()
: <a class="el" href="classPxD6Joint.html#acb253ce8a5aad477afd96f1202d4b61">PxD6Joint</a>
, <a class="el" href="classPxFixedJoint.html#45f16f6dc31f103ea8bef435b6bd0e5f">PxFixedJoint</a>
, <a class="el" href="classPxPrismaticJoint.html#01d904a1fd7a2394c44ee39efcbdd6f2">PxPrismaticJoint</a>
, <a class="el" href="classPxRevoluteJoint.html#3f96f9a0b8a5464a25452bb5aea51184">PxRevoluteJoint</a>
, <a class="el" href="classPxSphericalJoint.html#73173f0db2281377b91fe3b58b22001d">PxSphericalJoint</a>
<li>setProjectionPlane()
: <a class="el" href="classPxParticleBase.html#59216c6fd900d478cd1e75b0a34b37af">PxParticleBase</a>
<li>setQueryFilterData()
: <a class="el" href="classPxShape.html#c98191c26e55ecebfd9eb4553c969fab">PxShape</a>
<li>setRadius()
: <a class="el" href="classPxCapsuleController.html#a568af92bc897e9242c063d50c71cfd2">PxCapsuleController</a>
<li>setReportAllocationNames()
: <a class="el" href="classPxFoundation.html#10a9bd2dc04b64b17a6bb624872b565d">PxFoundation</a>
<li>setReportMode()
: <a class="el" href="classPxBinaryConverter.html#ba26eda3b46071eca65fa38cabee2a09">PxBinaryConverter</a>
<li>setRestitution()
: <a class="el" href="classPxContactSet.html#2c1f31f9201c804d6310ec0129cc0cea">PxContactSet</a>
, <a class="el" href="classPxMaterial.html#9038f690c180b962a7543734f44ec0f1">PxMaterial</a>
, <a class="el" href="classPxParticleBase.html#7dc8dc59b5032d7e4ebd9d901df20a3d">PxParticleBase</a>
<li>setRestitutionCombineMode()
: <a class="el" href="classPxMaterial.html#8f9930b0e18a932e428a061891e4683f">PxMaterial</a>
<li>setRestOffset()
: <a class="el" href="classPxShape.html#413afb25b39a7a0cf0981aa01c6d7f8b">PxShape</a>
, <a class="el" href="classPxCloth.html#b613c92ba9a4d334536c9d97d87a13df">PxCloth</a>
, <a class="el" href="classPxParticleBase.html#9c5759758c6fcaf61759dacea5d4653d">PxParticleBase</a>
<li>setRestOffsets()
: <a class="el" href="classPxParticleBase.html#4b193d290509a4442ed0110580a16447">PxParticleBase</a>
<li>setRestParticleDistance()
: <a class="el" href="classPxParticleFluid.html#6f649af954b4fda3c6a72e689637e07f">PxParticleFluid</a>
<li>setRestPositions()
: <a class="el" href="classPxCloth.html#0184c7d7f20110fdee01b1c485bb7a63">PxCloth</a>
<li>setRevoluteJointFlag()
: <a class="el" href="classPxRevoluteJoint.html#794f81a2e8668928669e2d89a15e2558">PxRevoluteJoint</a>
<li>setRevoluteJointFlags()
: <a class="el" href="classPxRevoluteJoint.html#10854c64ba8d56db2b7bddc26118393e">PxRevoluteJoint</a>
<li>setRigidBodyFlag()
: <a class="el" href="classPxRigidBody.html#9b23b890404b1010bf0b67a225bd22e7">PxRigidBody</a>
<li>setRigidBodyFlags()
: <a class="el" href="classPxRigidBody.html#9e6f3afd71605e037a5de47955d941e0">PxRigidBody</a>
<li>setRigidDynamicLockFlag()
: <a class="el" href="classPxRigidDynamic.html#7cf3e84117da3ec5b499262a3a9f5521">PxRigidDynamic</a>
<li>setRigidDynamicLockFlags()
: <a class="el" href="classPxRigidDynamic.html#16f9f0dfeae6e7877bcebca80df42c92">PxRigidDynamic</a>
<li>setRunProfiled()
: <a class="el" href="classPxDefaultCpuDispatcher.html#ccb465b8fcfd7f5e257e2e6f042703f1">PxDefaultCpuDispatcher</a>
<li>setScenePvdFlag()
: <a class="el" href="classPxPvdSceneClient.html#3b5e6327978fbe7a39fd53478da0c588">PxPvdSceneClient</a>
<li>setScenePvdFlags()
: <a class="el" href="classPxPvdSceneClient.html#74a77b0f48b6d0f9394ed7daa9c2c957">PxPvdSceneClient</a>
<li>setSceneQueryFilterData()
: <a class="el" href="classPxVehicleWheelsSimData.html#be8c9e522970df21292a0e8dfa5e2463">PxVehicleWheelsSimData</a>
<li>setSceneQueryUpdateMode()
: <a class="el" href="classPxScene.html#8b689efc2353e9c57abf0182cb3f7dfd">PxScene</a>
<li>setSelfCollisionDistance()
: <a class="el" href="classPxCloth.html#8a9395c7ef65990a78a8654eedd70eef">PxCloth</a>
<li>setSelfCollisionIndices()
: <a class="el" href="classPxCloth.html#3d1655d3a49678ac120e60e5f5d0cb74">PxCloth</a>
<li>setSelfCollisionStiffness()
: <a class="el" href="classPxCloth.html#444689a873e29404153b54e06c7f21f6">PxCloth</a>
<li>setSeparation()
: <a class="el" href="classPxContactSet.html#dd1b219393a21fdbb6e6db51400aa900">PxContactSet</a>
<li>setSeparationConstraints()
: <a class="el" href="classPxCloth.html#8cdc9a3c9faebf80d20e6e821c83834b">PxCloth</a>
<li>setSeparationTolerance()
: <a class="el" href="classPxArticulation.html#284072a943c7e9caa992c513e0855aaf">PxArticulation</a>
<li>setSimulationEventCallback()
: <a class="el" href="classPxScene.html#88f5438bf61cf5c3f767d8b515c51d31">PxScene</a>
<li>setSimulationFilterData()
: <a class="el" href="classPxShape.html#a0c62176ed01c9fb14c26ad7c393963c">PxShape</a>
, <a class="el" href="classPxCloth.html#b25c6eba3fdd622cf24bb768b9c9010a">PxCloth</a>
, <a class="el" href="classPxParticleBase.html#c9babb704b6400ee1a11b1d17439b362">PxParticleBase</a>
<li>setSleepLinearVelocity()
: <a class="el" href="classPxCloth.html#f333884779888e3cbb11033877fe0638">PxCloth</a>
<li>setSleepThreshold()
: <a class="el" href="classPxArticulation.html#e7e4735b8c23aaf5f41d829208cccce6">PxArticulation</a>
, <a class="el" href="classPxRigidDynamic.html#c087213f7360a202eaccfab26e97e644">PxRigidDynamic</a>
<li>setSlopeLimit()
: <a class="el" href="classPxController.html#5e3a554fe03319301360df65122f22c8">PxController</a>
<li>setSolverBatchSize()
: <a class="el" href="classPxScene.html#ad9cc8bf329f4de4b407436f5cd38c98">PxScene</a>
<li>setSolverFrequency()
: <a class="el" href="classPxCloth.html#f5d725608c3f0cd3a7c3b67743e14aac">PxCloth</a>
<li>setSolverIterationCounts()
: <a class="el" href="classPxArticulation.html#f31eb23f85c5a8516612cad455d4fef3">PxArticulation</a>
, <a class="el" href="classPxRigidDynamic.html#fa68d947962bc2d0f8862caaf3e8b304">PxRigidDynamic</a>
<li>setSphericalJointFlag()
: <a class="el" href="classPxSphericalJoint.html#0cff21b619ff48b2ca974df7f0e38ebb">PxSphericalJoint</a>
<li>setSphericalJointFlags()
: <a class="el" href="classPxSphericalJoint.html#3f3dd6934d09d6bc1605e53c15e45ab7">PxSphericalJoint</a>
<li>setStabilizationThreshold()
: <a class="el" href="classPxRigidDynamic.html#59fb22d9402497cffe1b5e54d9ecd62f">PxRigidDynamic</a>
, <a class="el" href="classPxArticulation.html#259748392f6223dc218d1e1ba8ee9944">PxArticulation</a>
<li>setStaticFriction()
: <a class="el" href="classPxContactSet.html#8c585855a8936d762520b1d1471bf3fe">PxContactSet</a>
, <a class="el" href="classPxMaterial.html#0384706084d22fe2ec745bc81d54ef14">PxMaterial</a>
, <a class="el" href="classPxParticleBase.html#3fb596178c017ed1c536c152e4fba358">PxParticleBase</a>
<li>setSteerAngle()
: <a class="el" href="classPxVehicleNoDrive.html#362899ae429c39a05703223bb8fdba0f">PxVehicleNoDrive</a>
<li>setStepOffset()
: <a class="el" href="classPxController.html#6cad9ee5c32ccbf80ec47465a07dcdc3">PxController</a>
<li>setStiffness()
: <a class="el" href="classPxArticulationJoint.html#e00f55560d4d4b78a20d97b20e39dafb">PxArticulationJoint</a>
, <a class="el" href="classPxDistanceJoint.html#2ac2f3e6b8afe91d7b39e34e34310e28">PxDistanceJoint</a>
, <a class="el" href="classPxParticleFluid.html#334f8a10e7d00c29f3989b906b429fc5">PxParticleFluid</a>
<li>setStiffnessFrequency()
: <a class="el" href="classPxCloth.html#3a353d83924d66f611186e0d8a046c63">PxCloth</a>
<li>setStretchConfig()
: <a class="el" href="classPxCloth.html#287124c7b4d26640849b8dd3489fff0d">PxCloth</a>
<li>setSubStepCount()
: <a class="el" href="classPxVehicleWheelsSimData.html#cbe6956ae50dfadcd9264ed9830da207">PxVehicleWheelsSimData</a>
<li>setSuspensionData()
: <a class="el" href="classPxVehicleWheelsSimData.html#2d919fecb713d371d2624e3b5b37053b">PxVehicleWheelsSimData</a>
<li>setSuspForceAppPointOffset()
: <a class="el" href="classPxVehicleWheelsSimData.html#cd51a38c9e5cf37b1c0b5feed7b03c04">PxVehicleWheelsSimData</a>
<li>setSuspTravelDirection()
: <a class="el" href="classPxVehicleWheelsSimData.html#13bf7c0a8e2765fa34146c7518950329">PxVehicleWheelsSimData</a>
<li>setSwingLimit()
: <a class="el" href="classPxD6Joint.html#72a1f48dffd418d278ec9beb110a9236">PxD6Joint</a>
, <a class="el" href="classPxArticulationJoint.html#12544e79ee2ef6ff061e6a3a9e1e65c8">PxArticulationJoint</a>
<li>setSwingLimitContactDistance()
: <a class="el" href="classPxArticulationJoint.html#909101d144f45f8fd8fbf1e2f01f9072">PxArticulationJoint</a>
<li>setSwingLimitEnabled()
: <a class="el" href="classPxArticulationJoint.html#c8f06505ec2b8bd187124008f428ce1e">PxArticulationJoint</a>
<li>setTangentialDamping()
: <a class="el" href="classPxArticulationJoint.html#9ba1951c929b003bf57dcea26756bf9f">PxArticulationJoint</a>
<li>setTangentialStiffness()
: <a class="el" href="classPxArticulationJoint.html#df1f03b5945c8db6103f6529736af5a8">PxArticulationJoint</a>
<li>setTargetGear()
: <a class="el" href="classPxVehicleDriveDynData.html#568663354ffa23f4b6f8d9a0194ea0e6">PxVehicleDriveDynData</a>
<li>setTargetOrientation()
: <a class="el" href="classPxArticulationJoint.html#c6f12118dc05485815cbe08df956b05c">PxArticulationJoint</a>
<li>setTargetPose()
: <a class="el" href="classPxCloth.html#ba7f7ca016a260f8bed962764814ade3">PxCloth</a>
<li>setTargetVelocity()
: <a class="el" href="classPxContactSet.html#2e374d99ff72fcf410a070ee3bf17abb">PxContactSet</a>
, <a class="el" href="classPxArticulationJoint.html#469427827733f35ba286f88b0e48984d">PxArticulationJoint</a>
<li>setTessellation()
: <a class="el" href="classPxControllerManager.html#801c7a25dc888d307bfee0e119e43724">PxControllerManager</a>
<li>setTessFlag()
: <a class="el" href="structPxHeightFieldSample.html#82ee14c99624ff3ace22e8408eea9935">PxHeightFieldSample</a>
<li>setTetherConfig()
: <a class="el" href="classPxCloth.html#b6f7f3f91fe4f2ed5e2620605c4723ff">PxCloth</a>
<li>setThresholdLongSpeed()
: <a class="el" href="classPxVehicleWheelsSimData.html#6b0a3e4cfee1def7c49905e193250e50">PxVehicleWheelsSimData</a>
<li>setTireData()
: <a class="el" href="classPxVehicleWheelsSimData.html#cfc01818dd853e393bf3d9ea4370441c">PxVehicleWheelsSimData</a>
<li>setTireForceAppPointOffset()
: <a class="el" href="classPxVehicleWheelsSimData.html#7914e9b4cbf6a5bbfce66d46f601b440">PxVehicleWheelsSimData</a>
<li>setTireForceShaderData()
: <a class="el" href="classPxVehicleWheelsDynData.html#25312456167dbd6611450a593444928e">PxVehicleWheelsDynData</a>
<li>setTireForceShaderFunction()
: <a class="el" href="classPxVehicleWheelsDynData.html#1d7405c9aeb529ca1a2bf945edd3d83f">PxVehicleWheelsDynData</a>
<li>setTireLoadFilterData()
: <a class="el" href="classPxVehicleWheelsSimData.html#f0b5eb7ae77c271ce3ba1604c8dad3b3">PxVehicleWheelsSimData</a>
<li>setToDefault()
: <a class="el" href="structPxBVH33MidphaseDesc.html#032c13ce0350dea8512f56b66f5a2744">PxBVH33MidphaseDesc</a>
, <a class="el" href="classPxMidphaseDesc.html#c941c94835e494ae0dcc3f774ac16240">PxMidphaseDesc</a>
, <a class="el" href="group__physics.html#ge673c050f15b0fc912860adbb3394e34">PxSceneLimits</a>
, <a class="el" href="group__character.html#gf2f271a2e1d38f619d345bd89f737412">PxBoxControllerDesc</a>
, <a class="el" href="structPxBVH34MidphaseDesc.html#c0848cd6f8b3b771e5e5761df2f6b033">PxBVH34MidphaseDesc</a>
, <a class="el" href="group__cooking.html#g6e86954b2426aae207489af9928d45e3">PxConvexMeshDesc</a>
, <a class="el" href="group__cooking.html#g3efcaf703b329270eed5b0890b0c5304">PxClothMeshDesc</a>
, <a class="el" href="group__geomutils.html#gd6110ba2e5505fb809d3c3ebeb82e2f5">PxSimpleTriangleMesh</a>
, <a class="el" href="group__particles.html#g565e686111afbbdaf07c2bd8b149efb6">PxParticleCreationData</a>
, <a class="el" href="group__geomutils.html#gdd7ec6c255262ddceeb7e04600bc47b5">PxHeightFieldDesc</a>
, <a class="el" href="group__cooking.html#gfd882da42844238f9a91e5754694391e">PxTriangleMeshDesc</a>
, <a class="el" href="group__cloth.html#g2a75f18d35312c00faeacf1e144af741">PxClothFabricDesc</a>
, <a class="el" href="structPxFilterData.html#d6d40431c37145235eaceea47f57b9b5">PxFilterData</a>
, <a class="el" href="group__character.html#g48c1aa8996f7a4686f65cf517fb466e5">PxCapsuleControllerDesc</a>
, <a class="el" href="group__physics.html#ga7375184ba494172fa7677dae44bd9a8">PxSceneDesc</a>
<li>setTolerance()
: <a class="el" href="classPxDistanceJoint.html#a4897db1805eea28a241867aaeb01d70">PxDistanceJoint</a>
<li>setToRestState()
: <a class="el" href="classPxVehicleDrive4W.html#37811fb8cf89260d45276a97b767acce">PxVehicleDrive4W</a>
, <a class="el" href="classPxVehicleDriveNW.html#a66886e48cb1b6e635e804ee8267e5b3">PxVehicleDriveNW</a>
, <a class="el" href="classPxVehicleWheels.html#38cf9474ad2c23ba3c21766fac251339">PxVehicleWheels</a>
, <a class="el" href="classPxVehicleDrive.html#a5fdf730d2b90e2fdbd2dd34d2a01765">PxVehicleDrive</a>
, <a class="el" href="classPxVehicleDriveTank.html#dbbad11dfa6fb32b6d209ddabf8f9132">PxVehicleDriveTank</a>
, <a class="el" href="classPxVehicleWheelsDynData.html#b760ac444b65311796ccf5a3bb3fafff">PxVehicleWheelsDynData</a>
, <a class="el" href="classPxVehicleDriveDynData.html#395909ff575722b78041d67a42fb62f3">PxVehicleDriveDynData</a>
, <a class="el" href="classPxVehicleNoDrive.html#284e8e6ff3c1617b8c39bab3edc217c7">PxVehicleNoDrive</a>
<li>setTwistLimit()
: <a class="el" href="classPxArticulationJoint.html#e3fc7d9b7c327b897a0a33c1844f03c4">PxArticulationJoint</a>
, <a class="el" href="classPxD6Joint.html#6461182921ceab095997f58891fb4adc">PxD6Joint</a>
<li>setTwistLimitContactDistance()
: <a class="el" href="classPxArticulationJoint.html#f9c9a92beaf042f7ad7bb3bf95c34b96">PxArticulationJoint</a>
<li>setTwistLimitEnabled()
: <a class="el" href="classPxArticulationJoint.html#b0d113b6b62dc07cd06c4d6341ce0608">PxArticulationJoint</a>
<li>setTypePairFriction()
: <a class="el" href="classPxVehicleDrivableSurfaceToTireFrictionPairs.html#23b36296b4be7a569f4e97e6849c1ad8">PxVehicleDrivableSurfaceToTireFrictionPairs</a>
<li>setup()
: <a class="el" href="classPxVehicleDriveTank.html#1cd437995b8664b4d6005a0f636ab318">PxVehicleDriveTank</a>
, <a class="el" href="classPxVehicleDrive4W.html#d6740fedd4d8d026f8750e7bd601b76a">PxVehicleDrive4W</a>
, <a class="el" href="classPxVehicleNoDrive.html#837924c936c8b6608b691e48e80fcab4">PxVehicleNoDrive</a>
, <a class="el" href="classPxVehicleDrivableSurfaceToTireFrictionPairs.html#7104485ac201ef952d8b164982ac222f">PxVehicleDrivableSurfaceToTireFrictionPairs</a>
, <a class="el" href="classPxVehicleWheels.html#ed5b450123f32286b847b52dbb961a5c">PxVehicleWheels</a>
, <a class="el" href="classPxVehicleDrive.html#02bbb8b1aad17272d533b7b3a41f016f">PxVehicleDrive</a>
, <a class="el" href="classPxVehicleDriveNW.html#72f85747311561f991aa94a525f38b22">PxVehicleDriveNW</a>
<li>setUpDirection()
: <a class="el" href="classPxController.html#3393ba5043c3534712d8f362a9872cfc">PxController</a>
<li>setUpRatios()
: <a class="el" href="classPxVehicleAutoBoxData.html#8fadedab89e26a913b7c24b312ccf106">PxVehicleAutoBoxData</a>
<li>setUseAutoGears()
: <a class="el" href="classPxVehicleDriveDynData.html#3a7a66f713691e6c1ce0f97e1dd2d80a">PxVehicleDriveDynData</a>
<li>setUserData()
: <a class="el" href="classPxVehicleWheelsDynData.html#506628156f9502e0dc6ccc11e3fa75d7">PxVehicleWheelsDynData</a>
, <a class="el" href="classPxController.html#2b6c1841bafa53877baa3dca8543c9ca">PxController</a>
<li>setUserMemory()
: <a class="el" href="classPxBatchQuery.html#ca7ccdab697074ae572c7d0baf9af3c2">PxBatchQuery</a>
<li>setVelocities()
: <a class="el" href="classPxParticleBase.html#f73716656e6d6efef3a5650f9e04ffe3">PxParticleBase</a>
<li>setVirtualParticles()
: <a class="el" href="classPxCloth.html#16ef3c8f9e199f38f84ca0b1529209e5">PxCloth</a>
<li>setViscosity()
: <a class="el" href="classPxParticleFluid.html#51e95f09eeb9730130fb2c139bd2be4c">PxParticleFluid</a>
<li>setVisualizationCullingBox()
: <a class="el" href="classPxScene.html#b562ba2df953188a7e2b99f7ddcda5dc">PxScene</a>
<li>setVisualizationParameter()
: <a class="el" href="classPxScene.html#4055d302466a1f5cd9d481028b66b20a">PxScene</a>
<li>setWakeCounter()
: <a class="el" href="classPxRigidDynamic.html#0f7de8c56c76461555219b2b98d5147a">PxRigidDynamic</a>
, <a class="el" href="classPxCloth.html#cfd45f2a5c3c1dde4bc84e8a6acab096">PxCloth</a>
, <a class="el" href="classPxArticulation.html#aef04ee0fba882eb8212f6baa5dde0b2">PxArticulation</a>
<li>setWheelCentreOffset()
: <a class="el" href="classPxVehicleWheelsSimData.html#7f5a27dafbbf58ad01c0172e03349d24">PxVehicleWheelsSimData</a>
<li>setWheelData()
: <a class="el" href="classPxVehicleWheelsSimData.html#26ac23021422b9ed70773bb1976f076c">PxVehicleWheelsSimData</a>
<li>setWheelEnabledState()
: <a class="el" href="classPxVehicleWheelsSimData.html#de28e7cf0fbb267d3ca0b6abd151e601">PxVehicleWheelsSimData</a>
<li>setWheelRotationAngle()
: <a class="el" href="classPxVehicleWheelsDynData.html#129ab9f993d414c469f002314307dd7e">PxVehicleWheelsDynData</a>
<li>setWheelRotationSpeed()
: <a class="el" href="classPxVehicleWheelsDynData.html#ef9282166f0b158d978b7ae8e8c28153">PxVehicleWheelsDynData</a>
<li>setWheelShapeMapping()
: <a class="el" href="classPxVehicleWheelsSimData.html#07988e7e4bfd905ae1dd182ef3a1cab1">PxVehicleWheelsSimData</a>
<li>setWindDrag()
: <a class="el" href="classPxCloth.html#41d1bc3cbe1f01737a49bd4d489afb54">PxCloth</a>
<li>setWindLift()
: <a class="el" href="classPxCloth.html#2c43cb034276d6be1ac72b3219ebd21c">PxCloth</a>
<li>setWindVelocity()
: <a class="el" href="classPxCloth.html#88764e4c775cf251cd8011d9b1a6fd8e">PxCloth</a>
<li>setZero()
: <a class="el" href="classPxVec4.html#9277eee047f78d606c60d57c8726b1f1">PxVec4</a>
<li>shiftOrigin()
: <a class="el" href="classPxScene.html#3cb2b6b3b72cefb94fa9e64ca09660f6">PxScene</a>
, <a class="el" href="classPxControllerManager.html#6cbb06688c15bed0838ee051127905f8">PxControllerManager</a>
<li>simulate()
: <a class="el" href="classPxScene.html#9a9cacecc3b0f6adaf2f3d2168c2aff5">PxScene</a>
<li>size()
: <a class="el" href="classPxContactSet.html#63434463f6bea994645e3dcbdc2cf2d0">PxContactSet</a>
<li>sphere()
: <a class="el" href="classPxGeometryHolder.html#725211588eba5f168eb9266a25e0b59b">PxGeometryHolder</a>
<li>startAfter()
: <a class="el" href="classphysx_1_1PxTask.html#5ea294d819b903a507efe1358f86b8cd">physx::PxTask</a>
<li>startGearChange()
: <a class="el" href="classPxVehicleDriveDynData.html#2ba2789e69500d31d1acf2f6e11545cf">PxVehicleDriveDynData</a>
<li>startGroup()
: <a class="el" href="classphysx_1_1PxGpuDispatcher.html#86f6db8b18cf8380967890d694e3df8e">physx::PxGpuDispatcher</a>
<li>startSimulation()
: <a class="el" href="classphysx_1_1PxGpuDispatcher.html#091cb121a38ddf39fcab51f5118a15d2">physx::PxGpuDispatcher</a>
, <a class="el" href="classphysx_1_1PxTaskManager.html#ab9b613b731eb4cc5007db33fc801017">physx::PxTaskManager</a>
<li>statusChange()
: <a class="el" href="classPxSimulationFilterCallback.html#0ba6a20106fd9ef3eca10099be8017da">PxSimulationFilterCallback</a>
<li>stopSimulation()
: <a class="el" href="classphysx_1_1PxTaskManager.html#6008ca7efcd7fa4a77d10f0606e3f17a">physx::PxTaskManager</a>
, <a class="el" href="classphysx_1_1PxGpuDispatcher.html#b46896dea09105e1f5fc1d19a98f2b1b">physx::PxGpuDispatcher</a>
<li>storeAny()
: <a class="el" href="classPxGeometryHolder.html#7f4cab3419580e1d985858d1f5ffb653">PxGeometryHolder</a>
<li>storeByte()
: <a class="el" href="classPxFileBuf.html#a050d73be42f3e7179374c5e91841392">PxFileBuf</a>
<li>storeDouble()
: <a class="el" href="classPxFileBuf.html#24b58be8fbcfdb159411494cc6ff89c9">PxFileBuf</a>
<li>storeDword()
: <a class="el" href="classPxFileBuf.html#c4522927d2ddb0af751443de8292cf84">PxFileBuf</a>
<li>storeFloat()
: <a class="el" href="classPxFileBuf.html#598346fa996f55e3e195cb5b5df86faa">PxFileBuf</a>
<li>storeWord()
: <a class="el" href="classPxFileBuf.html#b37c7194f8a6728802b75f487b878499">PxFileBuf</a>
<li>stride()
: <a class="el" href="classPxStrideIterator.html#27661ae2f477495396544cdc0cd2cf9b">PxStrideIterator< T ></a>
<li>submitNamedTask()
: <a class="el" href="classphysx_1_1PxTaskManager.html#f1a81608f80d92d19520aa9dba2dca23">physx::PxTaskManager</a>
<li>submitTask()
: <a class="el" href="classphysx_1_1PxGpuDispatcher.html#5ffc5d0c124afbcad0b6fcf1080af5ee">physx::PxGpuDispatcher</a>
, <a class="el" href="classphysx_1_1PxCpuDispatcher.html#0030e67bed850b70d6725775e5c3ce3c">physx::PxCpuDispatcher</a>
<li>submitted()
: <a class="el" href="classphysx_1_1PxTask.html#2a0a6f83fcd05069f594631272faa8ae">physx::PxTask</a>
<li>submitUnnamedTask()
: <a class="el" href="classphysx_1_1PxTaskManager.html#2f942d2ad1ea34dd74e7127cd72e20ae">physx::PxTaskManager</a>
<li>sum()
: <a class="el" href="classPxMassProperties.html#63e7875cb60efa35150002e56fcfa43f">PxMassProperties</a>
<li>swap2Bytes()
: <a class="el" href="classPxFileBuf.html#8f7aef54d065c1251bc729c32e898a9a">PxFileBuf</a>
<li>swap4Bytes()
: <a class="el" href="classPxFileBuf.html#d3bec920f93f851d420875d3572db866">PxFileBuf</a>
<li>swap8Bytes()
: <a class="el" href="classPxFileBuf.html#c26c76c0c790270716291cab5e29599f">PxFileBuf</a>
<li>sweep()
: <a class="el" href="classPxMeshQuery.html#e35a79d58b3c90dbaefe7d204bbfc9b5">PxMeshQuery</a>
, <a class="el" href="classPxShapeExt.html#9fb19195f3ac80b6ab55fd0aa7a41cf3">PxShapeExt</a>
, <a class="el" href="classPxBatchQuery.html#bf15206e4dcf2238db75f47565078b49">PxBatchQuery</a>
, <a class="el" href="classPxGeometryQuery.html#574970e722f882778a250c51f77b5b85">PxGeometryQuery</a>
, <a class="el" href="classPxScene.html#9b07b2a98e64105a06e97ffaeba2a63d">PxScene</a>
, <a class="el" href="classPxSpatialIndex.html#fa49a33803f4f392d2908287c41bfeab">PxSpatialIndex</a>
, <a class="el" href="classPxVolumeCache.html#86eb361338891b14b27f9d4594b15df8">PxVolumeCache</a>
<li>sweepAny()
: <a class="el" href="classPxSceneQueryExt.html#e1f498d024c8072f1d5036ca34412f84">PxSceneQueryExt</a>
<li>sweepMultiple()
: <a class="el" href="classPxSceneQueryExt.html#2e55cf2e513a120d96e594e516d3e62c">PxSceneQueryExt</a>
<li>sweepSingle()
: <a class="el" href="classPxSceneQueryExt.html#eda6bdd24336f093a8bd7bc76aa82ad8">PxSceneQueryExt</a>
</ul>
</div>
<hr style="width: 100%; height: 2px;"><br>
</body>
</html>
```
|
Elachista ladiniella is a moth in the family Elachistidae. It was described by Friedrich Hartig in 1938. It is found in southern Austrian state of Tyrol.
References
Moths described in 1938
ladiniella
Moths of Europe
|
Zana Khan district is a mountainous district in Ghazni province, Afghanistan with more than 12,000 people living there (100% Pashtun). The district center is Dado.
The district is within the heartland of the Andar tribe of Ghilji Pashtuns. Continuing drought is the main problem as in the whole province. It seriously affects agriculture, the main source of income. Health and education services need serious improvement.
Zana Khan district is currently under occupation of the Taliban and has been since August 2017.
Healthcare
Politics & Governance
Agriculture
Land condition in 2002 found 20% of arable land in use.
Main crops: wheat, alfalfa, maize and barley.
Animal husbandry: sheep, goats and cows.
Education
Infrastructure
See also
Districts of Afghanistan
Ghazni Province
External links
Map of Settlements AIMS, May 2002
References
Districts of Ghazni Province
|
```forth
*> \brief \b ZTPMV
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* path_to_url
*
* Definition:
* ===========
*
* SUBROUTINE ZTPMV(UPLO,TRANS,DIAG,N,AP,X,INCX)
*
* .. Scalar Arguments ..
* INTEGER INCX,N
* CHARACTER DIAG,TRANS,UPLO
* ..
* .. Array Arguments ..
* COMPLEX*16 AP(*),X(*)
* ..
*
*
*> \par Purpose:
* =============
*>
*> \verbatim
*>
*> ZTPMV performs one of the matrix-vector operations
*>
*> x := A*x, or x := A**T*x, or x := A**H*x,
*>
*> where x is an n element vector and A is an n by n unit, or non-unit,
*> upper or lower triangular matrix, supplied in packed form.
*> \endverbatim
*
* Arguments:
* ==========
*
*> \param[in] UPLO
*> \verbatim
*> UPLO is CHARACTER*1
*> On entry, UPLO specifies whether the matrix is an upper or
*> lower triangular matrix as follows:
*>
*> UPLO = 'U' or 'u' A is an upper triangular matrix.
*>
*> UPLO = 'L' or 'l' A is a lower triangular matrix.
*> \endverbatim
*>
*> \param[in] TRANS
*> \verbatim
*> TRANS is CHARACTER*1
*> On entry, TRANS specifies the operation to be performed as
*> follows:
*>
*> TRANS = 'N' or 'n' x := A*x.
*>
*> TRANS = 'T' or 't' x := A**T*x.
*>
*> TRANS = 'C' or 'c' x := A**H*x.
*> \endverbatim
*>
*> \param[in] DIAG
*> \verbatim
*> DIAG is CHARACTER*1
*> On entry, DIAG specifies whether or not A is unit
*> triangular as follows:
*>
*> DIAG = 'U' or 'u' A is assumed to be unit triangular.
*>
*> DIAG = 'N' or 'n' A is not assumed to be unit
*> triangular.
*> \endverbatim
*>
*> \param[in] N
*> \verbatim
*> N is INTEGER
*> On entry, N specifies the order of the matrix A.
*> N must be at least zero.
*> \endverbatim
*>
*> \param[in] AP
*> \verbatim
*> AP is COMPLEX*16 array, dimension at least
*> ( ( n*( n + 1 ) )/2 ).
*> Before entry with UPLO = 'U' or 'u', the array AP must
*> contain the upper triangular matrix packed sequentially,
*> column by column, so that AP( 1 ) contains a( 1, 1 ),
*> AP( 2 ) and AP( 3 ) contain a( 1, 2 ) and a( 2, 2 )
*> respectively, and so on.
*> Before entry with UPLO = 'L' or 'l', the array AP must
*> contain the lower triangular matrix packed sequentially,
*> column by column, so that AP( 1 ) contains a( 1, 1 ),
*> AP( 2 ) and AP( 3 ) contain a( 2, 1 ) and a( 3, 1 )
*> respectively, and so on.
*> Note that when DIAG = 'U' or 'u', the diagonal elements of
*> A are not referenced, but are assumed to be unity.
*> \endverbatim
*>
*> \param[in,out] X
*> \verbatim
*> X is COMPLEX*16 array, dimension at least
*> ( 1 + ( n - 1 )*abs( INCX ) ).
*> Before entry, the incremented array X must contain the n
*> element vector x. On exit, X is overwritten with the
*> transformed vector x.
*> \endverbatim
*>
*> \param[in] INCX
*> \verbatim
*> INCX is INTEGER
*> On entry, INCX specifies the increment for the elements of
*> X. INCX must not be zero.
*> \endverbatim
*
* Authors:
* ========
*
*> \author Univ. of Tennessee
*> \author Univ. of California Berkeley
*> \author Univ. of Colorado Denver
*> \author NAG Ltd.
*
*> \ingroup tpmv
*
*> \par Further Details:
* =====================
*>
*> \verbatim
*>
*> Level 2 Blas routine.
*> The vector and matrix arguments are not referenced when N = 0, or M = 0
*>
*> -- Written on 22-October-1986.
*> Jack Dongarra, Argonne National Lab.
*> Jeremy Du Croz, Nag Central Office.
*> Sven Hammarling, Nag Central Office.
*> Richard Hanson, Sandia National Labs.
*> \endverbatim
*>
* =====================================================================
SUBROUTINE ZTPMV(UPLO,TRANS,DIAG,N,AP,X,INCX)
*
* -- Reference BLAS level2 routine --
* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
*
* .. Scalar Arguments ..
INTEGER INCX,N
CHARACTER DIAG,TRANS,UPLO
* ..
* .. Array Arguments ..
COMPLEX*16 AP(*),X(*)
* ..
*
* =====================================================================
*
* .. Parameters ..
COMPLEX*16 ZERO
PARAMETER (ZERO= (0.0D+0,0.0D+0))
* ..
* .. Local Scalars ..
COMPLEX*16 TEMP
INTEGER I,INFO,IX,J,JX,K,KK,KX
LOGICAL NOCONJ,NOUNIT
* ..
* .. External Functions ..
LOGICAL LSAME
EXTERNAL LSAME
* ..
* .. External Subroutines ..
EXTERNAL XERBLA
* ..
* .. Intrinsic Functions ..
INTRINSIC DCONJG
* ..
*
* Test the input parameters.
*
INFO = 0
IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN
INFO = 1
ELSE IF (.NOT.LSAME(TRANS,'N') .AND.
+ .NOT.LSAME(TRANS,'T') .AND.
+ .NOT.LSAME(TRANS,'C')) THEN
INFO = 2
ELSE IF (.NOT.LSAME(DIAG,'U') .AND.
+ .NOT.LSAME(DIAG,'N')) THEN
INFO = 3
ELSE IF (N.LT.0) THEN
INFO = 4
ELSE IF (INCX.EQ.0) THEN
INFO = 7
END IF
IF (INFO.NE.0) THEN
CALL XERBLA('ZTPMV ',INFO)
RETURN
END IF
*
* Quick return if possible.
*
IF (N.EQ.0) RETURN
*
NOCONJ = LSAME(TRANS,'T')
NOUNIT = LSAME(DIAG,'N')
*
* Set up the start point in X if the increment is not unity. This
* will be ( N - 1 )*INCX too small for descending loops.
*
IF (INCX.LE.0) THEN
KX = 1 - (N-1)*INCX
ELSE IF (INCX.NE.1) THEN
KX = 1
END IF
*
* Start the operations. In this version the elements of AP are
* accessed sequentially with one pass through AP.
*
IF (LSAME(TRANS,'N')) THEN
*
* Form x:= A*x.
*
IF (LSAME(UPLO,'U')) THEN
KK = 1
IF (INCX.EQ.1) THEN
DO 20 J = 1,N
IF (X(J).NE.ZERO) THEN
TEMP = X(J)
K = KK
DO 10 I = 1,J - 1
X(I) = X(I) + TEMP*AP(K)
K = K + 1
10 CONTINUE
IF (NOUNIT) X(J) = X(J)*AP(KK+J-1)
END IF
KK = KK + J
20 CONTINUE
ELSE
JX = KX
DO 40 J = 1,N
IF (X(JX).NE.ZERO) THEN
TEMP = X(JX)
IX = KX
DO 30 K = KK,KK + J - 2
X(IX) = X(IX) + TEMP*AP(K)
IX = IX + INCX
30 CONTINUE
IF (NOUNIT) X(JX) = X(JX)*AP(KK+J-1)
END IF
JX = JX + INCX
KK = KK + J
40 CONTINUE
END IF
ELSE
KK = (N* (N+1))/2
IF (INCX.EQ.1) THEN
DO 60 J = N,1,-1
IF (X(J).NE.ZERO) THEN
TEMP = X(J)
K = KK
DO 50 I = N,J + 1,-1
X(I) = X(I) + TEMP*AP(K)
K = K - 1
50 CONTINUE
IF (NOUNIT) X(J) = X(J)*AP(KK-N+J)
END IF
KK = KK - (N-J+1)
60 CONTINUE
ELSE
KX = KX + (N-1)*INCX
JX = KX
DO 80 J = N,1,-1
IF (X(JX).NE.ZERO) THEN
TEMP = X(JX)
IX = KX
DO 70 K = KK,KK - (N- (J+1)),-1
X(IX) = X(IX) + TEMP*AP(K)
IX = IX - INCX
70 CONTINUE
IF (NOUNIT) X(JX) = X(JX)*AP(KK-N+J)
END IF
JX = JX - INCX
KK = KK - (N-J+1)
80 CONTINUE
END IF
END IF
ELSE
*
* Form x := A**T*x or x := A**H*x.
*
IF (LSAME(UPLO,'U')) THEN
KK = (N* (N+1))/2
IF (INCX.EQ.1) THEN
DO 110 J = N,1,-1
TEMP = X(J)
K = KK - 1
IF (NOCONJ) THEN
IF (NOUNIT) TEMP = TEMP*AP(KK)
DO 90 I = J - 1,1,-1
TEMP = TEMP + AP(K)*X(I)
K = K - 1
90 CONTINUE
ELSE
IF (NOUNIT) TEMP = TEMP*DCONJG(AP(KK))
DO 100 I = J - 1,1,-1
TEMP = TEMP + DCONJG(AP(K))*X(I)
K = K - 1
100 CONTINUE
END IF
X(J) = TEMP
KK = KK - J
110 CONTINUE
ELSE
JX = KX + (N-1)*INCX
DO 140 J = N,1,-1
TEMP = X(JX)
IX = JX
IF (NOCONJ) THEN
IF (NOUNIT) TEMP = TEMP*AP(KK)
DO 120 K = KK - 1,KK - J + 1,-1
IX = IX - INCX
TEMP = TEMP + AP(K)*X(IX)
120 CONTINUE
ELSE
IF (NOUNIT) TEMP = TEMP*DCONJG(AP(KK))
DO 130 K = KK - 1,KK - J + 1,-1
IX = IX - INCX
TEMP = TEMP + DCONJG(AP(K))*X(IX)
130 CONTINUE
END IF
X(JX) = TEMP
JX = JX - INCX
KK = KK - J
140 CONTINUE
END IF
ELSE
KK = 1
IF (INCX.EQ.1) THEN
DO 170 J = 1,N
TEMP = X(J)
K = KK + 1
IF (NOCONJ) THEN
IF (NOUNIT) TEMP = TEMP*AP(KK)
DO 150 I = J + 1,N
TEMP = TEMP + AP(K)*X(I)
K = K + 1
150 CONTINUE
ELSE
IF (NOUNIT) TEMP = TEMP*DCONJG(AP(KK))
DO 160 I = J + 1,N
TEMP = TEMP + DCONJG(AP(K))*X(I)
K = K + 1
160 CONTINUE
END IF
X(J) = TEMP
KK = KK + (N-J+1)
170 CONTINUE
ELSE
JX = KX
DO 200 J = 1,N
TEMP = X(JX)
IX = JX
IF (NOCONJ) THEN
IF (NOUNIT) TEMP = TEMP*AP(KK)
DO 180 K = KK + 1,KK + N - J
IX = IX + INCX
TEMP = TEMP + AP(K)*X(IX)
180 CONTINUE
ELSE
IF (NOUNIT) TEMP = TEMP*DCONJG(AP(KK))
DO 190 K = KK + 1,KK + N - J
IX = IX + INCX
TEMP = TEMP + DCONJG(AP(K))*X(IX)
190 CONTINUE
END IF
X(JX) = TEMP
JX = JX + INCX
KK = KK + (N-J+1)
200 CONTINUE
END IF
END IF
END IF
*
RETURN
*
* End of ZTPMV
*
END
```
|
The 2004 Nicholls State Colonels football team represented Nicholls State University as a member of the Southland Conference during the 2004 NCAA Division I-AA football season. Led by first-year head Jay Thomas, the Colonels compiled an overall record of 5–5 with a mark of 2–3 in conference play, placing fourth in the Southland. Nicholls State played home games at John L. Guidry Stadium in Thibodaux, Louisiana.
Schedule
References
Nicholls State
Nicholls Colonels football seasons
Nicholls State Colonels football
|
Vermilyea Lake is a lake in the Hayes River drainage basin in Census Division No. 22 - Thompson-North Central, Northern Region, Manitoba, Canada. It is shaped like the letter "L" on its side, is about long and wide, and lies at an elevation of . The primary inflow is a channel from Touchwood Lake, and the primary outflows are the twin channels of the Wesachewan River to Gods Lake. The lake's waters eventually flow via the Gods River and the Hayes River into Hudson Bay.
References
Lakes of Manitoba
|
In fluid dynamics, a flow with periodic variations is known as pulsatile flow, or as Womersley flow. The flow profiles was first derived by John R. Womersley (1907–1958) in his work with blood flow in arteries. The cardiovascular system of chordate animals is a very good example where pulsatile flow is found, but pulsatile flow is also observed in engines and hydraulic systems, as a result of rotating mechanisms pumping the fluid.
Equation
The pulsatile flow profile is given in a straight pipe by
where:
{|
|-
| || is the longitudinal flow velocity,
|-
| || is the radial coordinate,
|-
| || is time,
|-
| || is the dimensionless Womersley number,
|-
| || is the angular frequency of the first harmonic of a Fourier series of an oscillatory pressure gradient,
|-
| || are the natural numbers,
|-
| || is the pressure gradient magnitude for the frequency ,
|-
| || is the fluid density,
|-
| || is the dynamic viscosity,
|-
| || is the pipe radius,
|-
| || is the Bessel function of first kind and order zero,
|-
| ||is the imaginary number, and
|-
| } ||is the real part of a complex number.
|}
Properties
Womersley number
The pulsatile flow profile changes its shape depending on the Womersley number
For , viscous forces dominate the flow, and the pulse is considered quasi-static with a parabolic profile.
For , the inertial forces are dominant in the central core, whereas viscous forces dominate near the boundary layer. Thus, the velocity profile gets flattened, and phase between the pressure and velocity waves gets shifted towards the core.
Function limits
Lower limit
The Bessel function at its lower limit becomes
which converges to the Hagen-Poiseuille flow profile for steady flow for
or to a quasi-static pulse with parabolic profile when
In this case, the function is real, because the pressure and velocity waves are in phase.
Upper limit
The Bessel function at its upper limit becomes
which converges to
This is highly reminiscent of the Stokes layer on an oscillating flat plate, or the skin-depth penetration of an alternating magnetic field into an electrical conductor.
On the surface , but the exponential term becomes negligible once becomes large, the velocity profile becomes almost constant and independent of the viscosity. Thus, the flow simply oscillates as a plug profile in time according to the pressure gradient,
However, close to the walls, in a layer of thickness , the velocity adjusts rapidly to zero. Furthermore, the phase of the time oscillation varies quickly with position across the layer. The exponential decay of the higher frequencies is faster.
Derivation
For deriving the analytical solution of this non-stationary flow velocity profile, the following assumptions are taken:
Fluid is homogeneous, incompressible and Newtonian;
Tube wall is rigid and circular;
Motion is laminar, axisymmetric and parallel to the tube's axis;
Boundary conditions are: axisymmetry at the centre, and no-slip condition on the wall;
Pressure gradient is a periodic function that drives the fluid;
Gravitation has no effect on the fluid.
Thus, the Navier-Stokes equation and the continuity equation are simplified as
and
respectively. The pressure gradient driving the pulsatile flow is decomposed in Fourier series,
where is the imaginary number, is the angular frequency of the first harmonic (i.e., ), and are the amplitudes of each harmonic . Note that, (standing for ) is the steady-state pressure gradient, whose sign is opposed to the steady-state velocity (i.e., a negative pressure gradient yields positive flow). Similarly, the velocity profile is also decomposed in Fourier series in phase with the pressure gradient, because the fluid is incompressible,
where are the amplitudes of each harmonic of the periodic function, and the steady component () is simply Poiseuille flow
Thus, the Navier-Stokes equation for each harmonic reads as
With the boundary conditions satisfied, the general solution of this ordinary differential equation for the oscillatory part () is
where is the Bessel function of first kind and order zero, is the Bessel function of second kind and order zero, and are arbitrary constants, and is the dimensionless Womersley number. The axisymetic boundary condition () is applied to show that for the derivative of above equation to be valid, as the derivatives and approach infinity. Next, the wall non-slip boundary condition () yields . Hence, the amplitudes of the velocity profile of the harmonic becomes
where is used for simplification.
The velocity profile itself is obtained by taking the real part of the complex function resulted from the summation of all harmonics of the pulse,
Flow rate
Flow rate is obtained by integrating the velocity field on the cross-section. Since,
then
Velocity profile
To compare the shape of the velocity profile, it can be assumed that
where
is the shape function.
It is important to notice that this formulation ignores the inertial effects. The velocity profile approximates a parabolic profile or a plug profile, for low or high Womersley numbers, respectively.
Wall shear stress
For straight pipes, wall shear stress is
The derivative of a Bessel function is
Hence,
Centre line velocity
If the pressure gradient is not measured, it can still be obtained by measuring the velocity at the centre line. The measured velocity has only the real part of the full expression in the form of
Noting that , the full physical expression becomes
at the centre line. The measured velocity is compared with the full expression by applying some properties of complex number. For any product of complex numbers (), the amplitude and phase have the relations and , respectively. Hence,
and
which finally yield
See also
Cardiovascular system
Hemodynamics
Womersley number
Fluid hammer
References
Biological engineering
Cardiovascular physiology
Fluid dynamics
|
Sendawar (abbreviated as SDW) is the capital city of West Kutai Regency which is also the center of government and economy of West Kutai Regency.
Administratively, Sendawar is only an area, not an independent city, nor is it an independent district. The Sendawar area covers part or all of Barong Tongkok district. However, there is also the name Sendawar village in the Barong Tongkok. Referring to Central Statistics Agency of Indonesia data for West Kutai Regency in 2021, the distance between sub-district in West Kutai to the district capital, the two sub-district have a closer distance to the district capital of about 1 km, namely the Barong Tongkok and Simpang Raya. West Kutai government offices, including the bupati's office, are located in the Simpang Raya sub-district.
Demographics
Ethnic group
West Kutai Regency has a diversity of ethnic groups, with the majority coming from the Dayak peoples, the indigenous people of this region. The Dayak itself consists of various sub-ethnic from Kalimantan and West Kutai. Dayak peoples make up 63.90% of the population of West Kutai, with dominant Tunjung as much as 24.20%. Other Dayak ethnics are Benuaq (19.90%), Bahau (9.30%), Kenyah (2.40%), Bentian (2.30%), Bakumpai (1.70%), Penihing or Aoheng (1.70%), Kayan (1.40%), Seputan (0.60%), Bukat (0.20%), and Luangan (0.20%). Another dominant ethnic group from East Kalimantan is Kutai with a total of 15.50%. While other ethnic groups are Javanese (10.70%), Banjar (4.50%), Bugis (3.20%), Batak (0.20%), and other ethnic groups (2.00%).
Religion
Referring to the population of the Barong Tongkok district, the total population of Sendawar is around 32,438 people, based on data Ministry of Home Affairs in 2021. Then the population is based on the religion adhered to, the majority adheres to Christianity. The size of the population based on religion is Christianity as much as 64.93%, where Protestant 33.19% and Catholic 31.74%. Most of them follow the religion Islam namely 34.86%. As well adherents of religion Hinduism as much as 0.13%, Buddhist 0.03%, and belief 0.05%. For places of worship, there are 65 Protestant churches, 15 Catholic churches, 9 mosques, and 11 prayer rooms (musalla).
Climate
Sendawar has a tropical rainforest climate (Af) with heavy to very heavy rainfall year-round.
References
West Kutai Regency
Regency seats of East Kalimantan
Populated places in East Kalimantan
|
```smalltalk
using System.Collections.Generic;
using System.IO;
using Microsoft.CodeAnalysis;
using Mono.Options;
namespace SkiaSharpGenerator
{
public class CookieCommand : BaseCommand
{
public CookieCommand()
: base("cookie", "Ensure that all cookies have been defined in mono.")
{
}
public string? AssemblyPath { get; set; }
public string? InteropType { get; set; }
public string? MonoBranch { get; set; } = "master";
protected override OptionSet OnCreateOptions() => new OptionSet
{
{ "a|assembly=", "The .NET assembly", v => AssemblyPath = v },
{ "t|type=", "The interop type", v => InteropType = v },
{ "b|branch=", "The mono branch [master]", v => MonoBranch = v },
};
protected override bool OnValidateArguments(IEnumerable<string> extras)
{
var hasError = false;
if (string.IsNullOrEmpty(AssemblyPath))
{
Program.Log.LogError($"{Program.Name}: Path to the .NET assembly was not provided: `--assembly=<path-to.dll>`.");
hasError = true;
}
else if (!File.Exists(AssemblyPath))
{
Program.Log.LogError($"{Program.Name}: Path to the .NET assembly does not exist: `{AssemblyPath}`.");
hasError = true;
}
if (string.IsNullOrEmpty(InteropType))
{
Program.Log.LogError($"{Program.Name}: The interop type was not specified: `{InteropType}`.");
hasError = true;
}
if (string.IsNullOrEmpty(MonoBranch))
{
MonoBranch = "master";
}
return !hasError;
}
protected override bool OnInvoke(IEnumerable<string> extras)
{
var detector = new CookieDetector(AssemblyPath!, InteropType!, MonoBranch!);
detector.Log = Program.Log;
try
{
detector.DetectAsync().Wait();
}
catch
{
if (detector.HasErrors)
{
foreach (var dgn in detector.Messages)
{
if (dgn.Severity == DiagnosticSeverity.Error)
Program.Log.LogError($"{dgn.Descriptor} at {dgn.Location}");
}
}
throw;
}
return true;
}
}
}
```
|
Leone Strozzi, O.S.B. (1638–1703) was a Roman Catholic prelate who served as Archbishop of Florence (1700–1703) and Bishop of Pistoia e Prato (1690–1700).
Biography
Leone Strozzi was born in Florence, Italy in 1638 and ordained a priest in the Order of Saint Benedict. On 10 July 1690, he was appointed during the papacy of Pope Alexander VIII as Bishop of Pistoia e Prato. On 6 August 1690, he was consecrated bishop by Paluzzo Paluzzi Altieri Degli Albertoni, Cardinal-Bishop of Sabina, with Prospero Bottini, Titular Archbishop of Myra, and Nicolò d'Arcano, Bishop of Comacchio, serving as co-consecrators. On 21 June 1700, he was appointed during the papacy of List of popes as Archbishop of Florence. He served as Archbishop of Florence until his death on 4 October 1703.
References
17th-century Italian Roman Catholic archbishops
18th-century Italian Roman Catholic archbishops
Bishops appointed by Pope Alexander VIII
1638 births
1703 deaths
|
Brackenhill is a village in West Yorkshire, England, which forms part of Ackworth parish. It is situated on the A638 road on the eastern bank of Hessle Beck, west of Ackworth Moor Top and north of Fitzwilliam Country Park.
A major industry in Brackenhill was quarrying, and at the end of the 19th century the majority of the male inhabitants of the village were occupied in the quarries. The stone is counted among the Pennine Upper Coal Measures which originated in the Carboniferous age. Quarried materials include magnesian limestone and sandstone. The quarries were served from 1914 to 1962 by the Brackenhill Light Railway, a subsidiary of the London and North Eastern Railway. It branched off the line between Sheffield and York east of Ackworth and joined the line between Wakefield and Doncaster at Hemsworth Colliery near Fitzwilliam. Brackenhill inhabitants also worked in Hemsworth Colliery.
References
Villages in West Yorkshire
|
```xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="path_to_url" xmlns:xsi="path_to_url" xsi:schemaLocation="path_to_url path_to_url">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.camunda</groupId>
<artifactId>zeebe-parent</artifactId>
<version>8.6.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<artifactId>camunda-zeebe</artifactId>
<packaging>jar</packaging>
<name>Zeebe Distribution</name>
<properties>
<zbctl.force>false</zbctl.force>
<zbctl.rootDir>${maven.multiModuleProjectDirectory}</zbctl.rootDir>
</properties>
<dependencies>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>camunda-search-client</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>camunda-search-client-connect</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>camunda-service</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-broker</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-broker-client</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-gateway</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-gateway-grpc</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-restore</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-gateway-rest</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-logstreams</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>camunda-exporter</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-elasticsearch-exporter</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-opensearch-exporter</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-util</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-scheduler</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-atomix-cluster</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-atomix-utils</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-backup</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-backup-store-azure</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-backup-store-s3</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-backup-store-gcs</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-cluster-config</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-client-java</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>operate-webapp</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>identity-common</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>identity-webjar</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>operate-data-generator</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>operate-archiver</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>operate-importer</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>tasklist-webapp</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>tasklist-common</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>tasklist-archiver</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>tasklist-importer</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>tasklist-data-generator</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>webapps-common</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>camunda-authentication</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>identity-sdk</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>identity-spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-crypto</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-transport</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
<exclusions>
<exclusion>
<groupId>org.hdrhistogram</groupId>
<!-- Conflicts with histogram in elasticsearch exporter dependency -->
<artifactId>HdrHistogram</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus-simpleclient</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-annotations-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
</dependency>
<!-- Following are used for generating models from open api spec -->
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations-jakarta</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
</dependency>
<dependency>
<groupId>org.agrona</groupId>
<artifactId>agrona</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-protocol</artifactId>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-protocol-impl</artifactId>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
</dependency>
<!-- /end -->
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.camunda</groupId>
<artifactId>zeebe-test-util</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.tngtech.archunit</groupId>
<artifactId>archunit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.tngtech.archunit</groupId>
<artifactId>archunit-junit5-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.tngtech.archunit</groupId>
<artifactId>archunit-junit5-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>elasticsearch</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>camunda-zeebe-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<configuration>
<assembleDirectory>${project.build.directory}/camunda-zeebe</assembleDirectory>
<configurationDirectory>config</configurationDirectory>
<copyConfigurationDirectory>true</copyConfigurationDirectory>
<extraJvmArguments>-XX:+ExitOnOutOfMemoryError
-Dfile.encoding=UTF-8 -Xshare:auto</extraJvmArguments>
<includeConfigurationDirectoryInClasspath>true</includeConfigurationDirectoryInClasspath>
<platforms>
<platform>windows</platform>
<platform>unix</platform>
</platforms>
<programs>
<program>
<id>broker</id>
<mainClass>io.camunda.application.StandaloneBroker</mainClass>
</program>
<program>
<id>gateway</id>
<mainClass>io.camunda.application.StandaloneGateway</mainClass>
</program>
<program>
<id>restore</id>
<mainClass>io.camunda.zeebe.restore.RestoreApp</mainClass>
</program>
<program>
<id>operate</id>
<mainClass>io.camunda.application.StandaloneOperate</mainClass>
</program>
<program>
<id>migrate</id>
<mainClass>io.camunda.operate.schema.migration.SchemaMigration</mainClass>
</program>
<program>
<id>tasklist</id>
<mainClass>io.camunda.application.StandaloneTasklist</mainClass>
</program>
<program>
<id>tasklist-migrate</id>
<mainClass>io.camunda.tasklist.schema.migration.SchemaMigration</mainClass>
</program>
<program>
<id>camunda</id>
<mainClass>io.camunda.application.StandaloneCamunda</mainClass>
</program>
</programs>
<repositoryLayout>flat</repositoryLayout>
<repositoryName>lib</repositoryName>
<useWildcardClassPath>true</useWildcardClassPath>
</configuration>
<executions>
<execution>
<id>assemble</id>
<goals>
<goal>assemble</goal>
</goals>
<phase>package</phase>
<configuration></configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy-zbctl</id>
<goals>
<goal>run</goal>
</goals>
<phase>package</phase>
<configuration>
<target>
<?SORTPOM IGNORE?> <!-- ordering is important here, chmod needs to run after copying -->
<copy failonerror="${zbctl.force}" file="${zbctl.rootDir}/clients/go/cmd/zbctl/dist/zbctl.exe" tofile="${project.build.directory}/camunda-zeebe/bin/zbctl.exe" />
<copy failonerror="${zbctl.force}" file="${zbctl.rootDir}/clients/go/cmd/zbctl/dist/zbctl.darwin" tofile="${project.build.directory}/camunda-zeebe/bin/zbctl.darwin" />
<copy failonerror="${zbctl.force}" file="${zbctl.rootDir}/clients/go/cmd/zbctl/dist/zbctl" tofile="${project.build.directory}/camunda-zeebe/bin/zbctl" />
<chmod dir="${project.build.directory}/camunda-zeebe/bin" failonerror="${zbctl.force}" includes="zbctl*" perm="ugo+rx" />
<?SORTPOM RESUME?>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>assemble</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<attach>true</attach>
<descriptors>
<descriptor>src/main/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<ignoredNonTestScopedDependencies>
<ignoredNonTestScopedDependency>org.agrona:agrona</ignoredNonTestScopedDependency>
<ignoredNonTestScopedDependency>io.netty:netty-handler</ignoredNonTestScopedDependency>
<ignoredNonTestScopedDependency>io.camunda:zeebe-protocol</ignoredNonTestScopedDependency>
<ignoredNonTestScopedDependency>com.fasterxml.jackson.core:jackson-core</ignoredNonTestScopedDependency>
<ignoredNonTestScopedDependency>com.fasterxml.jackson.datatype:jackson-datatype-jsr310</ignoredNonTestScopedDependency>
<ignoredNonTestScopedDependency>com.fasterxml.jackson.core:jackson-databind</ignoredNonTestScopedDependency>
<ignoredNonTestScopedDependency>org.apache.httpcomponents.client5:httpclient5</ignoredNonTestScopedDependency>
<ignoredNonTestScopedDependency>org.apache.httpcomponents.core5:httpcore5</ignoredNonTestScopedDependency>
</ignoredNonTestScopedDependencies>
<!-- dependencies only packaged but not explicitly used -->
<usedDependencies>
<dependency>io.camunda:camunda-exporter</dependency>
<dependency>io.camunda:zeebe-elasticsearch-exporter</dependency>
<dependency>io.camunda:zeebe-opensearch-exporter</dependency>
<!-- Needed for Spring Actuators, and REST API -->
<dependency>org.springframework.boot:spring-boot-starter-web</dependency>
<dependency>org.openapitools:jackson-databind-nullable</dependency>
<dependency>jakarta.servlet:jakarta.servlet-api</dependency>
<dependency>jakarta.annotation:jakarta.annotation-api</dependency>
<!-- Needed for configuring the Identity SDK by providing an IdentityConfiguration bean -->
<dependency>io.camunda:identity-spring-boot-autoconfigure</dependency>
<dependency>io.camunda:identity-common</dependency>
<dependency>io.camunda:identity-webjar</dependency>
<dependency>io.camunda:operate-data-generator</dependency>
<dependency>io.camunda:operate-archiver</dependency>
<dependency>io.camunda:operate-importer</dependency>
<dependency>io.camunda:tasklist-data-generator</dependency>
<!-- Used to parse PKCS1 certificates -->
<dependency>org.bouncycastle:bcprov-jdk18on</dependency>
<dependency>org.bouncycastle:bcpkix-jdk18on</dependency>
</usedDependencies>
</configuration>
</plugin>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>7.8.0</version>
<executions>
<execution>
<id>backups</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/api/backup-management-api.yaml</inputSpec>
<modelPackage>io.camunda.zeebe.management.backups</modelPackage>
</configuration>
</execution>
<execution>
<id>cluster</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/api/cluster/cluster-api.yaml</inputSpec>
<modelPackage>io.camunda.zeebe.management.cluster</modelPackage>
</configuration>
</execution>
<execution>
<id>exporter</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/api/cluster/exporter-api.yaml</inputSpec>
<modelPackage>io.camunda.zeebe.management.cluster</modelPackage>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>build-info</id>
<goals>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>
<java.version>${java.version}</java.version>
<description>${project.description}</description>
</additionalProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
```
|
Method to the Madness of Jerry Lewis is a 2011 American documentary of actor Jerry Lewis. It was released on Encore on December 17, 2011.
Plot
A chronological view of Jerry Lewis' career beginning with his 10-year partnership with Dean Martin to his career as a producer, director, writer, and actor. Archival clips, interviews with friends and family, as well as Lewis himself are included.
Cast
Jerry Lewis
Alec Baldwin
Richard Belzer
Carol Burnett
Chevy Chase
Billy Crystal
Woody Harrelson
John Landis
Richard Lewis
Eddie Murphy
Carl Reiner
Jerry Seinfeld
Steven Spielberg
Quentin Tarantino
Reception
The film holds a 67% rating based on 12 critical reviews at Rotten Tomatoes.
The Washington Post said of the film, "The old clips are still a hoot, but there’s a limit to how much compressed air a viewer can take, listening to a bunch of old men talk about how funny their friend was." The New York Times review stated, "...by the end of this documentary, yes, you’re convinced that Mr. Lewis was a much larger figure than is generally acknowledged. But you still don’t feel as if you know him."
Home media
The film was released on DVD on January 22, 2013.
References
External links
Method to the Madness of Jerry Lewis at Rotten Tomatoes
2011 films
Films produced by Jerry Lewis
Jerry Lewis
2010s English-language films
American biographical films
American documentary television films
2011 documentary films
2010s American films
|
Several thousand place names in the United States have names of French origin, some a legacy of past French exploration and rule over much of the land and some in honor of French help during the American Revolution and the founding of the country (see also: New France and French in the United States). Others were named after early Americans of French, especially Huguenot, ancestry (Marion, Revere, Fremont, Lanier, Sevier, Macon, Decatur, etc.). Some places received their names as a consequence of French colonial settlement (e.g. Baton Rouge, Detroit, New Orleans, Saint Louis). Nine state capitals are French words or of French origin (Baton Rouge, Boise, Des Moines, Juneau, Montgomery, Montpelier, Pierre, Richmond, Saint Paul) - not even counting Little Rock (originally "La Petite Roche") or Cheyenne (a French rendering of a Lakota word). Fifteen state names are either French words / origin (Delaware, New Jersey, Louisiana, Maine, Oregon, Vermont) or Native American words rendered by French speakers (Arkansas, Illinois, Iowa, Kansas, Michigan, Mississippi, Ohio, Wisconsin).
The suffix "-ville," from the French word for "city" is common for town and city names throughout the United States. Many originally French place names, possibly hundreds, in the Midwest and Upper West were replaced with directly translated English names once American settlers became locally dominant (e.g. "La Petite Roche" became Little Rock; "Baie Verte" became Green Bay; "Grandes Fourches" became Grand Forks).
Alabama
Albertville
Barbour County
Bay Minette ("Kitty Bay" or "Cute Bay")
Bayou la Batre ("Bayou of the Battery")
Belle Fontaine ("Beautiful Fountain")
Belle Mina
Bon Air ("Good Air")
Bon Secour ("Good Rescue")
Centreville (City-center, or Downtown. Note the "re" spelling of centre, as opposed to "er" as in center)
Citronelle (named after the citrus trees.)
Daphne
Dauphin Island (named after the Dauphin, French crown prince)
DeArmanville
Decatur
Decatur County
Delchamps
Detroit
Fayette County
Gasque
Grande Batture Islands
Isle aux Dames (Island of the ladies)
Isle aux Herbes (Island of the herbs)
LaFayette
Lamar County
Le Moyne (The Monk, old spelling)
Leroy
Malbis
Marion (named after Francis Marion, patriot of the American Revolution and of Huguenot ancestry)
Mentone
Mobile (French name for the indigenous Mauvilla tribe)
Mobile County
Mon Louis
Montrose
Semmes
Alaska
La Chaussée Spit at the entrance of Lituya Bay. Named originally in charts prepared by French explorer Jean-François de La Pérouse in 1786. La Chaussée means "causeway".
Mount La Pérouse (3231 m) and La Pérouse Glacier in the Fairweather Range of Alaska, both named after French explorer and naval captain Jean-François de Galaup, comte de La Pérouse
Gastineau Channel named after John Gastineau, an English Civil Engineer and Surveyor with a French surname. Compare with Gatineau.
Juneau named after Joseph Juneau, French-Canadian prospector and gold miner
Arizona
Clemenceau (Named after the French prime minister during World War I)
Picket Wire (Corruption of the French Purgatoire, "Purgatory")
Peridot
Arkansas
Arkansas (named by French explorers from aboriginal word meaning "south wind")
Antoine ("Anthony")
Aurelle
Auvergne (a French region)
Barraque Township
Bayou
Bayou Meto, Arkansas County, Arkansas
Bayou Meto, Lonoke County, Arkansas
Beauchamp (fair of beautiful field or plain)
Beaudry
Belleaire (from "belle aire", beautiful place)
Belleville ("Beautiful City")
Bellefonte (maybe from "belle fontaine", beautiful fountain)
Boeuf ("Beef")
Bonair (good air)
Buie
Burdette
Cache
Cadron
Calumet The French word for a Native American tobacco pipe.
Calvin (Anglicized version of Cauvin, famous French Protestant)
Champagnolle
Chancel
Chicot County (a stump)
Claude
Cloquet
Darcy
De Roche (of the rock)
Deberrie
Decatur
Delaplaine (Of-the-plains, surname)
Departee
Devue
Des Arc ("At the bend")
Dumas (French surname)
Ecore Fabre
Fayetteville (named for French general, Marquis de La Fayette)
Fontaine ("Fountain", a surname)
Fourche ("Pitchfork")
Fourche Lafave
Fourche Valley
Francure
Frenchman's Bayou
Gallatin
Grand Glaise ("Large Clay")
Gravette
La Fave
La Grue (the crane)
La Grue Springs
Lacrosse
Ladelle
Lafayette County
LaGrange ("the barn")
Lamartine (French author Alphonse de Lamartine, also a surname)
L'Anguille ("The Eel")
Lapile
Larue (the street)
Latour (the tower)
Lave Creek
Levesque ("Bishop", a common French-Canadian surname)
Macon (French city "Mâcon")
Marais Saline (saline marsh)
Marche
Maumee
Maumelle (breasts)
Monette
Mont Sandels
Montreal (royal mount)
Moreau (feedbag, probably a family's proper name)
Mount Magazine
New Gascony (Gascony)
Ozark (phonetic rendering of either aux Arks, "of the Ark(ansas)" or aux Arcs, "of the arches", or possibly aux arcs-en-ciel, "of the rainbows")
Ozark Mountains as per immediately above
Paris
Paroquet
Partain
Petit Jean ("Little John" named after a French sailor on the Arkansas River)
Pollard
Prairie County ("prairie, meadow")
Sans Souci (literally without concern)
Segur (French city)
Sevier County
Smackover (Anglicization of chemin couvert, "covered way")
Soudan
St. Francis County
Terre Noire (black earth)
Terre Rouge (redland or red earth)
Tollette
Tully
Urbanette
Vallier (French surname)
Vaucluse (French region)
Vaugine Township
Vidette
Villemont (ville = city, mont = mount)
California
Alsace (Region in France bordering Germany)
Artois (named after Artois, France)
Bel Air ("Beautiful Air")
Belfort ("Beautiful Fort")
Belmont ("Beautiful Mount")
Bonnefoy ("Good Faith")
Brisbane (French "brise" and Old English "bane," meaning bone)
Cassel (a town in France)
Chalfant
Concord (from French "concorde" meaning agreement, harmony, or union)
Delano (after a scion of the famous Delano Family, originally Huguenots named "De Lannoye")
Disneyland (after Walt Disney, a descendant of the Norman family d'Isigny (Isigny, Normandie, France))
Fremont (named for John C. Frémont, American soldier, explorer and politician of French ancestry)
Friant
Gasquet
Guerneville
Lafayette (named for the French general Marquis de La Fayette)
La Grange ("The Barn")
La Grange Reservoir
La Porte ("The door")
La Verne
Lebec (Le bec = "the beak")
Le Grand ("The Big")
Montague (pointed hill)
Montclair ("Clear Mountain")
Nice (After French city of the same name)
Nord ("North")
Orleans
Piedmont (French spelling of the Piedmont region of Italy)
Richmond (After Virginian city of the same name with French origins)
Rubidoux (named for Louis Rubidoux)
Mount Rubidoux
San Francisco (named after Saint Francis of Assisi, who had received that name because his mother was French or as a tribute to France)
Vichy Springs (After French city of the same name)
Colorado
Ault
Bellevue ("Beautiful Sight" or View")
Berthoud
Berthoud Pass and town of Berthoud
Bethune (Maybe from Maximilien de Béthune, also a place)nghn
Bijou Creek (from bijoux meaning "jewel")
Cache La Poudre River ("hide the powder" or "powder cache")
Calumet See Arkansas
De Beque
Florissant (from "flowering")
Fremont County
Grand County
Lafayette
Lamar
Laporte ("The Door", a common French Canadian surname)
La Salle ("The Room", surname)
Louisville (city of Louis, king of France)
Louviers
Lyons (a city in France)
Montclair ("Bright or "Clear Mountain")
Montrose (Rose-mount)
Montrose County
North and South Platte Rivers
Parachute
Parachute Creek
Platteville
Poudre Park
Purgatoire River
St. Vrain Creek
Sublette
Vernon
Connecticut
Ballouville
Montville
Pomfret Landing
Versailles
Versailles Pond in New London County
Delaware
Delaware named after Lord de la Warre (Anglo-Norman surname originally de la Guerre meaning; "of the war")
Bellefonte (beautiful fountain)
Bellevue
Florida
Barrineau Park
Bayou George
Belandville (failed "colony" in northern Santa Rosa County, approximately one mile south of its border with Escambia County, Alabama)
Belle Glade ("beautiful" glade)
Belle Isle
Brevard County
Clermont
Destin ("destiny")
DuPuis Reserve
Duval County (named for William Pope DuVal)
Eau Gallie ("rocky water")
Fort Caroline
Fontainebleau
LaBelle ("The Beauty", "The Beautiful" or "Beautiful Woman")
Lafayette County
Lake Lorraine
Marion County
Navarre (Navarre)
Navarre Beach
Port Saint Lucie (Lucie is French for Lucy)
Ribault River (named for Jean Ribault leader of the Huguenot colony Fort Caroline in early Florida whose inhabitants were massacred by the Spanish)
Georgia
Beaulieu ("pretty place")
Berrien County
Decatur
Decatur County
Fannin County
Fayette County
LaGrange ("The Barn", named for the French Estate of Marquis de Lafayette)
Lanier County
Macon ("mason")
Valdosta (named after the French-speaking region of Val d'Aoste in the Italian Alps)
Hawai'i
Fort DeRussy (named for General René Edward De Russy and his brother Lewis, soldiers of Huguenot ancestry)
French Frigate Shoals
La Pérouse Bay named after Jean-François de Galaup, Comte de La Pérouse, first European to visit the island of Maui
La Pérouse Pinnacle located in the French Frigate Shoals, Hawai'i
Idaho
Arbon
Bellevue ("Beautiful View")
Blanchard (French surname)
Boise (from boisé, "Wooded")
Bonneville County (named after Benjamin Louis Eulalie de Bonneville (1796–1878), a French-born officer in the United States Army, fur trapper and explorer)
Bovard
Bruneau (French surname)
Cache ("hidden")
Coeur d'Alene ("Heart of the Awl")
Culdesac ("Dead End")
Dubois ("of the wood")
Fremont County
Grandjean
Grangeville ("barn city")
Jacques
Labelle
Laclede
La Fleur ("the Flower")
Malad City (from malade, French for "sick")
Michaud (French surname from Michel (Michael))
Montour
Montpelier
Nez Perce County (from the Nez Perce Tribe's name "nez percé" meaning "pierced nose")
Paris
Payette (named after François Payette)
Pierre's Hole
Ponderay (from pend oreille, "earring")
Simplot
St. Maries
Teton ("Teat")
Thiard
Illinois
Illinois, French version of Illini, a local Native American tribe
Illinois River
Beaucoup Creek (plenty good)
Belle Rive ("Beautiful Bank") (French military commander)
Belleville ("Beautiful City")
Bonpas Creek ("Good Step")
Bourbonnais (named for François Bourbonnais, Sr., a fur trader)
Bureau County ("Office"; person's name)
Cache River (hidden river)
Champaign (from Champaigne, a French surname)
Chicago, although not a French place name in itself, shikaakwa or "wild onion" in the Native-American Miami-Illinois language, the pronunciation of the "chi" (as opposed to the "chi" as in China) is the result of early French settlement
Creve Coeur ("Heartbreak"; early French fort)
Decatur
DePue (named for an early French fur trader by the name of De Pue)
Des Plaines ("of the Plains")
Des Plaines River
Du Bois (from the woods)
DuPage River
Du Quoin (name of an Illiniwek chief)
Embarrass ("Predicament")
Fayette County (after LaFayette)
Fort Massac
Hennepin (named in honor of the 17th-century French explorer Father Louis Hennepin)
Joliet (named after explorer Louis Jolliet)
La Fayette
La Grange ("The Barn")
La Moille
La Moine River ("The Monk", after an early monastery)
La Salle (named after explorer René-Robert Cavelier, Sieur de La Salle. La Salle literally means "the Hall.")
L'erable, Illinois (Settled by French Canadians)
Libertyville
Marion
Marseilles (after Marseille)
Massac (French Minister)
Menard County (after Pierre Menard)
Prairie du Rocher ("Prairie of the Rock")
Paris
Rochelle
St. Anne (Anne is spelled in French. Founded by French-speaking Canadians. See Charles Chiniquy)
St. Georges (Note: retains the silent "s" from the French)
Sublette
Toulon
Versailles (for the French city and palace)
Indiana
Bourbon
Clermont
Decatur
Decatur County
Delaware County
De Motte ("the mound")
Dubois County
Dunkirk
Fayette
Fayette County
Ferdinand
Fremont
French Lick
Fugit
Jay County
La Crosse
La Fontaine
La Porte (named by French explorers travelling up from the south, this area was the first clearing or "door" out of the heavy woods to the south.)
La Porte County
Lafayette (named for the French general, Marquis de Lafayette)
LaGrange County
Ligonier
Marion County
Montpelier
Napoleon
Notre Dame ("Our Lady")
Orleans
Portage
Saint Croix
Saint Leon, Indiana
St. Paul
Sedan
Terre Haute ("High Ground")
Vernon
Versailles
Vevay
Vincennes (named for François Marie Bissot, Sieur de Vincennes)
Iowa
Audubon
Belle Plaine
Belleville
Bellevue
Belmond
Belmont
Bennezette
Bonaparte
Bondurant
Boyer
Chariton
Clutier
Couler Valley ("To Flow," also namesake for the Couler Creek)
Decatur City
Decatur County
Des Moines (from Rivière des Moines, "River of the Monks", the river flowing through the city)
Dubuque (named after explorer Julien Dubuque)
Durant (French surname)
Fayette (town and county, named after the French Marquis de LaFayette who served in the Revolutionary War)
Fontanelle
Fort de la Trinité
Fremont
Giard, Iowa
Lafayette
La Grange ("The Barn")
La Motte
La Porte ("The Door")
Le Claire
Le Grand ("The Great")
Le Mars ("March")
Le Roy ("The King")
Lyons, Iowa (named after the French city, Lyon)
Marion, Iowa (named after Francis Marion, Revolutionary War hero of a S. Carolinian French Huguenot family)
Marquette
Martelle
Mondamin
Montpelier
Muscatine
Orleans (French city of Orléans)
Paris
Platte
Prairie
Rinard
Tête des Morts ("Head of the Dead Ones")
Kansas
Belleville
Belle Plaine
Bourbon County
Decatur County
La Cygne ("The Swan"; after the Marais des Cygnes River, which was named by French explorers)
Labette County, named after Pierre La Bette, an early settler of French origin
Lecompton
LeLoup "The Wolf"
Marais des Cygnes River
Marion County
Reno County, named after Major General Jesse Lee Reno, a Union officer killed in the American Civil War. (Reno's family name was a modified version of the French surname "Renault".)
St. Francis
Sedan
Sublette, Kansas
Toulon (most likely named for the French city)
Wyandotte County, French spelling of the name of an Indian tribe who were also known as the Hurons by the French in Canada
Kentucky
Cities
Bellefonte
Bellemeade
Bellevue ("Beautiful Sight")
La Center
La Grange
LaFayette
Louisville (named in honor of King Louis XVI in 1778)
Paris
Versailles
Counties
Bourbon County (name for House of Bourbon, European Royal House)
Fayette County (named for Gilbert du Motier, Marquis de La Fayette)
Gallatin County (named for Albert Gallatin, Swiss American and Secretary of State)
LaRue County (named for John LaRue, early Kentucky settler)
Marion County (named for Francis Marion, a hero of the American Revolution of French Huguenot ancestry)
Louisiana
Louisiana (Louisiane in French - named in honor of King Louis XIV of France in 1682)
Abbeville (after Abbeville, France) (One of several communities in the United States named "Abbeville".)
Algiers New Orleans neighborhood
Ascension Parish, named from the French l'Ascension
Arnaudville
Assumption Parish, named from the French l'Assomption
Audubon New Orleans neighborhood
Avoyelles Parish
Baton Rouge ("Red Stick")
Bayou Cane
Bayou Chicot
Bayou Gauche ("Left Bayou")
Bayou Grande Cheniere Mounds
Bayou L'Ourse
Beauregard Parish
Belle Alliance ("Beautiful Alliance")
Belle Chasse ("Beautiful Hunting")
Belle d'Eau
Belle Rose ("Beautiful Rose")
Belmont
Bienville Parish
Blanchard (named after a Louisiana governor of French ancestry)
Bonnet Carré, flood prevention spillway on the Mississippi River ("square bonnet")
Bossier City (after Pierre Bossier)
Bossier Parish
Bourg (ancient French word for "town")
Breaux Bridge
Breton National Wildlife Refuge (on and around Breton Island)
Broussard (after merchant Valsin Broussard, of Acadian descent)
Butte La Rose
Calcasieu
Cancienne
Chalmette ("Pasture land, fallow land")
Chandeleur Islands
Charenton (named after Charenton asylum)
Chataignier ("Chestnut tree")
Chauvin
Chenier Au Tigre ("Tiger oak tree")
Chenal
Cocodrie (dialect word for "crocodile")
Cossinade
Coteau Bourgeois ("Bourgeois hill")
Davant
Delacroix Island
Delcambre
Des Allemands ("of the Germans")
Destrehan (named in honor of Jean Noel Destréhan, Creole politician)
Deville
Dulac ("of the lake")
Evangeline Parish
Faubourg Marigny New Orleans neighborhood
Faubourg Tremé New Orleans neighborhood
Fontainebleau New Orleans neighborhood
Fort De La Boulaye
Garyville
Gentilly New Orleans neighborhood
Grand Bayou ("great bayou")
Grand Ecaille ("great scale")
Grand Ecore
Grand Isle ("great island")
Grand Chenier ("great oakwood")
Grand Coteau ("great hill")
Grosse Isle ("big island")
Grand Point
Grand Prairie ("great meadow")
Grosse Tête ("fat or big head")
Gueydan
Iberville Parish
Iberville Projects New Orleans neighborhood
Jean Lafitte (named for Jean Lafitte, a famous pirate)
Labadieville
Lacamp
Lacassine ("small house")
LaCour
Lacombe
Lafayette (named for the Marquis de La Fayette)
Lafitte Projects New Orleans neighborhood
Lafourche Parish (from la fourche, referring to a forked path)
Lake Borgne ("one-eyed")
Lake Pontchartrain
L'Anse Grise ("the gray cove")
LaPlace (named for early settler Basile LaPlace.)
Larose ("the rose")
Lebeau ("the beautiful")
Le Blanc ("the white")
Lecompte
Leonville
Le Moyen
Loreauville
Marchand
Mandeville (named for developer Bernard Xavier de Marigny de Mandeville)
Maringouin (Cajun French in origin and means "mosquito")
Marion (named after an American soldier of huguenot ancestry)
Maurepas
Meaux (after the town of Meaux)
Meraux
Mermentau
Mer Rouge ("red sea")
Metairie (from a French word for sharecropping)
Michoud New Orleans neighborhood
Montegut
Montpelier
Moreauville
Napoleonville (for French Emperor Napoleon Bonaparte)
New Orleans (named for the duke of Orléans, France)
Ossun (named after the town of Ossun)
Paincourtville ("short of bread town")
Paradis ("Paradise")
Parlange
Pierre Part
Plaisance
Plaquemines Parish
Plaucheville
Point Au Fer Reef Light
Pointe aux Chenes ("Oak Point")
Pointe à la Hache ("Axe Spike")
Pointe Coupee Parish (from pointe coupée, "cut spike")
Port Barre
Port Fourchon
Pont Des Mouton
Prairieville ("meadow town")
Presquille (from presqu'île, "peninsula")
Provencal
Rosaryville
Saint Benedict
Saint Bernard
Saint Maurice
St. Amant
St. Claude New Orleans neighborhood
St. Francisville
St. Gabriel
St. Landry Parish
St. Malo
St. Martinville (originally named Poste des Attakapas-Atakapas Post)
St. Roch New Orleans neighborhood
St. Rose
Saline
South Vacherie
Terrebonne Parish ("Good Land")
Timbalier Island ("timpani player")
Tulane/Gravier New Orleans neighborhood named after Paul Tulane, philanthropist and son of Louis Tulane, a French immigrant
Vacherie ("Cowshed")
Verdun
Versailles
Vieux Carré ("Old Square") also known as the French Quarter in New Orleans
Ville Platte ("Flat City")
Maine
Maine (one theory suggests the state was named after the historic French province of Maine)
Cadillac Mountain (named after explorer Antoine de la Mothe Cadillac)
Calais (after Calais, France)
Caribou
Castine
Deblois
Detroit
Fayette
Fort Pentagouet
Grand Isle
Isle au Haut
Lagrange
Lamoine
Minot
Montville
Mount Desert Island
Paris
Presque Isle (from the French word "presqu'île" meaning "peninsula"--- from presque meaning "almost", and isle meaning "island". The town is surrounded on three sides by water, and therefore is "almost an island")
Portage Lake
Roque Bluffs
Saint Croix Island
St. Francis River
Saint John River
Tremont
Maryland
Bel Air ("Good Air")
Havre de Grace (named after Le Havre (originally Le Havre de Grâce, literally "haven of grace"), France)
Massachusetts
Barre
Belmont
Marion
Orleans (named for Louis Philippe II, Duke of Orléans)
Revere (after Paul Revere, of Huguenot ancestry; his family name originally was Rivoire)
Savoy
Michigan
Allouez (named after missionary Claude-Jean Allouez)
Au Gres (French for "at the sandstone")
Au Sable
Au Sable River
Au Train
Barbeau
Beaugrand Township
Belle River
Belleville ("Beautiful City;" named for a Paris district)
Bellevue
Benzie County "Bec Scie", meaning "Saw Beak" or "Saw Bill", a kind of duck
Berrien County
Bete Grise ("Gray Beast")
Bete Grise (community also meaning "Gray Beast")
Bois Blanc Island ("White Wood")
Cadillac (named after explorer Antoine de la Mothe Cadillac)
Chapin Township
Charlevoix (named for Pierre François Xavier de Charlevoix (1682–1761), a French Jesuit in New France)
Cheviers
Delaware Township
De Tour Village
Detroit (of the "Strait")
Doty
Eau Claire
Ecorse (from Rivière aux Écorces, "Bark River")
Fort Gratiot Charter Township
Fremont Township
Grand Blanc ("Great/Large White")
Grand Marais ("Large Marsh")
Grand Traverse County
Grande Pointe
Gratiot County
Grosse Ile ("Big Island")
Grosse Pointe ("Big Point")
Grosse Pointe Farms
Grosse Pointe Park
Grosse Pointe Shores
Grosse Pointe Woods
Hamtramck (named for the French-Canadian soldier Jean François Hamtramck from Québec, became a decorated officer in the American Revolutionary War)
Isle Royale National Park ("Royal Island")
Lac La Belle ("Beautiful Lake", community)
Lac La Belle ("Beautiful Lake", lake)
Lachine
Lamotte Township
L'Anse ("The Cove")
Lapeer County
Lasalle
LeRoy ("The King")
Les Cheneaux Islands ("The Channels")
Marion Township
Marlette
Marne (named after a river in France)
Marquette (named after explorer Jacques Marquette)
Marquette County
Montcalm County (named for Louis-Joseph de Montcalm, French military commander in the French and Indian War).
Montmorency County (named for the Montmorency family, a noble family influential in the administration of New France)
Napoleon (for Napoleon Bonaparte)
Parisville
Pere Marquette River (for Father (père) Jacques Marquette)
Pere Marquette Township
Pointe Aus Barques
Pointe aux Tremble
Pointe Mouillee State Game Area
Portage
Presque Isle (from presqu'île, "peninsula")
Presque Isle County
Reno Township
River Rouge
Saint Clair Haven
Saint Clair Shores
Sans Souci
Sault Ste. Marie ("St. Mary's Rapids")
Sebille Manor
St. Clair
St. Clair County
St. Clair Shores
St. Ignace (French rendition of St. Ignatius)
St. Joseph
Traverse City
Vermilion
Vermontville
Minnesota
Albertville, named after a city in France
Argyle (from the French Argile, "clay") (or from Argyll in Scotland?)
Audubon
Baudette
Beaulieu
Belle Plaine
Belle Prairie Township
Bernadotte
Big Fork River (originally Rivière Grande Fourche)
Bois de Sioux River ("woods of the Sioux")
Bois Forte Indian Reservation ("hard wood")
Brule River (from the Ojibwe name Wiisakode-ziibi "half-burned wood river", which was translated directly into French as Bois Brulé. Half of the river disappears into a pothole in the Judge C. R. Magney State Park).
Calumet
Cloquet
Coteau des Prairies ("slope of the prairies")
Delano (after a scion of the famous Delano Family, originally Huguenots named "De Lannoye")
Detroit Lakes ("narrows lake")
Duluth (named after Daniel Greysolon, Sieur du Lhut)
Faribault
Faribault County, named for Jean-Baptiste Faribault, French-Canadian trader
Fond du Lac Indian Reservation ("source of the lake")
Frontenac State Park
Frontier ("Border" refers to its position on the Minnesota / Ontario border)
Gentilly
Glese (From the French "glaise" or clay)
Grand Marais ("Big Marsh"; some speculate "Big Harbor" in founders' accent)
Grand Portage ("Large Portage")
Grand Rapids
Hennepin County (named in honor of the 17th-century Belgian explorer Father Louis Hennepin)
Huot, Minnesota named after French-Canadian settler Louis Huot
La Moille - corruption of La Mouette 'the seagull' from a Vermont city name
La Porte (The Door)
La Prairie
Lac qui Parle ("lake that speaks")
La Crescent
Lac Vieux Desert ("lake of the old clearing")
Lake Pepin named after French-Canadian settler Jean Pepin
Lake Traverse
La Salle (named for René-Robert Cavelier, Sieur de La Salle, a french explorer)
Le Roy
Le Sueur (named for Pierre-Charles Le Sueur)
Leech Lake (originally lac sangsue, "leech lake", a translation from the Ojibwe Ozagaskwaajimekaag-zaaga'igan "Lake abundant with leeches")
Little Fork River (originally Rivière Petite Fourche)
Little Marais (originally Petit Marais, "Little Marsh")
Mille Lacs County
Mille Lacs Lake ("thousand lakes")
Nicollet County
Orleans
Pelland
Platte
Pomme de Terre ("potato")
Red Lake (originally lac rouge, "red lake", a translation from the Ojibwe Miskwaagamiiwi-zaaga'igan "Red-colored Waters Lake")
Rainy Lake (originally lac à la pluie, "rainy lake")
Renville County, Minnesota
Roseau ("reed")
Roseville
St. Cloud (named after a Paris suburb; St.Cloud is Saint Clodoald, grandson of the Frankish king Clovis I)
St. Croix River
St. Hilaire
St. Louis Park
Saint Paul (once known as Pig's Eye Landing after Pierre "Pig's Eye" Parrant - French: l'Oeil du Cochon, a French-Canadian trader and innkeeper, renamed Saint Paul by French-Canadian pastor Lucien Galtier when he built the first Roman Catholic chapel in the area)
Sedan (named after the french city of the same name)
Terrebonne ("good land")
Traverse County
Vadnais Heights, suburb of Saint Paul
Lake Vermilion
Voyageurs National Park, (named after the French-Canadian explorers - "travellers")
Mississippi
Abbeville
Amite County (from amitié, "friendship")
Bay St. Louis (from Baie Saint-Louis)
Bayou Caddy
Bellefontaine
Belmont
Benoit
Biloxi
Bourbon
Carriere
Centreville (note the "re" spelling in "centre" as opposed to "center")
Clermont Harbor
Decatur
De Lisle
D'Iberville (named after Pierre Lemoyne, Sieur d'Iberville, governor of New France)
Dumas
Fayette
Gautier (Named for the Gautier family, who established a homestead on the site in 1867.)
LeFleur's Bluff State Park (Named after earlier French-Canadian trader and settler Louis Lafleur)
Macon
Marion
Pass Christian (Named after Nicholas Christian L'Adnier)
Petit Bois Island ("Little Woods")
Saucier
Sartinville
St. Martin
Missouri
Audrain County
Auxvasse
Bay de Charles
Bayouville
Belgique
Belle
Bellefontaine
Bevier
Bonne Terre
Bourbeuse River
Bourbon
Brazeau
Cap au Gris
Cape Girardeau
Cape Girardeau County
Carondelet
Castor River
Chamois
Chariton County
Chouteau Springs
Courtois
Courtois Creek
Courtois Hills
Creve Coeur ("Heartbreak")
Cuivre River ("copper")
Dardenne Prairie
DeBaliviere Place (Neighborhood in St. Louis)
Des Arc
Desloge
Des Peres
River Des Peres
Fayette
Femme Osage
Florissant (formerly Fleurissant)
Frontenac
Gasconade County (from the French word "gascon" which in this context means braggart)
Gravois Mills
LaBarque Creek
La Belle
Laclede
Laclede County (named for Pierre Laclede (1729–1778), founder of St. Louis, Missouri)
Lafayette County (named for Gilbert du Motier, the Marquis de Lafayette)
La Forge
La Grange
Lake Lafayette
La Tour
La Vieille Mine (Alternate name of Old Mines)
Le Grand Village Sauvage
Loutre River
Lyon
Macon County
Marais Croche
Marais des Cygnes River
Marais des Liards (original name of Bridgeton)
Marais Temps Clair
Maries County From "Marais" meaning swamp.
Marion County
Maupin
Mine La Motte
Metz (named for the city in France)
Moniteau County
Moreau River
Noel
Normandy
Oregon County "Ouragon" meaning hurricane
Ozark County "Aux Arcs"
Papin
Paris
Pere Marquette Park
Petit Marais Rondeau Lake
Platte County
Pomme de Terre Lake ("Potato")
Pomme de Terre River ("Potato")
Portage des Sioux
Portageville
Prairie du Chien
River aux Vases
Robidoux
Roubidoux Creek
Rocheport
St. Aubert
St. Charles
St. Charles County
St. Clair County
St. Cloud
St. Francois County
St. Francois Mountains
St. Louis (named in honor of King Louis IX, later canonized as Saint Louis)
St. Louis County
Ste. Genevieve (after the patron saint of Paris)
Ste. Genevieve County
Terre du Lac
Theabeau
Valles Mines
Versailles
Vichy
Montana
Anceney and Anceney Bridge, Montana, named after Charles Leon Ancen(n)ey (Anxionnaz)(1826-1895)
Belle Creek community (and Belle Creek river)
Cascade County ("waterfall")
Choteau
Chouteau County, named after Pierre Chouteau, Jr., an American fur trader of French Canadian origin
Dupuyer
Froid ("Cold")
Gallatin County
Havre (from Le Havre, France)
Joliet
Laurin
Lozeau
Portage
Prairie County
St. Marie
St. Xavier
Sonnette
Teton County ("Teat")
Valmy (from Valmy, France)
Virgelle
Wibaux County
Nebraska
Barada (named after Antoine Barada, whose father was French fur trapper and interpreter Michel Barada)
Bayonne (named for the city)
Bellevue ("Beautiful Sight")
Bordeaux (named for the creek, below)
Bordeaux Creek (named for a fur trader)
Cabanné's Post
Chadron, Nebraska
Decatur
Du Bois ("of the Woods")
Fontanelle, Fontenelle Forest, Fontenelle Boulevard, Hotel Fontenelle, Logan Fontenelle Housing Project (Named after Logan Fontenelle, Omaha Tribe chief who was the son of a Creole and Omahan mother)
Fremont (named for John C. Frémont, French-American pioneer and politician)
Grand Island
La Platte
Loup County, Loup River ("Wolf", named after the Skidi Pawnee people who called themselves the Wolf People)
Louisville
Loup River
Lyons
Papillion (from papillon, "butterfly")
Platte County
Platte River ("flat river")
Robidoux Pass
Sarpy County (named after Peter Abadie Sarpy, a fur trader of French origin born in New Orleans, Louisiana)
St. Deroin (named after a family called Du Roins).
St. Paul
Nevada
Frenchman
Frenchman Flat
Lamoille
Montreux
Pioche, named after François Louis Alfred Pioche, a financier who purchased the town in 1869.
Primeaux
Reno, named after Major General Jesse Lee Reno, a Union officer killed in the American Civil War. (Reno's family name was a modified version of the French surname "Renault")
Valmy, named after the place in France of a famous battle during the Revolutionary period.
New Hampshire
Belmont (named for August Belmont, German-born financier who changed his name to Belmont upon arriving in the United States)
Bretton Woods
Fremont (named for John C. Frémont, French-American pioneer and politician)
Pinardville (named for Edmond Pinard, Québec native and early resident)
New Jersey
New Jersey and Jersey City (after the Bailliage de Jersey, the largest of the Anglo-Norman Channel Islands near the coast of northwest France)
Audubon
Bayonne (according to tradition, from Bayonne, France)
Belleplain
Belleville ("Beautiful town")
Lavallette (named for Elie A. F. La Vallette, U.S. naval captain of French family origin)
Port Liberté ("Freedom Port")
Montclair ("Bright Mountain")
New Mexico
Bayard (named for George Dashiell Bayard, Union general in the Civil War of French ancestry)
Clovis (named for Clovis, first Christian King of the Franks)
Lamy, New Mexico (named for the French born and educated Santa Fe, New Mexico Archbishop Jean-Baptiste Lamy (1814 - 1888)
Ledoux, New Mexico (named for Abraham Ledoux (1784-1842) and Antoine Ledoux (1779 - ?), two French brothers born in Québec, who became trappers and settled in Mora, New Mexico and Taos, New Mexico)
Antoine Leroux, New Mexico (named for Antoine Leroux (1801 - 1861), a famous trader and scout, born from French - Canadian parents, who settled in Taos, New Mexico)
St. Vrain, New Mexico (named for Ceran St. Vrain (1802 - 1870), a Western American trader of French descent.
New York
Au Sable, New YorkAu Sable
Ausable River ("sand river")
Barre
Bellerose
Belle Terre
Boquet or Bouquet River
Buffalo (One theory holds that the city gets its name from an English corruption of the French "beau fleuve" ("beautiful river").)
Chateaugay (named after Chateauguay, Québec)
Chateaugay River
Champlain (named after French explorer Samuel de Champlain)
Chaumont
Chaumont Bay
Chaumont River
Chazy
Clermont
Decatur
Delaware County
Dunkirk (named after the city of Dunkirk or Dunkerque, France, because of the similar harbor.)
Esperance
Fayette
Fayetteville
Fremont
Fremont Center (named after John C. Frémont, Franco-American explorer, military officer and politician)
Gouverneur
Grand Island
Granville
Grasse River (named after the Comte de Grasse, a French admiral who decisively defeated the British fleet in the Battle of the Chesapeake in September 1781 during the American Revolution)
Huguenot
Jacques Cartier State Park (park located along the St. Lawrence River and named after 16th-century French explorer Jacques Cartier)
La Chute River
LaFayette
LaGrange
Lake Champlain (lake named after French explorer Samuel de Champlain)
Le Ray
Le Roy
Liberty Island (after the Statue de la Liberté offered by France)
Lorraine
Louisville
Maine
Marion
Massena (named after André Masséna, one of Napoleon's field marshals.)
Montague
Montour
New Paltz (named by French Huguenots)
New Rochelle (founded by French Huguenots and named after La Rochelle, France.)
Orleans
Orleans County
Portage
Raquette River
Rouses Point (named after early settler Jacques Rouse.)
Point Au Roche State Park (park located on the shores of Lake Champlain)
St. Armand
St. Lawrence County (for the Saint Lawrence River, English form of Fleuve Saint-Laurent.)
Valcour Island (island located in Lake Champlain)
North Carolina
Belvoir
Camp Lejeune US Marine Corps base ("The Youth" or "The Young Man")
Charlotte
Fayetteville
Faison
Fremont
La Grange
Lenoir
Lenoir County
Peletier
North Dakota
Almont
Belcourt
Bois de Sioux River
Bordulac ("Edge of the Lake")
Bottineau (named for Pierre Bottineau, Métis pioneer, hunter, and trapper)
Cavalier (from "chevalier", knight)
Charbonneau
Chateau de Mores State Historic Site (home and ranch built in the 1880s by the French cattle baron and nobleman Marquis de Morès)
Missouri Coteau
Coulee
De Lamere
Des Lacs River("of the Lakes"), also Des Lacs
Gascoyne (from the French region "Gascogne")
Grand Forks (from the French "les Grandes Fourches" or the great forks)
Grandin (named after French-Canadian Bishop Grandin)
Granville (from "grand" = big, "ville" = city)
Joliette (maybe from "jolie" = pretty)
LaMoure
Medora (named by the French nobleman Marquis de Morès for his wife Medora)
Merricourt
Montpelier (named after Montpellier, France)
Napoleon (named after French Emperor Napoleon Bonaparte)
Renville County
Rolette
Russo Original family named Rousseau
Verendrye (named for Pierre de La Vérendrye, French-Canadian officer and explorer)
Voltaire (named for Voltaire, French Enlightenment philosopher)
Ohio
Auglaize River (corruption of the French eau glaise, meaning "muddy water")
Auglaize County
Belfort (named for a town in France)
Bellaire
Bellefontaine ("Beautiful Fountain")
Bellevue ("Beautiful View")
Belmont County (Anglicized "Beautiful Mountain")
Belmont
Belpre ("Beautiful Meadow")
Champaign County
Chardon
Cheviot
Clermont County (from the city Clermont, France. "Clair" = clear, "mont" = mount)
Conneaut
Decatur
Delaware County
Duchouquet Township
Fayette County (after the Marquis de Lafayette)
Fayette
Fremont
Gallia County (Latin for Gaul, Roman name for France)
Gallipolis, Ohio, largest city of Gallia County
Girard
Grand Prairie Township
Guernsey County
Huron County (French name for the Wyandot tribe)
Lafayette
Lagrange ("The Barn")
LaRue ("The Street")
Leroy Township, Lake County ("The King")
Lorain County (for the French province of Lorraine)
Lorain
Louisville
Marietta (to honor Marie Antoinette)
Marion County
Marne (named after a river in France)
Marseilles (from the French city of Marseille)
Martel ("Hammer")
Massillon (after Jean Baptiste Massillon, French bishop)
Moraine
Oregon
Paris Township, Portage County, Ohio
Paris Township, Stark County, Ohio
Paris Township, Union County, Ohio
Portage County
Vermilion River (Red River)
Versailles
Oklahoma
Achille ("Achilles")
Avant ("Before" or "ahead")
Ballard (a common French surname)
Belfonte
Bellevue ("Beautiful View")
Boise City (from Boisé, "Wooded")
Cache
Chouteau
Delaware County
Durant (The French surname of the town's founding French/Choctaw family)
El Reno (Named after Civil War officer Jesse L. Reno - descended from "Renault")
Guymon
Lucien (A common French given name)
Poteau ("Stake")
Remy
Sans Bois Mountains ("Without forest")
Verdigris "Green Gray"
Verdigris River
Oregon
Oregon (possibly from "le fleuve aux ouragans", French for "river of the hurricanes", referring to the windiness of the Columbia River)
Bonneville (named after Benjamin Louis Eulalie de Bonneville (1796–1878), a French-born officer in the United States Army, fur trapper, and explorer)
Charbonneau (named after Jean-Baptiste Charbonneau son of Sacajawea and Toussaint Charbonneau a French-Canadian trapper member of the Lewis & Clark expedition)
Coquille ("Shell")
Deschutes County ("of the falls")
Deschutes River (from rivière des chutes meaning river of the falls)
Deschutes National Forest (Waterfalls National Forest)
Detroit ("Strait")
Gervais (A French given name)
Grand Ronde ("Big ring")
Lafayette
La Grande ("The Big / Great One")
Langlois (French surname. From "L'Anglais" = the Englishman)
La Pine ("The Pine")
Malheur County ("Misfortune")
Marion County
Maupin
Nonpareil ("Unparalleled")
Rainier
Ruch ("Hive")
Saint Louis
Saint Paul
Sauvie Island
Terrebonne ("Good ground")
The Dalles (from les dalles meaning "slabs" or possibly a type of rapids)
Willamette River (French pronunciation of a Clackamas Indian village name)
Willamette Valley
Pennsylvania
Belle Vernon
Bellefonte ("Beautiful Fountain")
Bellevue
Boquet
Calumet, Pennsylvania
Charleroi ("Charles King"—in reference to King Carlos II of Spain)
Chartiers Township
Dauphin County
Decatur Township
Delano (after a scion of the famous Delano Family, originally Huguenots named "De Lannoye")
DuBois ("Of the Woods")
Duquesne, named after the Marquis Duquesne, governor of New France
Eau Claire
Fayette City
Fayette County, named to honor the Marquis de LaFayette
Fort Duquesne, original name of what is now Pittsburgh
Fort Le Boeuf
Fort Machault
Fort Presque Isle
Laporte ("The door")
Ligonier, named after Field Marshal John Ligonier, a British noble and officer with French ancestry
Luzerne County
Luzerne Township
Mercer Township
Montour County
North Versailles Township
Paris
South Versailles Township
Versailles, named after the Palace of Versailles
Wilkes-Barre (Barre was a British politician with Huguenot ancestry, favorable to the cause of US colonies)
Rhode Island
Lafayette Village, a historic district in North Kingstown, RI
Louisquisset, a neighborhood and major parkway in Providence, RI
Marieville, a neighborhood in Providence, RI
South Carolina
Abbeville (from Abbeville, France)
Abbeville County, South Carolina
Bonneau (from bonne eau, "good water")
Bordeaux (from Bordeaux, France)
DeBordieu
Eau Claire ("Clear Water")
Fort Motte
Gaston (A common French given name)
Gourdin
La France
Pacolet
Port Royal Sound
Ravenel
Sans Souci ("No Worries", the French name of chateau of Frederick the Great, famously Francophile)
Turbeville
Vaucluse (from the Vaucluse, France)
South Dakota
Belle Fourche ("Beautiful Fork")
Belle Fourche Reservoir
Belle Fourche River
Big Sioux River
Bois de Sioux River ("Woods of the Sioux" River)
Bon Homme County ("Good Man" County)
Burdette
Conde (maybe from the noble French family of Condé)
Corsica
Coteau des Prairies ("Slope of the Prairies")
Missouri Coteau ("Slope of the Missouri")
East Sioux Falls, a ghost town
Edgemont
De Smet, named for Pierre-Jean De Smet, a Belgian priest
Dupree (maybe from "du pré")
Flandreau, named for Charles Eugene Flandrau, judge of Huguenot ancestry
Fort Pierre
Jerauld County
Joubert (a common French surname)
Lake Traverse
La Plant
LeBeau
Mellette County
Montrose (possibly from "pink mountain")
Moreau River
North Sioux City
Pierpont
Pierre, named for Pierre Chouteau, Jr., an American fur trader of French Canadian origin
Platte
Roubaix, a ghost town named for the French city of the same name
Roubaix Lake, a lake located in the Black Hills (from the French city of Roubaix)
St. Francis
Sioux Falls
Vermillion
West Branch Lac qui Parle River ("Lake that Speaks" River)
Tennessee
Decatur
Decatur County
Decaturville
Fayette County
Gallatin
Lafayette
La Follette
La Grange
La Vergne
Lenoir City (named for William Lenoir, Revolutionary War general of Huguenot ancestry, and his son)
Macon
Macon County
Marion County
Paris
Sevier County
Sevierville (named for John Sevier, Tennessee governor of Huguenot ancestry)
Texas
Austin-named for Stephen F. Austin, whose surname is of Norman French origin.
Bayou Vista
Biloxi
Blanchard
Burnet County (named after early Texas leader David Gouverneur Burnet)
Castroville (founded by Henri Castro, a French diplomat)
Colmesnil
Crockett County (Davy Crockett's ancestors were Huguenots named Croquetagne, one of whom was captain in the Royal Guard of Louis XIV)
Dallardsville
DeBerry
Decatur
Doucette
Dumas, named after its founder Louis Dumas
Duval County
Fayette County (named after the Marquis de Lafayette)
Gary City
Grand Prairie
LaBelle
La Grange (named after the Marquis de Lafayette's chateau)
La Marque
La Porte ("The Door")
La Salle County (named after explorer René-Robert Cavelier, Sieur de La Salle)
Lamar County (named after early Texas leader Mirabeau Buonaparte Lamar)
Marion County
Mauriceville
Menard
Menard County
Mont Belvieu
Montague County
Paris
Utah
Ballard
Bonneville Salt Flats (named after Benjamin Louis Eulalie de Bonneville (1796–1878), a French-born officer in the United States Army, fur trapper and explorer)
Cache County
Cache Junction
Duchesne
Duchesne County
Fayette
Fort Duchesne
Grand County
Henrieville
Lapoint
Portage
Provo (named after Étienne Provost)
Sevier County
Sevier
St. George
Vermont
Vermont (probably translated from "Green Mountain" in the 1770s)
Barre (named after Isaac Barré)
Belmont (origin unknown)
Calais (named for Calais, France)
Grand Isle County ("big island")
Isle La Motte (named after a French soldier, Pierre La Motte in 1666)
Lake Champlain (named by Samuel de Champlain in 1662)
Lamoille (possibly named by French settlers as La Mouette)
Montpelier (named after Montpellier, France)
Orleans County and Orleans (named after Orléans, France)
Vergennes (named for Frenchman Charles Gravier, comte de Vergennes, who aided the rebels in the American Revolutionary War)
Virginia
Amissville
Barboursville
Basye
Bavon
Belmont
Belle Isle State Park
Belvoir
Bertrand (A common French given name)
Boissevain
Bon Air
Botetourt County
Capron
Caret
Cedon
Champlain
Chantilly, named after Chantilly, France
Clary
Crozet
Delaplane
Fauquier County
Fort Belvoir ("see well")
Fremont
La Crosse
Lagrange
Macon
Manquin
Mauzy
Montpelier
Orlean
Paris
Raphine
Renan
Richmond, from "riche mont", a name given first to the castle founded in North Yorkshire by a Breton family, and from there to Richmond near London
Rochelle
Sabot
Turbeville
Washington
Beaux Arts Village (from "fine arts")
Bellevue ("Beautiful View")
Belfair
Belmont ("Beautiful Mountain")
Blanchard (Old French for "Whitish")
Boistfort
Brier
Coulee City
Coupeville
Decatur Island
Deschutes ("of the Falls")
Des Moines ("of the Monks")
Doty
Dupont
Duvall
Esperance ("Hope")
Fauntleroy (Old French for "Child of the King")
Guerrier ("Warrior")
Grand Coulee (from coulée or couler, meaning "to flow")
La Center
La Crosse
La Grande
Lamont
La Push (Clallam County, along the Quileute River on the Olympic Peninsula. Home to the Quileute Indian Tribe. From la bouche, meaning "mouth", as infused into Chinook trading jargon)
Laurier (Named after Sil Wilfrid Laurier, Canadian Prime Minister)
Loup Loup (from loup, "wolf")
Malo
Maury Island
Mount Rainier (named after Captain Peter Rainier, grandson of the Huguenot refugee Daniel Regnier)
Normandy (named after Normandy, France)
North Bonneville (named after Benjamin Louis Eulalie de Bonneville (1796–1878), a French-born officer in the United States Army, fur trapper, and explorer)
Ozette
Palouse (from pelouse, meaning "lawn")
Pend Oreille County (named after the Pend d'Oreilles tribe. French for "earring" and a reference to heavy earrings and distended lobes of the people of the same name)
Pomeroy (Old French for "Apple Orchard")
Portage
Portage Island
Puget Sound named after Peter Puget, an officer in the Royal Navy of Huguenot descent
Quimper Peninsula
Roche Harbor
Touchet
Touchet River
Vashon
Vashon Island named after James Vashon, an officer in the Royal Navy of Huguenot descent
West Virginia
Bayard
Belle
Belmont
Despard
Fayette
Fayette County
Fayetteville
Granville
Guyandotte River (a river in southern West Virginia, running from Wyoming County near Beckley, to the Ohio River near Huntington. Guyandotte is the French spelling of the name of an Indian tribe also known as the Wyandot.)
Marion County
Montcalm (named for Louis-Joseph de Montcalm, French military commander in the French and Indian War).
Ronceverte (Name is derived from two words meaning "Greenbrier.")
Wisconsin
Wisconsin (anglicized from the French "Ouisconsin", which in turn is a corruption of the Ojibwe "Meskonsing")
Allouez (after Claude-Jean Allouez)
Apple River (corruption of the French Rivière Pomme de Terre des Cygnes, which in turn is a translation from the Ojibwe Waabiziipinikaani-ziibi, "River abundant with swan potatoes")
Argonne (from the Argonne Forest in France)
Ballou
Belle Plaine ("beautiful plain")
Bellevue ("beautiful view")
Benoit
Bois Brule River ("burnt wood")
Butte des Morts ("hill of the dead")
Calumet County (French for Menominee peace pipe)
Cassel (a town in France)
Couderay (from lac courte oreilles, "short ears")
Dell Prairie
De Pere (from les rapides des pères, "the rapids of the fathers")
Dovre
Eau Claire ("clear water")
Eau Claire County
Eau Galle ("gall water")
Eau Pleine ("full water")
Flambeau ("torch")
Fond du Lac ("bottom of the lake")
Fond du Lac County
Grand Chute ("great fall")
Green Bay (anglicized from the French baie verte, previously "Baie des Puants" - "Bay of Stinks")
Juneau County ("Named for Solomon Juneau, born in Quebec")
La Crosse ("the crozier")
La Crosse County
La Farge
Lafayette County
La Grange (originally "La Grane" after the native place of General La Fayette)
La Pointe (from la pointe de Chequamegon, the area around Chequamegon Bay)
La Valle ("the valley")
Lac Courte Oreilles ("lake short ears")
Lac du Flambeau ("lake of the torch")
Lac La Belle ("Lake the beautiful or beautiful lake")
Lake Butte des Morts ("hill of the dead")
Langlade County
Marinette County
Marquette (after Father Jacques Marquette)
Marquette County
Montreal ("Royal Mountain", after Montréal, Québec)
Nicolet National Forest (after Jean Nicolet)
Pepin County
Portage (originally named for the Fox-Wisconsin portage)
Portage County
Prairie du Chien ("dog prairie")
Prairie du Sac ("prairie of the Sac people")
Presque Isle (from presqu'île, "peninsula")
Racine ("root", after the Root River)
Racine County
Radisson ("radish")
Roche a Cri
St. Croix Falls (after the St. Croix ("Holy Cross") river, named c. 1689)
St. Croix County
Superior (from Lake Superior / Lac Supérieur - meaning "upper" in this context)
Theresa
Trempealeau River (from "trempe à l'eau", "plunge into the water")
Trempealeau County
Wyoming
Belle Fourche River
Bondurant
Calpet
Cheyenne (from the French pronunciation and spelling of the Dakota word Sahi'yena, a diminutive of Sahi'ya, a Dakotan name for the Cree people.)
Cheyenne River
Dubois (named after U.S. Senator Fred Dubois, of French-Canadian ancestry)
Fontenelle
Fort Laramie
Fremont County (named for John C. Frémont, French-American pioneer and politician)
Grand Teton National Park (from French grands tétons'', "large teats" - presumably referring to the mountains' shape)
Gros Ventre Range
Gros Ventre River
La Barge
La Grange
Laramie (named from Jacques LaRamie, a French-speaking Canadian trapper who disappeared in the Laramie Mountains in the late 1810s)
Laramie County
Laramie Mountains
Laramie River
Little Laramie River, as well as the North, South, and Middle Fork Laramie Rivers
North Laramie River
North Platte River
Platte County
Ranchettes
Rozet
Sublette County
Teton County
Teton Range
Teton Village
U.S. Virgin Islands
Saint Croix ("Holy Cross")
See also
List of U.S. state name etymologies
Lists of U.S. county name etymologies
List of place names of German origin in the United States
List of U.S. place names of Spanish origin
List of Chinook Jargon placenames
List of non-US places that have a US place named after them
References
External links
French-American history
French
French language in the United States
|
```objective-c
#ifndef __PLYLoader_h__
#define __PLYLoader_h__
#include <string>
#include "Logger.h"
#include "extern/happly/happly.h"
#include <array>
namespace Utilities
{
/** \brief Read for PLY files.
*/
class PLYLoader
{
public:
/** This function loads an PLY file.
* Only triangulated meshes are supported.
*/
static void loadPly(const std::string &filename, std::vector<std::array<float, 3>> &x, std::vector<std::array<int, 3>> &faces, const std::array<float, 3>&scale)
{
LOG_INFO << "Loading " << filename;
happly::PLYData plyIn(filename.c_str());
std::vector<std::array<double, 3>> vPos = plyIn.getVertexPositions();
std::vector<std::vector<int>> fInd = plyIn.getFaceIndices<int>();
x.resize(vPos.size());
for (unsigned int i = 0; i < vPos.size(); i++)
{
x[i] = {
scale[0] * static_cast<float>(vPos[i][0]),
scale[1] * static_cast<float>(vPos[i][1]),
scale[2] * static_cast<float>(vPos[i][2])
};
}
faces.resize(fInd.size());
for (unsigned int i = 0; i < fInd.size(); i++)
faces[i] = { static_cast<int>(fInd[i][0]), static_cast<int>(fInd[i][1]), static_cast<int>(fInd[i][2]) };
}
};
}
#endif
```
|
Khmelevoy () is a rural locality (a settlement) in Ikryaninsky District, Astrakhan Oblast, Russia. The population was 371 as of 2010. There are 7 streets.
Geography
Khmelevoy is located 36 km south of Ikryanoye (the district's administrative centre) by road. Vakhromeyevo is the nearest rural locality.
References
Rural localities in Ikryaninsky District
|
```javascript
import Icon from '../../components/Icon.vue'
Icon.register({
'brands/delicious': {
width: 448,
height: 512,
paths: [
{
d: 'M446.5 68c1 3.8 1.5 7.9 1.6 12v352.1c0 26.5-21.5 48-48 48h-352c-4.1 0-8.2-0.5-12-1.5-7.7-2-14.6-5.8-20.3-11-1.2-1.1-2.3-2.2-3.3-3.3-5.2-5.7-9-12.6-11-20.3-1-3.8-1.5-7.9-1.5-12v-352c0-26.5 21.5-48 48-47.9h352c4.1 0 8.2 0.5 12 1.5 1.9 0.4 3.7 1 5.4 1.7 1.9 0.7 3.7 1.5 5.5 2.5 1.4 0.7 2.7 1.5 4 2.4 1.1 0.8 2.2 1.6 3.3 2.5 2.5 2 4.8 4.3 6.9 6.8 1.7 2.1 3.3 4.5 4.7 6.9 1.3 2.3 2.4 4.6 3.3 7.1 0.5 1.5 1 3 1.4 4.5zM416 432v-176h-192v-192h-176c-8.8 0-16 7.2-16 16v176h192v192h176c8.8 0 16-7.2 16-16z'
}
]
}
})
```
|
Savuca is a neighbourhood of the municipality and district of Söke, Aydın Province, Turkey. Its population is 7,414 (2022). Before the 2013 reorganisation, it was a town (belde).
It is situated in the fertile plains and to the west of Büyükmenderes River (Maeander of the antiquity), it is almost merged to Söke. Savuca was founded during Ottoman Empire era. The number of houses were 18 in 1473 and 87 in 1529. In 1800s during a plague epidemic the settlement was almost emptied and the name of the settlement may refer to that event (Savuş means "escape") Later Circassian refugees from the Caucasus were also settled in Savuca. In 1992 the settlement was declared a seat of township. Main economic activity of the town is cotton farming. Being close to district center, some people work in Söke.
References
Neighbourhoods in Söke District
|
Shelburne—Yarmouth—Clare was a federal electoral district in the province of Nova Scotia, Canada, that was represented in the House of Commons of Canada from 1935 to 1949 and from 1953 to 1968.
This riding was created in 1933 from parts of Digby and Annapolis and Shelburne—Yarmouth ridings. It consisted of the counties of Shelburne and Yarmouth, and the municipality of Clare in the county of Digby. It was abolished in 1947 when it was redistributed into Digby—Yarmouth and Queens—Shelburne ridings.
It was re-created in 1952 from those two ridings, and was abolished again in 1966 into South Shore and South Western Nova ridings.
Members of Parliament
This riding elected the following Members of Parliament:
Election results
1935–1949
1953–1968
See also
List of Canadian federal electoral districts
Historical federal electoral districts of Canada
External links
Riding history for Shelburne—Yarmouth—Clare (1933–1947) from the Library of Parliament
Riding history for Shelburne—Yarmouth—Clare (1952–1966) from the Library of Parliament
Former federal electoral districts of Nova Scotia
|
The Fono Aoao Faitulafono (Legislative Assembly) of Samoa has 51 members representing 51 electoral constituencies. Until 1991 voting for candidates in traditional territorial constituencies was by matai (chiefs) suffrage only. After a 1990 plebiscite, universal suffrage was introduced with a voting age of 21.
Only registered matais may stand in territorial electorates.
Previously
Up until the 2021 Election, there were 49 members. Of these, 47 were elected from 41 territorial constituencies based on traditional districts. Two members were elected on a non-territorial basis by voters on the Individual Voters Roll. Voters and candidates could move from the territorial constituencies rolls to the Individual Voters Roll. The eligibility of candidates and voters for the two types of constituencies was different.
Changes were implemented in 2019 with an amendment to the Samoan Constitution, and the Electoral Constituencies Act.
Territorial constituencies
The constituencies each belong to an itūmālō (political district) and are given an official number:
References
External links
General Information - The Parliament of Samoa
Territorial Constituencies Act 1963 - Pacific Legal Information Institute
Politics of Samoa
Constituencies by country
|
The Curtis Organ, named for publisher Cyrus H.K. Curtis, is one of the largest pipe organs in the world with 162 ranks and 10,731 pipes. The concert organ, of American Symphonic design, was manufactured by the Austin Organ Company as its Opus 1416 in 1926 for the Philadelphia Sesquicentennial Exposition. It was known as the "Organists' Organ" because the specifications were formulated by Henry S. Fry, John M'E. Ward, Rollo F. Maitland, Frederick Maxson, and S. Wesley Sears, all prominent Philadelphia organists.
History
Curtis acquired the instrument after the Exposition went bankrupt and donated it to the University of Pennsylvania, where it was divided into two halves and incorporated into Irvine Auditorium at the time of the building's construction.
The organ contains the largest Universal Air Chest ever built by Austin. In its original configuration in the Auditorium building, the organ spread 75 feet across its platform at the Sesquicentennial Exposition. This pressurized room under the pipes allows access to the organ's pneumatic mechanisms while it is playing, and was touted as being able to seat 100 people to dinner comfortably. The organ's mechanical actions were renewed in the 1950s through the generosity of Mary Louise Curtis Bok Zimbalist, daughter of Cyrus H.K. Curtis and founder of The Curtis Institute of Music. In the later 1980s and early 1990s, the organ was connected to a customized MIDI interface, making it, at that time, the world's largest MIDI-capable instrument. In more recent times, the Austin Organ Company carried out a complete mechanical restoration of the organ (with a new console and relay system added), carefully preserving the organ's tonal integrity. It was rededicated in October 2002.
In October 1972 Keith Chapman accompanied the Lon Chaney silent film The Phantom of the Opera as a fund-raiser for the organ that evolved into an annual campus Halloween event. Cyrus Curtis also gave an Austin organ to nearby Drexel University, and to the auditorium of City Hall in Portland, Maine.
Discography featuring the Curtis Organ
• Music From The Curtis Organ, Ted Alan Worth (1988) [CORS CD-141601]
• A Midsummer Night’s Dream, Ken Cowan (1997) [CORS CD-141602]
See also
Wanamaker Organ
References
External links
Facebook Public Page
Facebook Fan Group
University of Pennsylvania's Curtis Organ page
Electric and electronic keyboard instruments
Individual pipe organs
University of Pennsylvania
Culture of Philadelphia
Sesquicentennial Exposition
1926 works
|
Bulandshahr, formerly Baran, is a city and a municipal board in Bulandshahr district in the state of Uttar Pradesh, India.
It is the administrative headquarters of Bulandshahr district and part of Delhi NCR region. According to the Government of India, the district Bulandshahr is one of the Minority Concentrated Districts of India on the basis of the 2011 census data on population, socio-economic indicators and basic amenities indicators.
Etymology
An early history of Bulandshahr and its origin of name is given by British District magistrate and collector for the Indian Civil Service, Frederic Salmon Growse, in a paper titled "Bulandshahr Antiquities" published in the Journal of the Asiatic Society of Bengal in 1879. Bulandshahr was founded as 'Baran' by the king Ahibaran.
Since it was perched on a highland it came to be known as "high city", (), which translates as Bulandshahr in Persian language during the Mughal era.
History
Early history
Growse's discoveries in the 1880s showed that Baran was inhabited by Buddhists between 400 and 600 AD.
The kingdom of Baran came to an end probably during the 12th century. In 1192 CE when Muhammad Ghauri conquered parts of India, his general Qutubuddin Aibak surrounded Fort Baran and conquered it and the Raja Chandrasen Dodiya was killed and Aibak took control of the Baran kingdom.
The ancient ruins found at places in Bhatora Veerpur, Ghalibpur, etc. are indicative of the antiquity of Bulandshahr. There are several other important places in the District from where statues belonging to the medieval age and objects of ancient temples have been found. Even today, several of these historical and ancient objects such as coins, inscriptions etc. are preserved in the State Museum Lucknow.
British rule
Raja Lachhman Singh (1826–1896), who served the government from 1847 and wrote a Statistical Memoir of the Bulandshahr District, moved to Bulandshahr following retirement.
Indian Rebellion of 1857
A large number of Gurjar and Rajput rulers, called zamindars, rebelled and attacked Bulandshahr itself on 21 May 1857. The Gurjars plundered multiple towns such as Sikandrabad. They burnt down Telegraph lines and Dak Bungalows. The rebelling Nawab, Walidad Khan also belonged from Bulandshahr. The presence of Nawab Walidad Khan in Bulandshahr had completely paralysed the British about this time.
Walidad Khan recruited a large number of Indian Muslims who had been serving in the Irregular Cavalry, such as Skinner's Horse.
The Indian Rebellion of 1857 is generally associated with the surrounding areas, such as Meerut, Delhi and Aligarh. On 20 May 1857, the 9th regiment of Bulandshahr looted the treasury at Bulandshahr. Sir Alfred Comyn Lyall was subsequently appointed assistant magistrate of Bulandshahr, and Lord Roberts was also present in the district.
Park
Raja Babu Park had been constructed in Bulandshahr in 1837, and a statue of Queen Victoria was placed there in 1901, when the park was renamed ‘Maharani Victoria Park’.
Development under Frederick Growse
Growse, district magistrate and collector of Bulandshahr from 1876 to 1884, resided at Collector's House. In 1884 he published Bulandshahr; or, Sketches of an Indian district; social, historical and architectural.
Post-independence
Following India's independence, ‘Maharani Victoria Park’ was renamed after Rajeshwar Dayal Saxena, president of the Civil Bar Association and later president of Municipal Board, Bulandshahar. Later it was renamed again back to 'Raja Babu Park'. In 1969 a bust of Mahatma Gandhi was established in the park.
Geography
The distance between Bulandshahr and New Delhi is 68 km. It lies in the Bulandshahr District on the Agra to Delhi Road, and is surrounded by Delhi, Meerut, Moradabad, Badaun and Aligarh.
Demographics
As per provisional data of 2011 census, Bulandshahr urban agglomeration had a population of 235,310, out of which males were 125,549 and females were 111,761. Population in the age groups of 0 to 6 years was 30,886. The total number of literates were 160,203, of which 90,761 were males and 69,442 were females. The effective literacy rate of 7+ population was 78.37%.
Administration and politics
Bulandshahr is one of seven administrative sub-divisions of the District of Bulandshahr.
Buildings
Bulandshahr has four gates; Bunford Club Gate, Fatehganj Gate, Growseganj Gate and Moti Bagh Gate.
Events
The town hosts an annual exhibition known as 'numaish'.
Attractions
Clock Tower
Clock Tower is a historical landmark from the Victorian era located at the centre of Bulandshahr district in Raja Babu Park or Malka Park which was constructed during the British period in 1837. In 1901, a statue of Queen Victoria was placed in this park and the park was named as 'Maharani Victoria Park'. After the independence of the country, it was renamed as 'Raja Babu Park'. In 1969, a statue of Mahatma Gandhi was established inside the tower.
Kuchesar Fort
Kuchesar Fort, (alternatively known as 'Rao Raj Vilas Kuchesar Fort') is located at Kuchesar, in Bulandshahr, Uttar Pradesh, India, approximately 84.3 kilometres (52.4 miles) east of Delhi.
The fort served as the erstwhile seat of the Jat Kingdom of Uttar Pradesh.
MiG-27 Fighter Aircraft
Mikoyan MiG-27, a supersonic swing-wing fighter aircraft is placed on static display at Veteran's Air Force School in Ganganagar, Bulandshahr. This is the first MiG-27 to be preserved and publicly displayed in Uttar Pradesh.
The Kargil War veteran has also featured on 'Warbirds of India'
by PVS Jagan Mohan, a military historian who authored The India-Pakistan Air War of 1965.
Notable people
Capt. Abbas Ali
Ahibaran, legendary founder of the city
Ziauddin Barani, Indian historian
Kay Baxter, dramatist, journalist and teacher
Amit Bhadana, YouTuber and comedian
Ashiq Ilahi Bulandshahri, Indian Islamic scholar
Sonal Chauhan
Banarasi Das
Jaiprakash Gaur
Saloni Gaur
Arif Mohammad Khan
Bhuvneshwar Kumar, fast bowler in the Indian cricket team.
Satish Kumar
Hitesh Kumari, former minister of UP irrigation department, and MLA from Debai assembly constituency.
Gajendra Pal Singh Raghava, scientist expert in bioinformatics, winner of awards including Shanti Swarup Bhatnagar Prize for Science and Technology
Lakhan Rawat, cricketer
Arfa Khanum Sherwani, Indian journalist
Kushal Pal Singh, CEO of DLF Limited, India's largest real estate developer.
Neera Yadav, ex-officer of the Indian Administrative Service.
Yogendra Singh Yadav, youngest ever Param Vir Chakra winner.
Gallery
See also
Baranwal
References
External links
Bulandshahr: Or, Sketches of an Indian District: Social, Historical and Architectural. Frederic Salmon Growse, Benares (1884).
Cities in Uttar Pradesh
|
```smalltalk
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
public delegate void EventHandle(params object[] args);
public delegate void EventHandle<T>(T e, params object[] args);
public class GlobalEvent
{
#region EnumKey
private static Dictionary<Enum, EventHandle> mEventDic = new Dictionary<Enum, EventHandle>();
private static Dictionary<Enum, List<EventHandle>> mUseOnceEventDic = new Dictionary<Enum, List<EventHandle>>();
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="handle"></param>
/// <param name="isUseOnce"></param>
public static void AddEvent(Enum type, EventHandle handle, bool isUseOnce = false)
{
if (isUseOnce)
{
if (mUseOnceEventDic.ContainsKey(type))
{
if (!mUseOnceEventDic[type].Contains(handle))
mUseOnceEventDic[type].Add(handle);
else
Debug.LogWarning("already existing EventType: " + type + " handle: " + handle);
}
else
{
List<EventHandle> temp = new List<EventHandle>();
temp.Add(handle);
mUseOnceEventDic.Add(type, temp);
}
}
else
{
if (mEventDic.ContainsKey(type))
{
mEventDic[type]+= handle;
}
else
{
mEventDic.Add(type, handle);
}
}
}
internal static void AddTypeEvent<T>(string v)
{
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="handle"></param>
public static void RemoveEvent(Enum type, EventHandle handle)
{
if (mUseOnceEventDic.ContainsKey(type))
{
if (mUseOnceEventDic[type].Contains(handle))
{
mUseOnceEventDic[type].Remove(handle);
if (mUseOnceEventDic[type].Count == 0)
{
mUseOnceEventDic.Remove(type);
}
}
}
if (mEventDic.ContainsKey(type))
{
mEventDic[type]-= handle;
}
}
internal static void AddTypeEvent<T>()
{
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="type"></param>
public static void RemoveEvent(Enum type)
{
if (mUseOnceEventDic.ContainsKey(type))
{
mUseOnceEventDic.Remove(type);
}
if (mEventDic.ContainsKey(type))
{
mEventDic.Remove(type);
}
}
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="args"></param>
public static void DispatchEvent(Enum type, params object[] args)
{
if (mEventDic.ContainsKey(type))
{
try
{
if (mEventDic[type] != null)
{
mEventDic[type](args);
}
}
catch (Exception e)
{
Debug.LogError(e.ToString());
}
}
if (mUseOnceEventDic.ContainsKey(type))
{
for (int i = 0; i < mUseOnceEventDic[type].Count; i++)
{
//
foreach (EventHandle callBack in mUseOnceEventDic[type][i].GetInvocationList())
{
try
{
callBack(args);
}
catch (Exception e)
{
Debug.LogError(e.ToString());
}
}
}
RemoveEvent(type);
}
}
#endregion
#region StringKey
private static Dictionary<string, List<EventHandle>> m_stringEventDic = new Dictionary<string, List<EventHandle>>();
private static Dictionary<string, List<EventHandle>> m_stringOnceEventDic = new Dictionary<string, List<EventHandle>>();
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="handle"></param>
/// <param name="isUseOnce"></param>
public static void AddEvent(string eventKey, EventHandle handle, bool isUseOnce = false)
{
if (isUseOnce)
{
if (m_stringOnceEventDic.ContainsKey(eventKey))
{
if (!m_stringOnceEventDic[eventKey].Contains(handle))
m_stringOnceEventDic[eventKey].Add(handle);
else
Debug.LogWarning("already existing EventType: " + eventKey + " handle: " + handle);
}
else
{
List<EventHandle> temp = new List<EventHandle>();
temp.Add(handle);
m_stringOnceEventDic.Add(eventKey, temp);
}
}
else
{
if (m_stringEventDic.ContainsKey(eventKey))
{
if (!m_stringEventDic[eventKey].Contains(handle))
m_stringEventDic[eventKey].Add(handle);
else
Debug.LogWarning("already existing EventType: " + eventKey + " handle: " + handle);
}
else
{
List<EventHandle> temp = new List<EventHandle>();
temp.Add(handle);
m_stringEventDic.Add(eventKey, temp);
}
}
}
internal static void AddEvent<T>(object onRequestRealNameResult)
{
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="handle"></param>
public static void RemoveEvent(string eventKey, EventHandle handle)
{
if (m_stringEventDic.ContainsKey(eventKey))
{
if (m_stringEventDic[eventKey].Contains(handle))
{
m_stringEventDic[eventKey].Remove(handle);
//if (m_stringEventDic[eventKey].Count == 0)
//{
// m_stringEventDic.Remove(eventKey);
//}
}
}
if (m_stringOnceEventDic.ContainsKey(eventKey))
{
if (m_stringOnceEventDic[eventKey].Contains(handle))
{
m_stringOnceEventDic[eventKey].Remove(handle);
//if (m_stringOnceEventDic[eventKey].Count == 0)
//{
// m_stringOnceEventDic.Remove(eventKey);
//}
}
}
}
/// <summary>
///
/// </summary>
/// <param name="eventKey"></param>
public static void RemoveEvent(string eventKey)
{
if (m_stringEventDic.ContainsKey(eventKey))
{
m_stringEventDic.Remove(eventKey);
}
if (m_stringOnceEventDic.ContainsKey(eventKey))
{
m_stringOnceEventDic.Remove(eventKey);
}
}
/// <summary>
///
/// </summary>
public static void RemoveAllEvent()
{
mUseOnceEventDic.Clear();
mEventDic.Clear();
m_stringEventDic.Clear();
}
/// <summary>
///
/// </summary>
/// <param name="eventKey"></param>
/// <param name="args"></param>
public static void DispatchEvent(string eventKey, params object[] args)
{
if (m_stringEventDic.ContainsKey(eventKey))
{
for (int i = 0; i < m_stringEventDic[eventKey].Count; i++)
{
//
foreach (EventHandle callBack in m_stringEventDic[eventKey][i].GetInvocationList())
{
try
{
callBack(args);
}
catch (Exception e)
{
Debug.LogError(e.ToString());
}
}
}
}
if (m_stringOnceEventDic.ContainsKey(eventKey))
{
for (int i = 0; i < m_stringOnceEventDic[eventKey].Count; i++)
{
//
foreach (EventHandle callBack in m_stringOnceEventDic[eventKey][i].GetInvocationList())
{
try
{
callBack(args);
}
catch (Exception e)
{
Debug.LogError(e.ToString());
}
}
}
RemoveEvent(eventKey);
}
}
#endregion
#region TypeKey
private static Dictionary<Type, EventDispatcher> mTypeEventDic = new Dictionary<Type, EventDispatcher>();
private static Dictionary<Type, EventDispatcher> mTypeUseOnceEventDic = new Dictionary<Type, EventDispatcher>();
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="handle"></param>
/// <param name="isUseOnce"></param>
public static void AddTypeEvent<T>( EventHandle<T> handle, bool isUseOnce = false)
{
GetEventDispatcher<T>(isUseOnce).m_CallBack += handle;
}
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="handle"></param>
public static void RemoveTypeEvent<T>(EventHandle<T> handle, bool isUseOnce = false)
{
GetEventDispatcher<T>(isUseOnce).m_CallBack -= handle;
}
/// <summary>
///
/// </summary>
/// <param name="type"></param>
public static void RemoveTypeEvent<T>(bool isUseOnce = false)
{
GetEventDispatcher<T>(isUseOnce).m_CallBack = null;
}
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="args"></param>
public static void DispatchTypeEvent<T>(T e, params object[] args)
{
GetEventDispatcher<T>(false).Call(e,args);
//
GetEventDispatcher<T>(true).Call(e, args);
GetEventDispatcher<T>(true).m_CallBack = null;
}
static EventDispatcher<T> GetEventDispatcher<T>(bool isOnce)
{
Type type = typeof(T);
if (isOnce)
{
if (mTypeUseOnceEventDic.ContainsKey(type))
{
return (EventDispatcher<T>)mTypeUseOnceEventDic[type];
}
else
{
EventDispatcher<T> temp = new EventDispatcher<T>();
mTypeUseOnceEventDic.Add(type, temp);
return temp;
}
}
else
{
if (mTypeEventDic.ContainsKey(type))
{
return (EventDispatcher<T>)mTypeEventDic[type];
}
else
{
EventDispatcher<T> temp = new EventDispatcher<T>();
mTypeEventDic.Add(type, temp);
return temp;
}
}
}
abstract class EventDispatcher{}
class EventDispatcher<T> : EventDispatcher
{
public EventHandle<T> m_CallBack;
public void Call(T e,params object[] args)
{
if(m_CallBack != null)
{
try
{
m_CallBack(e, args);
}
catch(Exception exc)
{
Debug.LogError(exc.ToString());
}
}
}
}
#endregion
}
public class EventHandRegisterInfo
{
public Enum m_EventKey;
public EventHandle m_hande;
public void RemoveListener()
{
GlobalEvent.RemoveEvent(m_EventKey, m_hande);
}
}
```
|
```java
/*
This file is part of the iText (R) project.
Authors: Apryse Software.
This program is offered under a commercial and under the AGPL license.
For commercial licensing, contact us at path_to_url For AGPL licensing, see below.
AGPL licensing:
This program is free software: you can redistribute it and/or modify
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
along with this program. If not, see <path_to_url
*/
package com.itextpdf.io.source;
import java.nio.channels.FileChannel;
/**
* A RandomAccessSource that represents a memory mapped section of an underlying FileChannel.
* This source can be closed and will automatically re-open as needed.
* This class is an internal implementation detail of the {@link FileChannelRandomAccessSource} class and
* shouldn't be used by general iText users.
*/
class MappedChannelRandomAccessSource implements IRandomAccessSource {
/**
* The underlying channel
*/
private final FileChannel channel;
/**
* The offset into the channel that this source maps to
*/
private final long offset;
/**
* The number of bytes this source maps to
*/
private final long length;
/**
* If the map is active, the actual map. null other wise.
*/
private ByteBufferRandomAccessSource source;
/**
* Create a new source based on the channel. Mapping will not occur until data is actually read.
* @param channel the underlying channel
* @param offset the offset of the map
* @param length the length of the map
*/
public MappedChannelRandomAccessSource(FileChannel channel, long offset, long length) {
if (offset < 0)
throw new IllegalArgumentException(offset + " is negative");
if (length <= 0)
throw new IllegalArgumentException(length + " is zero or negative");
this.channel = channel;
this.offset = offset;
this.length = length;
this.source = null;
}
/**
* Map the region of the channel
* @throws java.io.IOException if there is a problem with creating the map
*/
void open() throws java.io.IOException {
if (source != null)
return;
if (!channel.isOpen())
throw new IllegalStateException("Channel is closed");
source = new ByteBufferRandomAccessSource(channel.map(FileChannel.MapMode.READ_ONLY, offset, length));
}
/**
* {@inheritDoc}
*/
public int get(long position) throws java.io.IOException {
if (source == null)
throw new java.io.IOException("RandomAccessSource not opened");
return source.get(position);
}
/**
* {@inheritDoc}
*/
public int get(long position, byte[] bytes, int off, int len) throws java.io.IOException {
if (source == null)
throw new java.io.IOException("RandomAccessSource not opened");
return source.get(position, bytes, off, len);
}
/**
* {@inheritDoc}
*/
public long length() {
return length;
}
/**
* {@inheritDoc}
*/
public void close() throws java.io.IOException {
if (source == null)
return;
source.close();
source = null;
}
@Override
public String toString() {
return getClass().getName() + " (" + offset + ", " + length + ")";
}
}
```
|
Dalton Smarsh (born c. 1950) is a Canadian former football player. He is known for his playing career at the University of Alberta, where he is described as "one of the most outstanding running backs in the history of Golden Bear football".
Smarsh played for the Alberta Golden Bears football team as a running back from 1972 to 1976. In 1972 the Bears won the CIAU Championship, and in 1974, he was a member of the CIAU All-Canadian team. Smarsh was also captain of the Golden Bears football team for four seasons, and set many CIAU records. He graduated from the university with a Bachelor of Education degree. Though was selected in the 1976 CFL Draft by the Saskatchewan Roughriders in the 7th round, 61st overall, Smarsh decided to pursue a career in education, and worked for Edmonton Public Schools where was a physical education teacher, also coaching high school sports. He retired around 2007 from teaching. Smarsh has also served as offensive coordinator of the Golden Bears (1985), and as a coach of the Edmonton Wildcats. He won a championship with the Wildcats in 1983, and won the coach of the year award that same season. In 2001, he was inducted into the University of Alberta's Sports Wall of Fame. Smarsh was named head coach of the Edmonton Huskies in November 2007; he would serve in that capacity until he was let go in September 2009.
References
Year of birth missing (living people)
Living people
Alberta Golden Bears football players
Canadian football running backs
Players of Canadian football from Alberta
Canadian football people from Edmonton
|
Mayo River State Park is a North Carolina state park in Rockingham County, North Carolina in the United States. It covers along the Mayo River, and it adjoins a Virginia State Park of the same name. North Carolina's park is near Mayodan, North Carolina. The park is one of the newest in the North Carolina system, having been authorized by the General Assembly in May 2003.
History
In May 2003, the North Carolina General Assembly authorized a state park along the Mayo River, from the Virginia-North Carolina state line, to the river's confluence with the Dan River.
The Mayo Mountain Access was opened to the public on April 1, 2010, as an interim facility.
For the first decade of its existence, the park struggled to obtain land with access to the river's edge. Most of the state's initial park properties were above the river, where it may be seen, but not reached.
In 2016, Piedmont Land Conservancy (PLC) acquired a tract from Mayo Properties LLC, which ran along both sides the Mayo River for . The tract was originally assembled by investors in the 1950's, with plans to dam the Mayo as a water reservoir for the City of Greensboro. The plans never came into fruition, as Greensboro aided the development of the Randleman Reservoir on the Deep River instead. Duke Energy aided PLC, with a $1.1 million grant for the purchase of the property, as part of their restoration activity for the 2014 Dan River coal ash spill.
In 2019, PLC acquired another tract, which included Mayo Beach and the Boiling Hole. A former property of Washington Mills Company, the linear track consists of of the river's right and left banks, and it tied several existing park parcels together. Duke Energy provided a $363,000 grant for the acquisition.
Recreation
Mayo River State Park consists of multiple, disconnected access areas spread along the river.
Mayo Mountain access
The park's principle public access area is the Mayo Mountain Access, near Mayodan.
The access was once a corporate facility, formally known as Mayo Park, which was opened by the Washington Mills Company in 1948. Architect Antonin Raymond designed the original Mayo Park, which included a picnic shelter, a fishing pond, a swimming pond with a beach and a bathhouse. The state renovated and restored some of the existing structures from the former park, while trying to maintain a style compatible with Raymond's design. By the time North Carolina State Parks obtained the property, Raymond's bathhouse had degraded beyond repair. A restroom building resembling the former bathhouse's design was constructed in its place, and materials salvaged from the bathhouse were incorporated into it. The diving platform and other swimming facilities were removed from the swimming pond.
The core of the access area consists of a visitor contact station, two picnic shelters, a small picnic area, two catch and release fishing ponds, a restroom building and a trailhead. The Mayo Mountain Loop Trail starts at the picnic area, and it leads hikers along the ridge of Mayo Mountain. The trail does not reach the summit, which is private property. The Inner Loop Trail is formed by a shortcut of the Mayo Mountain loop, which avoids ascending the mountain. The access area also has a 40-person group campground set away from the rest of the park facilities.
Deshazo Mill access
The park's Deshazo Mill access is its northernmost and second-developed area. The access has a small parking and picnic area, which serve as the trailhead for the Mayo River Trail. The trail takes hikers past Fall Creek Falls, before reaching the Mayo River. The trail then turns north and passes by the confluence of the North and South Forks of the Mayo, and it formally ends at Bryd's Ledge. Named for Mr Bryd, the rock formation in the North Mayo River was a landmark when the North Carolina–Virginia state line was surveyed. An informal trail continues on into Virginia's Mayo River State Park.
Anglin Mill access
The Anglin Mill access, also known as Mayo Beach, is along a naturally sandy bank of the river. The beach is a popular local swimming area, and upstream of the beach is a Class III rapid, called the Boiling Hole. This stretch of the river is commonly used for playboating, due to its ease of access.
Hickory Creek access
The Hickory Creek access provides hikers an informal trailhead near Hickory Creek and a trail which leads to the river.
Mayodan access
Close to downtown Mayodan, the Mayodan access provides a primitive put-in for kayaks and canoes.
Virginia's Mayo River State Park
After North Carolina began development of its state park, the State of Virginia studied the creation of its own adjoining state park in 2007. The Virginia Department of Conservation and Recreation concluded the park was feasible, and in 2009 it acquired an initial tract adjoining North Carolina's park. Virginia proposed merging the two parks together into an 'interstate park'; however, North Carolina declined, preferring a separate but cooperative approach to park management. Some of the properties North Carolina acquired for its park, extended into Virginia. To aid with the growth of Virginia's park, North Carolina kept its out-of-state landholdings until Virginia could purchase them in 2013. In October 2021, Virginia broke ground on visitor facilities for its park, and it opened a multi-use trail system to the public on Earth Day, April 22, 2022.
Nearby state parks
The following state parks are within of Mayo River State Park:
Hanging Rock State Park
Haw River State Park
Pilot Mountain State Park
References
External links
Session Law 2003-106 established Mayo River State Park
State parks of North Carolina
Protected areas of Rockingham County, North Carolina
Protected areas established in 2003
2003 establishments in North Carolina
|
Killester Basketball Club is an Irish basketball club based in Dublin. The club's senior men's and women's representative teams, Pyrobel Killester, both play in Ireland's top national leagues with their home stadium being IWA Sports Hall in Clontarf.
History
The club was established in 1967 by Michael Casey.
In 1973, Killester was an inaugural team in the Irish National League. Between 1975 and 1977, the team won three championships in a row. Between 2001 and 2014, they won five championships and three National Cup titles.
In 1978, Killester entered the inaugural season of the women's competition. The team won the competition's first two titles. The women won two National Cup titles in 2002 and 2005.
Notable past players
Mario Elie
/ Jermaine Turner
References
External links
Official website
Killester
Super League (Ireland) teams
Basketball teams in County Dublin
|
```xml
<Weavers xmlns:xsi="path_to_url" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<AutoProperties />
<Throttle />
</Weavers>
```
|
Morricone may refer to:
Morricone Youth, an American band
152188 Morricone, an asteroid
People with the surname
Andrea Morricone (born 1964), Italian composer and conductor
Ennio Morricone (1928–2020), Italian composer, orchestrator, conductor, and trumpet player
|
```yaml
date: February 28, 2023
bug_fixes:
- area: dependency
change: |
update Kafka to resolve CVE-2023-25194.
new_features:
- area: docker
change: |
unify published images as tag variants. For example, ``envoyproxy/envoy-dev`` is now available
as ``envoyproxy/envoy:dev``.
```
|
Lady Jiranun Sakultangphaisal (, RTGS: Chiranun Sakultangpaisan, born 22 December 1965 in Sakhon Nakhon, Thailand) is a Thai feminist and philanthropist, and is ranked as one of Thailand's 100 leading women. She was made Thailand's National Outstanding Woman in 2015, and a National Exemplary Mother in 2016.
She currently serves as an executive in the Thai government's leading Public-private partnership project, the Pracharat programme.
Personal life
Jiranun married Boonyarit Sakultangphaisal. The couple has two children – Supanida Sakultangphaisal (born in 1987) and Chinnawat Sakultangphaisal (born in 1991).
Together with philanthropy, Jiranun also has deep interests in Thai literature, Thai culture, and culinary art.
Social work
Lady Sakultangphaisal is a philanthropist and a feminist. Currently, she is a Chairman of the Catholic Commissions for Women, Head of the Women Promotion Division of Zonta International Club, Bangkok, and a Chair of the National Catholic Commissions for Social Development. Her work with these NGOs involves reducing problems associated with materialism in girls and prostitution.
Jiranun currently holds a number of posts in the government body and public sector, most of which are related to community development. In many interviews, she emphasizes the importance of sustainable development, strong families and communities, in reducing social problems and poverty.
Apart from her community work, she is also a board of directors of the Bangkok Opera (Bangkok Opera Foundation under the Royal Patronage of Princess Galyani Vadhana). She sits in the Khon Kaen University Campus Council as an advisor to the Faculty of Integrated Social Science.
Awards and recognition
In December 1999, the Lions Club International 310E committee presented her with the Harmony Award for "her outstanding work to help others in need".
In October 2008, Jiranun was made one of the 100 Leading Women of Thailand, where she received an honorary award from Princess Soamsavali of Thailand, at the same time as Khunying Kalaya Sophonpanich, the then Minister of Science and Technology.
In 2009, Jiranun received the Woman Development Award for her contributions in advancing women's status in Thailand.
In 2013, Jiranun received a royal decoration, the Red Cross Awards Medal, for her services to the Thai Red Cross Society, from Princess Sirindhorn.
In 2015, on the recommendation of the Ministry of Social Development and Human Security and the National Council of Women of Thailand, under Royal Patronage, Jiranun received Thailand's National Outstanding Woman Award from Queen Sirikit of Thailand.
References
External links
1965 births
Living people
Jiranun Sakultangphaisal
Jiranun Sakultangphaisal
|
```kotlin
package de.westnordost.streetcomplete.data.osm.edits
import de.westnordost.streetcomplete.data.osm.geometry.ElementGeometry
import de.westnordost.streetcomplete.data.osm.mapdata.ElementKey
import de.westnordost.streetcomplete.data.osm.mapdata.MapDataUpdates
import de.westnordost.streetcomplete.data.preferences.Preferences
import de.westnordost.streetcomplete.util.Listeners
import de.westnordost.streetcomplete.util.ktx.nowAsEpochMilliseconds
import de.westnordost.streetcomplete.util.logs.Log
class ElementEditsController(
private val editsDB: ElementEditsDao,
private val editElementsDB: EditElementsDao,
private val elementIdProviderDB: ElementIdProviderDao,
private val prefs: Preferences
) : ElementEditsSource, AddElementEditsController {
/* Must be a singleton because there is a listener that should respond to a change in the
* database table */
private val listeners = Listeners<ElementEditsSource.Listener>()
/* ----------------------- Unsynced edits and syncing them -------------------------------- */
/** Add new unsynced edit to the to-be-uploaded queue */
override fun add(
type: ElementEditType,
geometry: ElementGeometry,
source: String,
action: ElementEditAction,
isNearUserLocation: Boolean
) {
Log.d(TAG, "Add ${type.name} for ${action.elementKeys.joinToString()}")
add(ElementEdit(0, type, geometry, source, nowAsEpochMilliseconds(), false, action, isNearUserLocation))
}
override fun get(id: Long): ElementEdit? =
editsDB.get(id)
override fun getAll(): List<ElementEdit> =
editsDB.getAll()
override fun getAllUnsynced(): List<ElementEdit> =
editsDB.getAllUnsynced()
fun getOldestUnsynced(): ElementEdit? =
editsDB.getOldestUnsynced()
fun getIdProvider(id: Long): ElementIdProvider =
elementIdProviderDB.get(id)
/** Delete old synced (aka uploaded) edits older than the given timestamp. Used to clear
* the undo history */
fun deleteSyncedOlderThan(timestamp: Long): Int {
val deletedCount: Int
val deleteEdits: List<ElementEdit>
synchronized(this) {
deleteEdits = editsDB.getSyncedOlderThan(timestamp)
if (deleteEdits.isEmpty()) return 0
val ids = deleteEdits.map { it.id }
deletedCount = editsDB.deleteAll(ids)
editElementsDB.deleteAll(ids)
}
onDeletedEdits(deleteEdits)
/* must be deleted after the callback because the callback might want to get the id provider
for that edit */
elementIdProviderDB.deleteAll(deleteEdits.map { it.id })
return deletedCount
}
override fun getUnsyncedCount(): Int =
editsDB.getUnsyncedCount()
override fun getPositiveUnsyncedCount(): Int {
val unsynced = editsDB.getAllUnsynced().map { it.action }
return unsynced.filter { it !is IsRevertAction }.size - unsynced.filter { it is IsRevertAction }.size
}
fun markSynced(edit: ElementEdit, elementUpdates: MapDataUpdates) {
val idUpdatesMap = elementUpdates.idUpdates.associate {
ElementKey(it.elementType, it.oldElementId) to it.newElementId
}
val syncSuccess: Boolean
synchronized(this) {
val editIdsToUpdate = elementUpdates.idUpdates.flatMapTo(HashSet()) {
editElementsDB.getAllByElement(it.elementType, it.oldElementId)
}
for (id in editIdsToUpdate) {
val oldEdit = editsDB.get(id) ?: continue
val updatedEdit = oldEdit.copy(action = oldEdit.action.idsUpdatesApplied(idUpdatesMap))
editsDB.put(updatedEdit)
// must clear first because the element ids associated with this id are different now
editElementsDB.delete(id)
editElementsDB.put(id, updatedEdit.action.elementKeys)
}
syncSuccess = editsDB.markSynced(edit.id)
}
if (syncSuccess) onSyncedEdit(edit.copy(isSynced = true))
elementIdProviderDB.updateIds(elementUpdates.idUpdates)
}
fun markSyncFailed(edit: ElementEdit) {
delete(edit)
}
/* ----------------------- Undoable edits and undoing them -------------------------------- */
/** Undo edit with the given id. If unsynced yet, will delete the edit if it is undoable. If
* already synced, will add a revert of that edit as a new edit, if possible */
fun undo(edit: ElementEdit): Boolean {
if (edit.isSynced) {
// already uploaded
val action = edit.action
if (action !is IsActionRevertable) return false
// first create the revert action, as ElementIdProvider will be deleted when deleting the edit
val reverted = action.createReverted(getIdProvider(edit.id))
Log.d(TAG, "Add revert ${edit.type.name} for ${edit.action.elementKeys.joinToString()}")
// need to delete the original edit from history because this should not be undoable anymore
delete(edit)
// ... and add a new revert to the queue
add(ElementEdit(0, edit.type, edit.originalGeometry, edit.source, nowAsEpochMilliseconds(), false, reverted, edit.isNearUserLocation))
} else {
// not uploaded yet
Log.d(TAG, "Undo ${edit.type.name} for ${edit.action.elementKeys.joinToString()}")
delete(edit)
}
return true
}
/* ------------------------------------ add/sync/delete ------------------------------------- */
private fun add(edit: ElementEdit) {
synchronized(this) {
editsDB.put(edit)
editElementsDB.put(edit.id, edit.action.elementKeys)
val createdElementsCount = edit.action.newElementsCount
elementIdProviderDB.assign(
edit.id,
createdElementsCount.nodes,
createdElementsCount.ways,
createdElementsCount.relations
)
}
onAddedEdit(edit)
}
private fun delete(edit: ElementEdit) {
val edits = mutableListOf<ElementEdit>()
val ids: List<Long>
synchronized(this) {
edits.addAll(getEditsBasedOnElementsCreatedByEdit(edit))
ids = edits.map { it.id }
editsDB.deleteAll(ids)
editElementsDB.deleteAll(ids)
}
onDeletedEdits(edits)
/* must be deleted after the callback because the callback might want to get the id provider
for that edit */
elementIdProviderDB.deleteAll(ids)
}
private fun getEditsBasedOnElementsCreatedByEdit(edit: ElementEdit): List<ElementEdit> {
val result = mutableListOf<ElementEdit>()
val createdElementKeys = elementIdProviderDB.get(edit.id).getAll()
val editsBasedOnThese = createdElementKeys
.flatMapTo(HashSet()) { editElementsDB.getAllByElement(it.type, it.id) }
.mapNotNull { editsDB.get(it) }
.filter { it.id != edit.id }
// deep first
for (e in editsBasedOnThese) {
result += getEditsBasedOnElementsCreatedByEdit(e)
}
result += edit
return result
}
/* ------------------------------------ Listeners ------------------------------------------- */
override fun addListener(listener: ElementEditsSource.Listener) {
listeners.add(listener)
}
override fun removeListener(listener: ElementEditsSource.Listener) {
listeners.remove(listener)
}
private fun onAddedEdit(edit: ElementEdit) {
prefs.lastEditTime = nowAsEpochMilliseconds()
listeners.forEach { it.onAddedEdit(edit) }
}
private fun onSyncedEdit(edit: ElementEdit) {
listeners.forEach { it.onSyncedEdit(edit) }
}
private fun onDeletedEdits(edits: List<ElementEdit>) {
listeners.forEach { it.onDeletedEdits(edits) }
}
companion object {
private const val TAG = "ElementEditsController"
}
}
```
|
```ruby
# frozen_string_literal: true
require "spec_helper"
module Decidim
module Comments
describe LeaveUserGroup do
describe "call" do
let(:organization) { create(:organization) }
let(:membership) { create(:user_group_membership, role:) }
let(:role) { :admin }
let(:user) { membership.user }
let(:user_group) { membership.user_group }
let(:command) { described_class.new(user, user_group) }
context "when the user is the creator" do
let(:role) { :creator }
it "broadcasts last admin cannot leave group" do
expect { command.call }.to broadcast(:last_admin)
end
context "and there is another admin in the group" do
let!(:another_membership) { create(:user_group_membership, user_group:, role: :admin) }
it "broadcasts ok" do
expect { command.call }.to broadcast(:ok)
end
end
context "and there is another member in the group" do
let!(:another_membership) { create(:user_group_membership, user_group:, role: :member) }
it "does not allow last admin to leave the group" do
expect { command.call }.to broadcast(:last_admin)
end
end
end
context "when the user has no membership with the group" do
let(:user) { create(:user) }
let(:user_group) { create(:user_group) }
it "broadcasts invalid" do
expect { command.call }.to broadcast(:invalid)
end
end
context "when the data is valid" do
let(:role) { :member }
it "broadcasts ok" do
expect { command.call }.to broadcast(:ok)
end
it "deletes the membership" do
membership
expect do
command.call
end.to change(Decidim::UserGroupMembership, :count).by(-1)
expect do
membership.reload
end.to raise_error(ActiveRecord::RecordNotFound)
end
end
end
end
end
end
```
|
Dr. Ilkka Matti Tapani Hakalehto (1936–2009) was a Finnish historian and politician.
Hakalehto was known as a principled eurosceptic, who held that the European Union actively threatened the independence of Finland. From 1994–2004, he served as the president of the Vapaan Suomen liitto party ("Free Finland association"), formed in response to Finland's accession to the European Union in 1994. He stood as the True Finns candidate in the presidential election of 2000, achieving 1% of the vote. From 1979 onward, he had a docenture in political history at the University of Helsinki. He was also a long time member of Helsinki city council, representing first Centre Party (1972–1987) and then as independent (1987–2004).
References
Finnish politicians
2009 deaths
1936 births
Candidates for President of Finland
|
Greenvalley Public School is an educational institution in Nellikuzhi, Kothamangalam, in the state of Kerala, India. TIt is affiliated to Central Board of Secondary Education, New Delhi, for AISSE (Grade 10) and AISSCE (Grade 12) examinations. It was established in 1996 by Molly Pradeep, late wife of the present director, Pradeep Kuriakose. It has a sister school in Perumbavoor, which provides elementary education.
Academics
The school has eight periods a day, each around 40 minutes. The school day runs from 9:30 until 3:30. A snack break is held from 10:55-11:00am, lunch break from 12:55-1:20pm, and another short break from 2:45-2:50pm.
The school is open for Mothers' Pride to Grade 12 [Kindergarten to 12th standard] and the age group is from 3 years to 17 years. The school is divided into sub-juniors (kindergarten to III), juniors (III–VI) and seniors (VII-X) and super-seniors (XI and XII) classes.
Facilities
Computer laboratory
Mathematics laboratory
Biology, physics and chemistry laboratories
Library with magazines, newspaper and books
Music, dance, jazz, yoga, sports, karate, drawing, work experience and art and crafts room
Courts for basketball, tennis, badminton and martial arts
First aid room with qualified nurses
Stationery store, providing pens, pencils, books, other basics and uniform clothes
Clean and hygienic washroom and toilets
15 school buses
Club system
All students from classes III to X belong to one of the four clubs. The four clubs with their colours and mascots are:
Victors - blue, Unicorn
Legends - green, Lion
Elites - red, Dragon
Leaders - yellow, Horse
Each house is assigned a captain from class X, a vice-captain from class IX and three teachers-in-charge. Each house competes to win the best House Award every year. Inter-house competitions are also held throughout the year starting with floral carpet competitions during Onam celebrations. An inter-house sports tournament is also held, with track and field sports and chess competitions.
School committee
The director and principal jointly decide a girl and a boy from class XII as head girl and head boy, who represent students in school programmes. The student committee is led by the head boy, the head girl and a sports captain from class XII. The house captains and vice captains are also members of the committee.
Extra-curricular activities
Extra-curricular activities include football, volleyball, badminton, swimming, drawing/painting, drama, debate and quiz.
Elocution, recitation, quiz and light music are conducted on Arts Day. Indian games including Kho kho and kabaddi are also encouraged.
School programmes
The school-conducted programmes include an Arts Day, Sports Day, Science/Maths/Computer Fair and celebrations on Christmas and Onam. For entertainment purposes the school conducts an anniversary celebration as well as an excursion. The school's anniversary function has been conducted biennially since 2005. The school also conducts the Kerala Mango Festival, at Ernakulam Town Hall in 2010 and at Kakkanad in 2014. Students from classes VII, VIII, IX and X organise the event under the guidance of the director and principal.
References
Schools in Ernakulam district
Educational institutions established in 1995
1995 establishments in Kerala
|
```javascript
Deleting Files and Folders
Incremental Rebuilding
Running tasks in series
External Configuration Files
Server with Live-Reloading
```
|
Evert V. "Eph" Snedecker (1838 – January 29, 1899) was an American Thoroughbred horse racing trainer and owner.
Born on Long Island, New York, Evert Snedecker grew up in a family involved with the sport of horse racing. His grandparents owned racehorses and one of his uncles was a trainer. In 1852 he went to work at the uncle's stable where he would learn to be a trainer. From there, he was hired as assistant trainer to John Miner who was then handling the John Hunter racing stable. Hunter became the first chairman of The Jockey Club and in partnership with William Travers built Saratoga Race Course.
In 1876 Evert Snedecker was hired by the newly formed Dwyer Brothers Stable. In October of that year the Dwyers bought the colt Vigil from Col. David McDaniel. To that point in the year, the colt had earned $5,630 but in the ensuing few months under Snedecker won another $20,160. Vigil would be chosen the 1876 retrospective American Champion Three-Year-Old Male Horse. In 1884, Snedecker conditioned St. Saviour, owned by Frederick Gebhard, who was also selected as the retrospective American Champion Three-Year-Old Male Horse for 1884.
During his career, Evert Snedecker trained for other notable owners such as George Lorillard and J. Otto Donner.
At an 1885 sale of Spendthrift yearlings at Madison Square Garden in New York City, Evert Snedecker purchased a colt for $2,250 he named Kingston. At age two, Kingston was the third highest rated colt of his age group, earning wins in the August and Select Stakes. At the end of the year, Snedecker sold Kingston to the Dwyer Brothers for $12,500. The colt went on to win a career total of 89 races, the most in the history of the sport of Thoroughbred horse racing and earn induction in the U.S. Racing Hall of Fame.
Snedecker died of a heart attack at the Morris Park Racecourse in Westchester County, New York.
References
1838 births
1899 deaths
American horse trainers
People from Long Island
|
Remacemide is a drug which acts as a low-affinity NMDA antagonist with sodium channel blocking properties. It has been studied for the treatment of acute ischemic stroke, epilepsy, Huntington's disease, and Parkinson's disease.
Because remacemide has only a modest effect on seizure frequency and causes dizziness, it is no longer believed that remacemide will be an effective treatment for epilepsy. Although no such statement has been made about remacemide's potential for treating stroke, Huntington's, or Parkinson's, remacemide is no longer being developed for these conditions.
Remacemide is also known as remacemide hydrochloride, (±)-2-amino-N-(1-methyl-1,2-diphenylethyl)-acetamide hydrochloride, or FPL 12924AA.
Adverse effects
dizziness
nausea
Lack of adverse effects
Unlike many other treatments for epilepsy, remacemide does not appear to impair cognitive performance or driving performance in humans, although the evidence for effects on cognitive performance in animals has been mixed.
Remacemide is not a sedative.
Toxicity
The median toxic dose of remacemide for neural impairment tests in mice is 5.6 mg/kg.
Its estimated median lethal dose is about 927.3 mg/kg in mice.
It has a favorable therapeutic index of 28.1 in mice.
Drug interactions
Levodopa
Remacemide delays the absorption of levodopa (300 mg of remacemide one hour before levodopa treatment delays mean time to peak levodopa plasma concentration by 20%) but not its total absorption (area-under-the-curve for levodopa plasma concentration was unchanged).
Sodium valproate
Remacemide does not interact with sodium valproate, a treatment for epilepsy.
Carbamazepine
Ramacemide does interact with carbamazepine. Remacemide inhibits the metabolism of carbamazepine, while carbamazepine induces the metabolism of remacemide and FPL 12495.
Alcohol
Remacemide salts
Remacemide is most commonly synthesized as the salt remacemide hydrochloride. However, there has been some investigation into other remacemide salts and their crystals, as different remacemide salts might taste more pleasant or have a solubility more suitable for a pediatric suspension formulation.
Mechanism of action
Remacemide binds weakly and noncompetitively to the ionic channel site of the NMDA receptor complex. Remacemide binds both allosterically and in the channel.
However, because remacemide binds so weakly to NMDAR, much of remacemide's in vivo effect against excitotoxicity is thought to be caused by its metabolic transformation to the more potent desglycine derivative FPL 12495. That is, remacemide may actually act as a prodrug to deliver the active metabolite FPL 12495 to the central nervous system.
Epilepsy
In a well validated and described genetic model of absence epilepsy, rats of the WAG/Rij strain, remacemide and its metabolite FPL 12495 were found to have a common for glutamate antagonist usual effect on the number of spike/wave dischargesEEG, the drugs decrease spike/wave discharges dose dependently. However, in contrast to most other glutamate antagonists, FPL 12495 increased the duration of the spike-wave discharges.
Pharmacokinetics
Blood–brain barrier
The brain uptake index (BUI), a measure of a drug's ability to pass the blood–brain barrier that involves the injection of radiolabeled test and reference substances into the common carotid artery of anesthetized animals, for remacemide is 51 ± 0.9 SD.
Enantiomers
The (-)stereoisomer of remacemide is of equal potency to the racemic mixture in preventing maximal electroshock seizures when administered orally to rats, while the (+)stereoisomer is less potent.
Metabolites
FPL 12495
Much of remacemide's effect in vivo is thought to be caused by the desglycine derivative FPL 12495 (±).
FPL 12495 (±) binds specifically and non-competitively to NMDAR. Its effect on maximal electroconvulsive shock is more potent than remacemide. The S isomer (FPL 12859) is even more potent than the racemic mixture, while the R isomer is less potent than the racemate.
FPL 12495 is sometimes referred to as ARL 12495AA.
Other metabolites
FPL 15053
FPL 15053 is the N- of remacemide, and exhibits modest binding to NMDAR and modest effects on convulsions and mortality in test mice and rats.
FPL 14331 and FPL 14465
FPL 14331 and FPL 14465 are the p- of remacemide, and they exhibit some efficacy against maximal electroconvulsive shock after i.p. and i.v. dosing.
FPL 15455
FPL 15455 is an oxoacetate metabolite of remacemide, but has no demonstrated biological activity.
FPL 14991 and FPL 14981
FPL 14991 and FPL 14981 are both β- of remacemide, and they display modest efficacy against maximal electroconvulsive shock in mice. However FPL 14981 and not FPL 14991 prevents NMDLA-induced convulsions and mortality in mice.
FPL 13592 and FPL 15112
The hydroxy-methyl derivative of remacemide (FPL 13592) and its (FPL 15112) prevents electric shock-induced convulsions only after i.v. administration; only the desglycine derivative binds to NMDAR.
FPL 14467
FPL 14467 (p-) is inactive in vivo and weak in binding NMDAR.
Pharmacodynamics
The values for 50% displacement of were 68 μM for remacemide and 0.48 μM for FPL 12495AA.
History
Current status
Remacemide is an experimental drug most recently being developed by the British multinational pharmaceutical company AstraZeneca. However, there has been little news of its progress since 2000. A few sources indicate that its development has been discontinued.
Changing hands
Remacemide was one of the last drugs under development by the now-defunct English pharmaceutical company Fisons. In 1995, it was acquired along with most of Fisons' research and development operations by the Swedish pharmaceutical company Astra, which in 1999 merged with the British company Zeneca to form AstraZeneca. In 2000, AstraZeneca considered possibly licensing out remacemide to some other pharmaceutical company, but there has been little news about remacemide since then. Remacemide's development may have been discontinued in July 2001.
Discovery and development under Fisons
In 1990, researchers at Fisons found that remacemide acted as an anticonvulsant in mice and rats
. Because of remacemide's potential as a neuroprotective agent through preventing glutamate toxicity, it was soon also under investigation as a treatment for Huntington's disease and Parkinson's disease.
Astra
By 1995, when Astra acquired remacemide, it was already in Phase IIb clinical development as an anti-epileptic drug and Phase I clinical development as a treatment for Huntington's
.
AstraZeneca
By 1998, when Astra announced its merger with Zeneca, remacemide had progressed to Phase III trials for epilepsy and Phase II trials for Parkinson's disease, and Astra was also investigating its potential for treating neuropathic pain
In 1999, after the merger, AstraZeneca reported that they were investigating remacemide for its neuroprotective effects, and that they planned regulatory submissions for Huntington's disease in 2001 and for Parkinson's disease and epilepsy in 2003.
Remacemide, under the trade name Ecovia, was designated an orphan drug for the treatment of Huntington's disease by the FDA in March 2000.
Remacemide was last mentioned in AstraZeneca's reports on its R&D pipeline in 2000, when it was in Phase III clinical trials for remacemide in the treatment of Huntington's disease and Phase II for treatment of Parkinson's disease. At that time, the submission of the New Drug Application (NDA) to the FDA and the Marketing Authorization Application to the CHMP was projected for Huntington's in 2001 and for Parkinson's after 2003, but there has been no news of such submission. In this report, it was also noted that remacemide was "under strategic review and a potential candidate for licensing activity" (see this external article about drug licensing.)
Current news
There are no clinical trials of remacemide in progress, according to the Huntington Study Group, and the Parkinson Study Group.
Availability
Remacemide is an experimental drug not available to the public and not currently undergoing clinical trials.
See also
AD-1211
Diphenidine
Ephenidine
Lanicemine
Lefetamine
Methoxphenidine (MXP)
MT-45
References
External links
Huntington's Outreach Project for Education, at Stanford
Acetamides
Amino acid derivatives
Dissociative drugs
NMDA receptor antagonists
Diarylethylamines
Sodium channel blockers
|
Margareta Hansdotter, also called Säbråzynthia (1594–1657), was a Swedish vicar's wife famous in history by the name Stormor i Dalom (The Great Mother of Dalom). She was given the name Stormor i Dalom during her own lifetime because of her good heart and charitable nature toward the poor, as well as for her many children.
Life
Stormor i Dalom was born to Johannes Laurentii, vicar of Säbrå parish in Ångermanland, and thereby the cousin of the mathematician Andreas Bureus and the sister of bishop Jacobus Johannis Zebrozynthius.
In 1610, she married Elof Terserus (1554-1617), vicar of Leksand, and in 1618, she married the successor of her late spouse, Uno Troilus (1586-1654), through Widow Conservation.
Stormor was known and loved for her great kindness: upon her death, a farmer alongside the road famously said: "Should I not cry, when the Great Mother in Dalom is dead?", a tribute to her favorable reputation of motherly goodness, which was mentioned in the sermon of her funeral.
Legacy
She is known as the matriarch of a large number of Swedish families: Arborelius, Floderus, Geijer, Holmgren, Key, Munktell, Staaff, Stridsberg, Troilius, von Troil and Trygger.
During the age of the eugenics of the 1930s, she was given as an example for the eugenic belief that virtue and success could be inherited.
References
Munktell: Västerås Stifts Herdaminne
Lilla Focus. Focus Uppslagsböcker AB, Stockholm. Lund, 1979 [Lilla Focus Encyclopedia]
1594 births
17th-century Swedish people
1657 deaths
People from the Swedish Empire
|
Suomi-marssi ( 'Finland March') is a Finnish military march composed in 1837 by Vääpeli Erik Wilhelm Eriksson of Kaartin Soittokunta. The march is also known as Marsch aus Petersburg or Petersburger Marsch. The Finnish Guard Jaeger Regiment uses it as a parade march.
History
The march was first played in 1837 when the Finnish Guards' Rifle Battalion was practicing with the Russian Imperial Guard in Krasnoye Selo. Nicholas I gifted the march to Frederick William III of Prussia. The march was included in the official list of marches of the Prussian Army with the name "Marsch aus Petersburg". The march is still used by the Bundeswehr and by the Finnish Armed Forces.
References
Finnish military marches
1837 compositions
|
```javascript
import { CodedError, Platform } from 'expo-modules-core';
import { KeepAwakeEventState } from './KeepAwake.types';
const wakeLockMap = {};
/** Wraps the webWakeLock API path_to_url */
export default {
async isAvailableAsync() {
if (Platform.isDOMAvailable) {
return 'wakeLock' in navigator;
}
return false;
},
async activate(tag) {
if (!Platform.isDOMAvailable) {
return;
}
const wakeLock = await navigator.wakeLock.request('screen');
wakeLockMap[tag] = wakeLock;
},
async deactivate(tag) {
if (!Platform.isDOMAvailable) {
return;
}
if (wakeLockMap[tag]) {
wakeLockMap[tag].release?.();
delete wakeLockMap[tag];
}
else {
throw new CodedError('ERR_KEEP_AWAKE_TAG_INVALID', `The wake lock with tag ${tag} has not activated yet`);
}
},
addListenerForTag(tag, listener) {
const eventListener = () => {
listener({ state: KeepAwakeEventState.RELEASE });
};
const sentinel = wakeLockMap[tag];
if (sentinel) {
if ('addEventListener' in sentinel) {
sentinel.addEventListener?.('release', eventListener);
}
else {
sentinel.onrelease = eventListener;
}
}
return {
remove: () => {
const sentinel = wakeLockMap[tag];
if (sentinel) {
if (sentinel.removeEventListener) {
sentinel.removeEventListener('release', eventListener);
}
else {
sentinel.onrelease = null;
}
}
},
};
},
};
//# sourceMappingURL=ExpoKeepAwake.web.js.map
```
|
```shell
#!/bin/bash
set -ex
CHPC_CHECK_START_TIMESTAMP="$(date +%s)"
export CHPC_CHECK_START_TIMESTAMP
S3_URL=${S3_URL:="path_to_url"}
BUILD_NAME=${BUILD_NAME:-package_release}
export S3_URL BUILD_NAME
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
# Sometimes AWS responds with DNS error and it's impossible to retry it with
# current curl version options.
function curl_with_retry
{
for _ in 1 2 3 4 5 6 7 8 9 10; do
if curl --fail --head "$1"
then
return 0
else
sleep 1
fi
done
return 1
}
# Use the packaged repository to find the revision we will compare to.
function find_reference_sha
{
git -C right/ch log -1 origin/master
git -C right/ch log -1 pr
# Go back from the revision to be tested, trying to find the closest published
# testing release. The PR branch may be either pull/*/head which is the
# author's branch, or pull/*/merge, which is head merged with some master
# automatically by Github. We will use a merge base with master as a reference
# for tesing (or some older commit). A caveat is that if we're testing the
# master, the merge base is the tested commit itself, so we have to step back
# once.
start_ref=$(git -C right/ch merge-base origin/master pr)
if [ "$PR_TO_TEST" == "0" ]
then
start_ref=$start_ref~
fi
# Loop back to find a commit that actually has a published perf test package.
while :
do
# FIXME the original idea was to compare to a closest testing tag, which
# is a version that is verified to work correctly. However, we're having
# some test stability issues now, and the testing release can't roll out
# for more that a weak already because of that. Temporarily switch to
# using just closest master, so that we can go on.
#ref_tag=$(git -C ch describe --match='v*-testing' --abbrev=0 --first-parent "$start_ref")
ref_tag="$start_ref"
echo Reference tag is "$ref_tag"
# We use annotated tags which have their own shas, so we have to further
# dereference the tag to get the commit it points to, hence the '~0' thing.
REF_SHA=$(git -C right/ch rev-parse "$ref_tag~0")
# FIXME sometimes we have testing tags on commits without published builds.
# Normally these are documentation commits. Loop to skip them.
# Historically there were various path for the performance test package,
# test all of them.
unset found
declare -a urls_to_try=(
"$S3_URL/PRs/0/$REF_SHA/$BUILD_NAME/performance.tar.zst"
"$S3_URL/0/$REF_SHA/$BUILD_NAME/performance.tar.zst"
"$S3_URL/0/$REF_SHA/$BUILD_NAME/performance.tgz"
)
for path in "${urls_to_try[@]}"
do
if curl_with_retry "$path"
then
found="$path"
break
fi
done
if [ -n "$found" ] ; then break; fi
start_ref="$REF_SHA~"
done
REF_PR=0
}
chown nobody workspace output
chgrp nogroup workspace output
chmod 777 workspace output
cd workspace
[ ! -e "/artifacts/performance.tar.zst" ] && echo "ERROR: performance.tar.zst not found" && exit 1
mkdir -p right
tar -xf "/artifacts/performance.tar.zst" -C right --no-same-owner --strip-components=1 --zstd --extract --verbose
# Find reference revision if not specified explicitly
if [ "$REF_SHA" == "" ]; then find_reference_sha; fi
if [ "$REF_SHA" == "" ]; then echo Reference SHA is not specified ; exit 1 ; fi
if [ "$REF_PR" == "" ]; then echo Reference PR is not specified ; exit 1 ; fi
# Show what we're testing
(
git -C right/ch log -1 --decorate "$REF_SHA" ||:
) | tee left-commit.txt
(
git -C right/ch log -1 --decorate "$SHA_TO_TEST" ||:
echo
echo Real tested commit is:
git -C right/ch log -1 --decorate "pr"
) | tee right-commit.txt
if [ "$PR_TO_TEST" != "0" ]
then
# If the PR only changes the tests and nothing else, prepare a list of these
# tests for use by compare.sh. Compare to merge base, because master might be
# far in the future and have unrelated test changes.
base=$(git -C right/ch merge-base pr origin/master)
git -C right/ch diff --name-only "$base" pr -- . | tee all-changed-files.txt
git -C right/ch diff --name-only --diff-filter=d "$base" pr -- tests/performance/*.xml | tee changed-test-definitions.txt
git -C right/ch diff --name-only "$base" pr -- :!tests/performance/*.xml :!docker/test/performance-comparison | tee other-changed-files.txt
fi
# Set python output encoding so that we can print queries with non-ASCII letters.
export PYTHONIOENCODING=utf-8
# By default, use the main comparison script from the tested package, so that we
# can change it in PRs.
script_path="right/scripts"
if [ -v CHPC_LOCAL_SCRIPT ]
then
script_path=".."
fi
# Even if we have some errors, try our best to save the logs.
set +e
# Use clickhouse-client and clickhouse-local from the right server.
PATH="$(readlink -f right/)":"$PATH"
export PATH
export REF_PR
export REF_SHA
# Try to collect some core dumps.
# At least we remove the ulimit and then try to pack some common file names into output.
ulimit -c unlimited
cat /proc/sys/kernel/core_pattern
# Start the main comparison script.
{
time $SCRIPT_DIR/download.sh "$REF_PR" "$REF_SHA" "$PR_TO_TEST" "$SHA_TO_TEST" && \
time stage=configure "$script_path"/compare.sh ; \
} 2>&1 | ts "$(printf '%%Y-%%m-%%d %%H:%%M:%%S\t')" | tee compare.log
# Stop the servers to free memory. Normally they are restarted before getting
# the profile info, so they shouldn't use much, but if the comparison script
# fails in the middle, this might not be the case.
for _ in {1..30}
do
killall clickhouse || break
sleep 1
done
dmesg -T > dmesg.log
ls -lath
7z a '-x!*/tmp' /output/output.7z ./*.{log,tsv,html,txt,rep,svg,columns} \
{right,left}/{performance,scripts} {{right,left}/db,db0}/preprocessed_configs \
report analyze benchmark metrics \
./*.core.dmp ./*.core
# If the files aren't same, copy it
cmp --silent compare.log /output/compare.log || \
cp compare.log /output
```
|
The Morice Line was a defensive line that went into effect in September 1957 during the Algerian War. It was constructed by the French to prevent the rebel guerrillas of the Algerian National Liberation Front from entering Algeria, then a French colony, from two neighboring countries, Tunisia and Morocco. It was named after then French Minister of Defence André Morice.
Design
The center of the Morice Line was a 2.5 m high electric fence that ran its entire length. This electric fence carried 5,000 volts and also had barbed wire entanglement on one side. On each side of the fence was a minefield that extended 45 meters to each side. On the Algerian side there was also a patrolled track.
The Morice Line was 460 km long along the border with Tunisia and 700 km long along the border with Morocco, and was built with then state-of-the-art electronic systems and a mined barrage. These alarms, radars and searchlights, and the use of anti-personnel landmines helped to coordinate a response from the forces assigned to the line. These forces combined with the previous electronic systems made the line almost impenetrable.
Importance of the Line
The Morice Line had a significant impact of the reduction of guerrillas activities by forces that originated from Tunisia. Though the Morice Line was not a "fortification" in the traditional sense of the word, it was nonetheless effective in reducing FLN activity during the Algerian War.
Anti-personnel landmines
Following the end of the war in 1962, extensive efforts were made by the new Algerian authorities to clear and dismantle the Morice Line. They included the forced employment of captured harkis and other Muslim loyalists who had served with the French Army, many of whom were killed by landmines. Decades after the confrontation came to an end, the Morice Line, which had been heavily mined by the French, continued to cause casualties among local Algerian populations. Algeria eventually joined the Ottawa Treaty, which bans the use of landmines, and in 2017, Algeria announced that after decades of work, it had fulfilled its mine clearance obligation under the treaty. It announced the clearing of the last 93 mined or suspected mined areas, including 78 former mine barrages in the Morice Line.
References
The History of Fortification Chicago: St. Martin's Press 1981
Notes
Algerian War
Algeria–Morocco border
Algeria–Tunisia border
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.