Commit Graph

284 Commits

Author SHA1 Message Date
Josh Goldberg
a211184347 Clarified error message; extended error to identifier end
Lengthening the reported error length to include all of the identifier necessitates scanning for all of the identifier. I also reset the `pos` after so other identifier scanning still happens.
2018-12-06 11:17:06 -08:00
Josh Goldberg
51d10ee4a0 Removed excess new check 2018-12-04 18:29:58 -08:00
Josh Goldberg
174816fc26 Added error for IdentifierStart immediately after a NumericLiteral
Fixes #4702.
2018-12-04 17:59:20 -08:00
Wesley Wigham
cd08a22ef5 Clamp calculated sourcemap positions rather than throwing (#28583)
* Clamp calculated sourcemap positions rather than throwing, to allow the underlying file to drift out of date with the sourcemap without a crash

* Clamp line as well
2018-11-16 16:05:07 -08:00
Caleb Sander
28e9ec497c Address review comments 2018-11-05 11:36:32 -08:00
Caleb Sander
188c07865a Scan bigint literals 2018-11-05 11:36:31 -08:00
Andy
dd9b8cab34 Have scanJsDocToken scan keywords (#27162)
* Have scanJsDocToken scan keywords

* Update API
2018-10-08 14:42:51 -07:00
Ryan Cavanaugh
1e2fb9f0ae Merge pull request #26465 from rnathanday/master
include leading non-ASCII horizontal whitespace
2018-09-05 12:38:09 -07:00
Tim Schaub
262ea5b06e Skip asterisks after newline when parsing JSDoc types (#26528)
* Skip asterisks after newline when parsing JSDoc types

* Single boolean expression

* Test for parsing and printing multiline function signatures with *
2018-09-04 15:41:08 -07:00
Nathan Day
3ec2c45f5f include leading non-ASCII horizontal whitespace in SyntaxKind.WhitespaceTrivia token 2018-08-25 13:15:56 -04:00
Tim Schaub
6fd725f3ea Skip whitespace or asterisk in JSDoc param type and name (#26067) 2018-08-16 16:16:09 -07:00
Ryan Cavanaugh
066b191982 Collapse core/compiler/parser into parser 2018-06-11 17:07:58 -07:00
Ryan Cavanaugh
336c37662d Projzilla phase 1 2018-06-09 16:48:08 -07:00
Anders Hejlsberg
03f464f433 Add 'unknown' keyword to scanner/parser/emitter 2018-05-26 08:51:09 -07:00
Andy
5983c45e24 Fix typo: seperate -> separate (#24338)
* Fix typo: seperate -> separate

* update tests
2018-05-23 09:36:17 -07:00
Andy
e53e56cf82 Enable '--strictNullChecks' (#22088)
* Enable '--strictNullChecks'

* Fix API baselines

* Make sys.getEnvironmentVariable non-nullable

* make properties optional instead of using `| undefined` in thier type

* reportDiagnostics should be required

* Declare firstAccessor as non-nullable

* Make `some` a type guard

* Fix `getEnvironmentVariable` definition in tests

* Pretend transformFlags are always defined

* Fix one more use of sys.getEnvironmentVariable

* `requiredResponse` accepts undefined, remove assertions

* Mark optional properties as optional instead of using `| undefined`

* Mark optional properties as optional instead of using ` | undefined`

* Remove unnecessary null assertions

* Put the bang on the declaration instead of every use

* Make `createMapFromTemplate` require a parameter

* Mark `EmitResult.emittedFiles` and `EmitResult.sourceMaps` as optional

* Plumb through undefined in emitLsit and EmitExpressionList

* `ElementAccessExpression.argumentExpression` can not be `undefined`

* Add overloads for `writeTokenText`

* Make `shouldWriteSeparatingLineTerminator` argument non-nullable

* Make `synthesizedNodeStartsOnNewLine` argument required

* `PropertyAssignment.initializer` cannot be undefined

* Use one `!` at declaration site instead of on every use site

* Capture host in a constant and avoid null assertions

* Remove few more unused assertions

* Update baselines

* Use parameter defaults

* Update baselines

* Fix lint

* Make Symbol#valueDeclaration and Symbol#declarations non-optional to reduce assertions

* Make Node#symbol and Type#symbol non-optional to reduce assertions

* Make `flags` non-nullable to reduce assertions

* Convert some asserts to type guards

* Make `isNonLocalAlias` a type guard

* Add overload for `getSymbolOfNode` for `Declaration`

* Some more `getSymbolOfNode` changes

* Push undefined suppression into `typeToTypeNodeHelper`

* `NodeBuilderContext.tracker` is never `undefined`

* use `Debug.assertDefined`

* Remove unnecessary tag

* Mark `LiteralType.freshType` and `LiteralTupe.regularType` as required
2018-05-22 14:46:57 -07:00
Wesley Wigham
d82d35c7f5 Set startPos at EOF in jsdoc token scanner so node end positions for nodes terminated at EoF are right (#24184)
* Set startPos at EOF in jsdoc token scanner to node end positions for nodes terminated at EoF are right

* More complete nonwhitespace token check, fix syntactica jsdoc classifier

* Use loop and no nested lookahead

* Do thigns unrelated to the bug in the test

* Fix typo move return

* Patch up typedef end pos

* Fix indentation, make end pos target more obvious
2018-05-17 15:16:18 -07:00
Ryan Cavanaugh
8294259ec2 Remove all reference comments from compiler/ 2018-04-11 15:38:26 -07:00
TravCav
3ce25593cd removed unused code 2018-04-05 10:29:35 -04:00
Wesley Wigham
6af764c560 Declaration maps and transparent goto definition using them (#22658)
* Add compiler option to enable declaration sourcemaps

* Transparent goto definition for sourcemapped declaration files

* Post-rebase touchups

* Rename API methods

* Fix lints

* Fix typo in name XD

* Log sourcemap decode errors

* Share the cache more, but also invalidate it more

* Remove todo

* Enable mapping on go to implementation as well

* Allow fourslash to test declaration maps mroe easily

* more test

* Handle sourceRoot

* Add tests documenting current behavior with other sourcemapping flags

* Ignore inline options for declaration file maps, simplify dispatch in emitter

* Change program diagnostic

* Fix nit

* Use charCodeAt

* Rename internal methods + veriables

* Avoid filter

* span -> position

* Use character codes

* Dont parse our sourcemap names until we need to start using them

* zero-index parsed positions

* Handle sourceMappingURL comments, including base64 encoded ones

* Unittest b64 decoder, make mroe robust to handle unicode properly

* Fix lint

* declarationMaps -> declarationMap

* Even more feedback

* USE Mroe lenient combined regexp

* only match base64 characters

* Fix nit
2018-03-26 12:15:34 -07:00
Nathan Shively-Sanders
ab8233c5d3 Two JSdoc parsing fixes (#22705)
* Correctly parse JSDoc type *=

* Allow `markdown` quoted param names in JSDoc

* Add tests and update baselines

* Get correct span for the type '*'

* Fix whitespace lint

* Add unbracketed type test
2018-03-20 09:23:08 -07:00
Andy
0c6ef348ce Simplify parseJsxChildren (#22511) 2018-03-13 12:28:21 -07:00
Anders Hejlsberg
7c241ba2f7 Merge branch 'conditionalTypes' into inferTypes
# Conflicts:
#	src/compiler/checker.ts
#	tests/cases/fourslash/completionInJSDocFunctionNew.ts
#	tests/cases/fourslash/completionInJSDocFunctionThis.ts
2018-01-30 13:40:16 -08:00
Anders Hejlsberg
d608941480 Implement type inference in conditional types 2018-01-25 12:25:00 -08:00
Andy
058e3ad75e Improve assertion in computePositionOfLineAndCharacter (#21361) 2018-01-25 07:36:38 -08:00
Klaus Meinhardt
7c7651d617 Add overloads for forEach{Leading,Trailing}CommentRange (#21190)
Avoids runtime errors when passing callback with state parameter but not passing a state.
2018-01-16 12:11:05 -08:00
Andy
a23bbe65e6 Use substring instead of substr (#20578)
* Use substring instead of substr

* Remove unused scanning of SyntaxKind.DotDotDotToken in jsdoc

* Remove other unnecessary jsdoc syntax kinds

* Move all pos++ together
2018-01-08 14:54:18 -08:00
Andy
6f2ba15446 Start linting for double spaces (#20820)
* Start linting for double spaces

* Code review

* Fix cases that were excluded by countDoubleSpaces

* Remove extraneous closing parenthesis
2018-01-08 08:52:13 -08:00
Yuichi Nukiyama
792b8bb78e Fix error messeage (#20601)
* Fix error messeage

* delete extra lint
2017-12-11 18:05:49 -05:00
Wesley Wigham
9e51882d9c Numeric separators (#20324)
* Add support into octal and binary literals

* Add hex support

* And finally support all numeric literals and fix spelling

* Update error message

* Refactor error in scanner to take a position

* Scan no separators in escape sequences, add escape sequence tests

* More decimal tests from the spec presentation examples

* Permissive scanning of excess separators

* Remove unnecessary assignment

* Make code easier to follow
2017-12-08 20:20:18 -05:00
Wesley Wigham
a1669bb431 handle multiline jsx strings correctly, emit escapes in jsx attributes correctly (#20309) 2017-11-29 17:08:51 -08:00
Wesley Wigham
a551c4cd64 Allow curly around @type jsdoc to be optional (#20074)
* Allow curly around `@type` jsdoc to be optional

* Incorporate restructuring from @andy-ms
2017-11-20 16:10:50 -08:00
Anders Hejlsberg
b6f96052d8 Merge pull request #19976 from Microsoft/optimizeParser
Optimize parsing
2017-11-16 10:19:10 -08:00
Ron Buckton
804c7d3690 Merge branch 'master' into dynamicNames 2017-11-13 13:24:20 -08:00
Anders Hejlsberg
3411318e6b Use TokenFlags.PrecedingJSDocComment to guide JSDoc comment processing 2017-11-13 09:51:56 -08:00
Anders Hejlsberg
ddf0df9cbb Introduce TokenFlags enum 2017-11-12 09:11:09 -08:00
Andy
65a191fa2b For import completion of default import, convert module name to identifier (#19875)
* For import completion of default import, convert module name to identifier

* Suggestions from code review
2017-11-09 13:13:23 -08:00
Ron Buckton
31c3d444f1 Merge branch 'master' into compareStrings 2017-11-03 23:01:51 -07:00
Ron Buckton
208dfa6b01 Merge branch 'master' into dynamicNames 2017-11-03 22:10:28 -07:00
Andy
fd41521421 Enable 'callable-types' tslint rule (#19654) 2017-11-02 17:16:09 -07:00
uniqueiniquity
3ebb2e8a34 Merge branch 'master' into jsxFragment 2017-10-31 10:53:57 -07:00
Ron Buckton
3cb15378d7 Improve performance of deduplication of sorted arrays 2017-10-26 17:51:09 -07:00
Ron Buckton
51929acb89 Merge branch 'master' into dynamicNames 2017-10-21 00:36:52 -07:00
Andy
c1b4d59752 Fixup line and offset of rename location of refactor (#19265)
* Fixup line and offset of rename location of refactor

* Fixes

* Handle "\r" only documents

* Update api baselines

* Fix error if an edit comes *after* the rename location

* Add bounds check

* Simpler implementation: get new text, then calculate line starts the usual way
2017-10-19 14:31:23 -07:00
uniqueiniquity
75665294a9 Respond to CR 2017-10-17 13:39:16 -07:00
uniqueiniquity
abb3f58db2 Add support for JSX fragment syntax 2017-10-17 09:38:09 -07:00
Ron Buckton
ee23f93275 Switch to 'unique symbol' 2017-10-04 19:34:29 -07:00
Andy
1a2de721b5 Fixes to @augments handling (#18775)
* Fixes to @augments handling

* Renames and diagnostic changes

* Add test for < > characters

* Use more specific return type
2017-09-28 12:34:54 -07:00
Wesley Wigham
6695255d86 Allow trailing newline to have fake position (#18298)
* Actually support baselining pretty in the harness

* Test case from 18216

* Use host newline in formatDiagnosticsWithColorAndContext

* Merge statements
2017-09-07 12:26:23 -07:00
Andy
e2141ad469 Mark some arrays as readonly (#17725)
* Mark some arrays as readonly

* Avoid unnecessary allocations and style changes

* Fix lint
2017-08-24 09:55:01 -07:00