Normalize :: syntax (#5048)
* normalize :: syntax * fixes from code review
This commit is contained in:
parent
7dbdca8c54
commit
41185ca7ac
|
@ -603,6 +603,11 @@
|
|||
function() {
|
||||
return new Access(new PropertyName('prototype'));
|
||||
}),
|
||||
o('?::',
|
||||
function() {
|
||||
return new Access(new PropertyName('prototype'),
|
||||
'soak');
|
||||
}),
|
||||
o('Index')
|
||||
],
|
||||
// Indexing into an object or array using bracket notation.
|
||||
|
|
|
@ -1634,7 +1634,7 @@
|
|||
// Other regexes.
|
||||
HERECOMMENT_ILLEGAL = /\*\//;
|
||||
|
||||
LINE_CONTINUER = /^\s*(?:,|\??\.(?![.\d])|::)/;
|
||||
LINE_CONTINUER = /^\s*(?:,|\??\.(?![.\d])|\??::)/;
|
||||
|
||||
STRING_INVALID_ESCAPE = /((?:^|[^\\])(?:\\\\)*)\\(?:(0[0-7]|[1-7])|(x(?![\da-fA-F]{2}).{0,2})|(u\{(?![\da-fA-F]{1,}\})[^}]*\}?)|(u(?!\{|[\da-fA-F]{4}).{0,4}))/; // Make sure the escape isn’t escaped.
|
||||
// octal escape
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -371,6 +371,7 @@ grammar =
|
|||
o ':: Property', -> [LOC(1)(new Access new PropertyName('prototype')), LOC(2)(new Access $2)]
|
||||
o '?:: Property', -> [LOC(1)(new Access new PropertyName('prototype'), 'soak'), LOC(2)(new Access $2)]
|
||||
o '::', -> new Access new PropertyName 'prototype'
|
||||
o '?::', -> new Access new PropertyName('prototype'), 'soak'
|
||||
o 'Index'
|
||||
]
|
||||
|
||||
|
|
|
@ -1293,7 +1293,7 @@ POSSIBLY_DIVISION = /// ^ /=?\s ///
|
|||
# Other regexes.
|
||||
HERECOMMENT_ILLEGAL = /\*\//
|
||||
|
||||
LINE_CONTINUER = /// ^ \s* (?: , | \??\.(?![.\d]) | :: ) ///
|
||||
LINE_CONTINUER = /// ^ \s* (?: , | \??\.(?![.\d]) | \??:: ) ///
|
||||
|
||||
STRING_INVALID_ESCAPE = ///
|
||||
( (?:^|[^\\]) (?:\\\\)* ) # Make sure the escape isn’t escaped.
|
||||
|
|
|
@ -70,6 +70,12 @@ test "`?.` and `::` should continue lines", ->
|
|||
::
|
||||
?.foo
|
||||
)
|
||||
|
||||
ok not (
|
||||
Date
|
||||
?::
|
||||
?.foo
|
||||
)
|
||||
#eq Object::toString, Date?.
|
||||
#prototype
|
||||
#::
|
||||
|
|
|
@ -303,7 +303,16 @@ test "#2567: Optimization of negated existential produces correct result", ->
|
|||
|
||||
test "#2508: Existential access of the prototype", ->
|
||||
eq NonExistent?::nothing, undefined
|
||||
eq(
|
||||
NonExistent
|
||||
?::nothing
|
||||
undefined
|
||||
)
|
||||
ok Object?::toString
|
||||
ok(
|
||||
Object
|
||||
?::toString
|
||||
)
|
||||
|
||||
test "floor division operator", ->
|
||||
eq 2, 7 // 3
|
||||
|
|
Loading…
Reference in New Issue