Skip to content

Commit

Permalink
Merge pull request #4 from tc39/add-template-and-spec
Browse files Browse the repository at this point in the history
Add template and spec
  • Loading branch information
gorosgobe authored Nov 8, 2023
2 parents 535af59 + 61b2dd4 commit c632c21
Show file tree
Hide file tree
Showing 7 changed files with 253 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Build spec

on: [pull_request, push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: ljharb/actions/node/install@main
name: 'nvm install lts/* && npm install'
with:
node-version: lts/*
- run: npm run build
23 changes: 23 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Deploy gh-pages

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: ljharb/actions/node/install@main
name: 'nvm install lts/* && npm install'
with:
node-version: lts/*
- run: npm run build
- uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: build
clean: true
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# Only apps should have lockfiles
yarn.lock
package-lock.json
npm-shrinkwrap.json
pnpm-lock.yaml

# Build directory
build
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 ECMA TC39 and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"private": true,
"name": "template-for-proposals",
"description": "A repository template for ECMAScript proposals.",
"scripts": {
"start": "npm run build-loose -- --watch",
"build": "npm run build-loose -- --strict",
"build-loose": "node -e 'fs.mkdirSync(\"build\", { recursive: true })' && ecmarkup --load-biblio @tc39/ecma262-biblio --verbose spec.emu build/index.html --lint-spec"
},
"homepage": "https://github.com/tc39/template-for-proposals#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/tc39/template-for-proposals.git"
},
"license": "MIT",
"devDependencies": {
"@tc39/ecma262-biblio": "2.1.2653",
"ecmarkup": "^18.0.0"
},
"engines": {
"node": ">= 12"
}
}
124 changes: 124 additions & 0 deletions spec.emu
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<!doctype html>
<meta charset="utf8">
<link rel="stylesheet" href="./spec.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/github.min.css">
<script src="./spec.js"></script>
<pre class="metadata">
title: Negated in and instanceof operators
stage: 1
contributors: Pablo Gorostiaga Belio
</pre>
<emu-clause id="sec-relational-operators">
<h1>Relational Operators</h1>
<emu-note>
<p>The result of evaluating a relational operator is always of type Boolean, reflecting whether the relationship named by the operator holds between its two operands.</p>
</emu-note>
<h2>Syntax</h2>
<emu-grammar type="definition">
RelationalExpression[In, Yield, Await] :
ShiftExpression[?Yield, ?Await]
RelationalExpression[?In, ?Yield, ?Await] `&lt;` ShiftExpression[?Yield, ?Await]
RelationalExpression[?In, ?Yield, ?Await] `&gt;` ShiftExpression[?Yield, ?Await]
RelationalExpression[?In, ?Yield, ?Await] `&lt;=` ShiftExpression[?Yield, ?Await]
RelationalExpression[?In, ?Yield, ?Await] `&gt;=` ShiftExpression[?Yield, ?Await]
RelationalExpression[?In, ?Yield, ?Await] `instanceof` ShiftExpression[?Yield, ?Await]
<ins>RelationalExpression[?In, ?Yield, ?Await] `!instanceof` ShiftExpression[?Yield, ?Await]</ins>
[+In] RelationalExpression[+In, ?Yield, ?Await] `in` ShiftExpression[?Yield, ?Await]
<ins>[+In] RelationalExpression[+In, ?Yield, ?Await] `!in` ShiftExpression[?Yield, ?Await]</ins>
[+In] PrivateIdentifier `in` ShiftExpression[?Yield, ?Await]
</emu-grammar>
<emu-note>
<p>The <sub>[In]</sub> grammar parameter is needed to avoid confusing the `in` operator in a relational expression with the `in` operator in a `for` statement.</p>
</emu-note>

<emu-clause id="sec-relational-operators-runtime-semantics-evaluation" type="sdo">
<h1>Runtime Semantics: Evaluation</h1>
<emu-grammar>RelationalExpression : RelationalExpression `&lt;` ShiftExpression</emu-grammar>
<emu-alg>
1. Let _lref_ be ? Evaluation of |RelationalExpression|.
1. Let _lval_ be ? GetValue(_lref_).
1. Let _rref_ be ? Evaluation of |ShiftExpression|.
1. Let _rval_ be ? GetValue(_rref_).
1. Let _r_ be ? IsLessThan(_lval_, _rval_, *true*).
1. If _r_ is *undefined*, return *false*. Otherwise, return _r_.
</emu-alg>
<emu-grammar>RelationalExpression : RelationalExpression `&gt;` ShiftExpression</emu-grammar>
<emu-alg>
1. Let _lref_ be ? Evaluation of |RelationalExpression|.
1. Let _lval_ be ? GetValue(_lref_).
1. Let _rref_ be ? Evaluation of |ShiftExpression|.
1. Let _rval_ be ? GetValue(_rref_).
1. Let _r_ be ? IsLessThan(_rval_, _lval_, *false*).
1. If _r_ is *undefined*, return *false*. Otherwise, return _r_.
</emu-alg>
<emu-grammar>RelationalExpression : RelationalExpression `&lt;=` ShiftExpression</emu-grammar>
<emu-alg>
1. Let _lref_ be ? Evaluation of |RelationalExpression|.
1. Let _lval_ be ? GetValue(_lref_).
1. Let _rref_ be ? Evaluation of |ShiftExpression|.
1. Let _rval_ be ? GetValue(_rref_).
1. Let _r_ be ? IsLessThan(_rval_, _lval_, *false*).
1. If _r_ is either *true* or *undefined*, return *false*. Otherwise, return *true*.
</emu-alg>
<emu-grammar>RelationalExpression : RelationalExpression `&gt;=` ShiftExpression</emu-grammar>
<emu-alg>
1. Let _lref_ be ? Evaluation of |RelationalExpression|.
1. Let _lval_ be ? GetValue(_lref_).
1. Let _rref_ be ? Evaluation of |ShiftExpression|.
1. Let _rval_ be ? GetValue(_rref_).
1. Let _r_ be ? IsLessThan(_lval_, _rval_, *true*).
1. If _r_ is either *true* or *undefined*, return *false*. Otherwise, return *true*.
</emu-alg>
<emu-grammar>RelationalExpression : RelationalExpression `instanceof` ShiftExpression</emu-grammar>
<emu-alg>
1. Let _lref_ be ? Evaluation of |RelationalExpression|.
1. Let _lval_ be ? GetValue(_lref_).
1. Let _rref_ be ? Evaluation of |ShiftExpression|.
1. Let _rval_ be ? GetValue(_rref_).
1. Return ? InstanceofOperator(_lval_, _rval_).
</emu-alg>
<ins class="block">
<emu-grammar>RelationalExpression : RelationalExpression `!instanceof` ShiftExpression</emu-grammar>
<emu-alg>
1. Let _lref_ be ? Evaluation of |RelationalExpression|.
1. Let _lval_ be ? GetValue(_lref_).
1. Let _rref_ be ? Evaluation of |ShiftExpression|.
1. Let _rval_ be ? GetValue(_rref_).
1. Let _r_ be ? InstanceofOperator(_lval_, _rval_).
1. If _r_ is *true*, return *false*. Otherwise, return *true*.
</emu-alg>
</ins>
<emu-grammar>RelationalExpression : RelationalExpression `in` ShiftExpression</emu-grammar>
<emu-alg>
1. Let _lref_ be ? Evaluation of |RelationalExpression|.
1. Let _lval_ be ? GetValue(_lref_).
1. Let _rref_ be ? Evaluation of |ShiftExpression|.
1. Let _rval_ be ? GetValue(_rref_).
1. If _rval_ is not an Object, throw a *TypeError* exception.
1. Return ? HasProperty(_rval_, ? ToPropertyKey(_lval_)).
</emu-alg>
<ins class="block">
<emu-grammar>RelationalExpression : RelationalExpression `!in` ShiftExpression</emu-grammar>
<emu-alg>
1. Let _lref_ be ? Evaluation of |RelationalExpression|.
1. Let _lval_ be ? GetValue(_lref_).
1. Let _rref_ be ? Evaluation of |ShiftExpression|.
1. Let _rval_ be ? GetValue(_rref_).
1. If _rval_ is not an Object, throw a *TypeError* exception.
1. Let _r_ be ? HasProperty(_rval_, ? ToPropertyKey(_lval_)).
1. If _r_ is *true*, return *false*. Otherwise, return *true*.
</emu-alg>
</ins>
<emu-grammar>RelationalExpression : PrivateIdentifier `in` ShiftExpression</emu-grammar>
<emu-alg>
1. Let _privateIdentifier_ be the StringValue of |PrivateIdentifier|.
1. Let _rref_ be ? Evaluation of |ShiftExpression|.
1. Let _rval_ be ? GetValue(_rref_).
1. If _rval_ is not an Object, throw a *TypeError* exception.
1. Let _privateEnv_ be the running execution context's PrivateEnvironment.
1. Let _privateName_ be ResolvePrivateIdentifier(_privateEnv_, _privateIdentifier_).
1. If PrivateElementFind(_rval_, _privateName_) is not ~empty~, return *true*.
1. Return *false*.
</emu-alg>
</emu-clause>
</emu-clause>

0 comments on commit c632c21

Please sign in to comment.