v8/src
Sathya Gunasekaran e101b9c03c [parser] Improve error when using import decl in a script
Perform a best-effort check for module context and provide an
appropriate error.

As seen from the import-blah-script.js test, we could have invalid
import expressions in a script context that could result in an error
saying "Cannot use import statement outside a module" which isn't
the ideal error because the error is an incorrect import
expression.

But, when the developer changes to a module context, the
correct error is thrown.

To fix this, we'd have to refactor and call ParseImportDeclaration,
and then throw an appropriate error, which seems like a lot of
overhead for not enough gain.

Bug: v8:9392, v8:6513
Change-Id: I520ebb490fff4d95743a7c751d4095db9a35d41b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1675948
Reviewed-by: Mythri Alle <mythria@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62358}
2019-06-25 12:33:11 +00:00
..
api [api] Remove deprecated Object::Get/Set methods 2019-06-24 17:36:01 +00:00
asmjs [asm.js] Check that function table indices are intish. 2019-06-17 16:59:50 +00:00
ast [interpreter] Fix order of bytecode generated for adding getters/setters 2019-06-20 18:41:42 +00:00
base [base] Move v8memory.h to base/memory.h 2019-06-21 11:44:18 +00:00
builtins [objects] Rename JSValue to JSPrimitiveWrapper 2019-06-24 13:54:38 +00:00
codegen [objects] initialize SmallOrderedHashTable padding 2019-06-25 10:27:49 +00:00
common [base] Move v8memory.h to base/memory.h 2019-06-21 11:44:18 +00:00
compiler Reland "[csa] add hint to CAST error message to break in mksnapshot" 2019-06-25 11:11:01 +00:00
compiler-dispatcher Add OWNERS files for src and test 2019-05-30 04:51:21 +00:00
d8 Fix character ranges in case insensitive regexp 2019-06-07 00:09:17 +00:00
date Add OWNERS files for src and test 2019-05-30 04:51:21 +00:00
debug [SFI] Always store function_literal_id in SFI. 2019-06-21 16:23:27 +00:00
deoptimizer [builtins] Make ContinueToBuiltinHelper skip off-heap builtin trampolines 2019-06-14 11:24:58 +00:00
diagnostics [objects] Rename JSValue to JSPrimitiveWrapper 2019-06-24 13:54:38 +00:00
execution [parser] Improve error when using import decl in a script 2019-06-25 12:33:11 +00:00
extensions [cleanup][heap] Improve heap iterator naming 2019-06-17 14:38:02 +00:00
flags Revert "Temporarily disable frozen/sealed elements kinds" 2019-06-25 10:54:31 +00:00
handles [ptr-compr] Remove i::GetIsolateFromWritableObject(HeapObject, Isolate*) 2019-06-19 15:22:11 +00:00
heap [heap] Fix uninitialized value in GCTracer 2019-06-24 16:34:51 +00:00
ic [objects] Rename JSValue to JSPrimitiveWrapper 2019-06-24 13:54:38 +00:00
init Remove always-true --harmony-object-from-entries runtime flag 2019-06-24 15:01:01 +00:00
inspector [inspector] Add fromUTF16LE function to string-16 2019-06-24 16:26:01 +00:00
interpreter [base] Move v8memory.h to base/memory.h 2019-06-21 11:44:18 +00:00
json [objects] Rename JSValue to JSPrimitiveWrapper 2019-06-24 13:54:38 +00:00
libplatform [tracing] Add a way to test perfetto traces. 2019-05-27 14:28:36 +00:00
libsampler Add OWNERS files for src and test 2019-05-30 04:51:21 +00:00
logging [cleanup][heap] Improve heap iterator naming 2019-06-17 14:38:02 +00:00
numbers Add OWNERS files for src and test 2019-05-30 04:51:21 +00:00
objects [objects] initialize SmallOrderedHashTable padding 2019-06-25 10:27:49 +00:00
parsing [parser] Improve error when using import decl in a script 2019-06-25 12:33:11 +00:00
profiler [base] Move v8memory.h to base/memory.h 2019-06-21 11:44:18 +00:00
protobuf Add OWNERS to src/protobuf 2019-05-15 11:17:23 +00:00
regexp [regexp] Refactor OutSet and BoyerMoorePositionInfo 2019-06-19 09:57:52 +00:00
roots [modules] Introduce SourceTextModule class 2019-06-19 17:54:52 +00:00
runtime [objects] Rename JSValue to JSPrimitiveWrapper 2019-06-24 13:54:38 +00:00
sanitizer Move remaining files in src/ 2019-05-24 18:24:36 +00:00
snapshot [base] Move v8memory.h to base/memory.h 2019-06-21 11:44:18 +00:00
strings [objects] Rename JSValue to JSPrimitiveWrapper 2019-06-24 13:54:38 +00:00
tasks Add OWNERS files for src and test 2019-05-30 04:51:21 +00:00
third_party Add missing owners files 2019-05-31 07:21:01 +00:00
torque [torque] Support 'real' internal classes 2019-06-21 16:09:28 +00:00
tracing Add OWNERS files for src and test 2019-05-30 04:51:21 +00:00
trap-handler Remove 'set noparent' from OWNERS files where reasonable 2019-06-03 10:18:22 +00:00
utils [utils,diagnostics] Remove SplayTree and its last use 2019-06-19 09:48:02 +00:00
wasm [wasm][anyref] Implement correct type checking for br_table 2019-06-25 12:00:21 +00:00
zone [regexp] Remove unused DispatchTable and ZoneSplayTree 2019-06-19 07:19:38 +00:00
DEPS [regexp] Further narrow public API and restrict includes to regexp.h 2019-06-18 12:23:16 +00:00
OWNERS Make nested DEPS files commonly owned 2019-06-18 14:31:05 +00:00