Reviewers: adamk, rossberg,

Description:
Implement sloppy-mode block-defined functions (Annex B 3.3)

ES2015 specifies very particular semantics for functions defined in blocks.
In strict mode, it is simply a lexical binding scoped to that block. In sloppy
mode, in addition to that lexical binding, there is a var-style binding in
the outer scope, which is overwritten with the local binding when the function
declaration is evaluated, *as long as* introducing ths var binding would not
create a var/let conflict in the outer scope.

This patch implements the semantics by introducing a DelegateStatement, which
is initially filled in with the EmptyStatement and overwritten with the
assignment when the scope is closed out and it can be checked that there is
no conflict.

This patch is tested with a new mjsunit test, and I tried staging it and running
test262, finding that the tests that we have disabled due to lack of Annex B
support now pass.

R=adamk,rossberg
LOG=Y
BUG=v8:4285

Please review this at https://codereview.chromium.org/1332873003/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+372, -20 lines):
  M src/ast.h
  M src/ast-expression-visitor.cc
  M src/ast-literal-reindexer.cc
  M src/ast-numbering.cc
  M src/compiler/ast-graph-builder.cc
  M src/compiler/ast-loop-assignment-analyzer.cc
  M src/full-codegen/full-codegen.cc
  M src/hydrogen.cc
  M src/interpreter/bytecode-generator.cc
  M src/parser.h
  M src/parser.cc
  M src/pattern-rewriter.cc
  M src/prettyprinter.cc
  M src/rewriter.cc
  M src/scopes.h
  M src/scopes.cc
  M src/typing.cc
  M src/typing-asm.cc
  M test/mjsunit/harmony/block-let-semantics-sloppy.js
  A test/mjsunit/harmony/block-sloppy-function.js


--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to