Commit Graph

545 Commits

Author SHA1 Message Date
Cyrus Najmabadi
e32d030144 Update the source file positions as well. 2014-12-12 02:38:07 -08:00
Cyrus Najmabadi
9c0e4211bc Properly adjust nodes while walking down the tree. 2014-12-12 02:34:53 -08:00
Cyrus Najmabadi
2f833d5f97 Provide a way for tests to try out incremental parsing. 2014-12-12 02:21:45 -08:00
Cyrus Najmabadi
7eb0f42560 Add assert. 2014-12-12 00:48:08 -08:00
Cyrus Najmabadi
15f3b89297 Add the syntax cursor. We will use this to retrieve nodes from the previous source tree. 2014-12-12 00:41:12 -08:00
Cyrus Najmabadi
14cb05f443 Add explanatory comments to explain how node moving works. 2014-12-11 23:39:44 -08:00
Cyrus Najmabadi
c9f8aaecb6 Don't incrementally parse when teh old tree had no source module elements.
Also, provide explanatory comments as to why we pass setNodeParents:true.
2014-12-11 22:16:06 -08:00
Cyrus Najmabadi
400cf91e96 Nodes are not resuable if the parser has a outstanding, unattached, parse error.
This is conservative, but safe.   If we wanted to support node reuse here,
we'd have to carefully ensure that the errors and tree shape would be the
same that hte normal parse would produce.
2014-12-11 18:23:14 -08:00
Cyrus Najmabadi
0391e02fee Merge branch 'master' into sourceFileUpdate
Conflicts:
	src/compiler/parser.ts
	src/services/formatting/tokenSpan.ts
	src/services/text.ts
2014-12-11 18:08:57 -08:00
Jason Freeman
7f097140c9 Merge branch 'release-1.4' 2014-12-11 17:29:03 -08:00
Jason Freeman
06d7ef14cf Don't quote the word 'generators' in error messages 2014-12-11 17:22:22 -08:00
Jason Freeman
d385f2ebf4 Disable computed properties in TypeScript 1.4 2014-12-11 16:49:53 -08:00
Cyrus Najmabadi
fbeb7dd75e Merge branch 'funcDeclsInBlocks' into sourceFileUpdate
Conflicts:
	src/services/outliningElementsCollector.ts
2014-12-11 15:16:46 -08:00
Daniel Rosenwasser
d92d6379bd Merge branch 'release-1.4' into mergeFor1.4ToMaster
Conflicts:
	src/compiler/parser.ts
	src/compiler/utilities.ts
	src/harness/harness.ts
	tests/baselines/reference/APISample_node_compile.js
	tests/baselines/reference/APISample_node_compile.types
	tests/baselines/reference/APISample_standalone_compile.js
	tests/baselines/reference/APISample_standalone_compile.types
	tests/cases/compiler/APISample_node_compile.ts
	tests/cases/compiler/APISample_standalone_compile.ts
2014-12-11 14:49:43 -08:00
Cyrus Najmabadi
b692ea9b66 Remove TryBlock and FinallyBlock.
They break the rule that syntactically identical constructs use the same syntax kind.  This
prevents node reuse in incremental parsing.
2014-12-11 14:40:25 -08:00
Daniel Rosenwasser
987dd0cede Fixed 'use strict' check. 2014-12-11 14:21:39 -08:00
Daniel Rosenwasser
94cce178dd Responded to CR feedback.
Conflicts:
	src/compiler/parser.ts
2014-12-11 14:21:18 -08:00
Daniel Rosenwasser
036209a89e Moved createCompilerHost into parser.ts
Conflicts:
	src/compiler/tsc.ts
2014-12-11 14:11:01 -08:00
Daniel Rosenwasser
0ce3861602 Moved non-exposed functions to utilities; fix up emitted .d.ts in Jakefile.
Conflicts:
	src/compiler/parser.ts
2014-12-11 14:00:36 -08:00
Cyrus Najmabadi
12f8bfb687 Unify accessor declaration parsing. 2014-12-10 23:33:30 -08:00
Cyrus Najmabadi
fe57f3d2e4 Support modifiers on object literal methods and accessors, and question tokens on object literal methods.
This makes parsing of these constructs the same whether they are in an object literal or a class.

This is important for incrementla parsing for knowing if we can reuse these nodes if we run
into them.
2014-12-10 22:30:40 -08:00
Cyrus Najmabadi
4850dfbb8e Support modifiers on index signatures in an object type.
This makes index signature parsing non-contextual.  This is necessary so that
incremental parsing can reuse index signatures acros classes and object types.
2014-12-10 20:55:46 -08:00
Cyrus Najmabadi
fc27f72324 Understand and handle modifiers on function declarations and variable statements within blocks.
This ensures reusability for functions/variables that may have been outside a block, but end up
inside one afterwards.  It also ensure the same tree is produced when incremental parsing.

i.e.  if you have:

declare function F() { }

And you add a { above it, then we current have an incremental parsing bug.  Namely we would see
a FunctionDeclaration node and say 'yes, we can reuse that node while parsing the block'.  This
is currently broken because the normal parse would not have normally accepted such a node (because
of the modifiers).

This was an example of contextual parsing of the same kind of node.  Something which we do not
want to do if we want incremental parsing to work properly.
2014-12-10 18:52:56 -08:00
Daniel Rosenwasser
0aca3b9667 Fixed 'use strict' check. 2014-12-10 18:17:59 -08:00
Cyrus Najmabadi
3699a4079f Rename method. 2014-12-10 17:52:42 -08:00
Cyrus Najmabadi
28b7ed9318 Initial stubs for the incremental parser logic. 2014-12-10 17:47:51 -08:00
Daniel Rosenwasser
b6e8dd49e4 Responded to CR feedback. 2014-12-10 17:34:17 -08:00
Daniel Rosenwasser
905d978883 Moved createCompilerHost into parser.ts 2014-12-10 17:13:39 -08:00
Cyrus Najmabadi
7848726784 Sweep and mark nodes before going and performing incremental parsing. 2014-12-10 17:10:53 -08:00
Daniel Rosenwasser
7c6d731b62 Moved non-exposed functions to utilities; fix up emitted .d.ts in Jakefile. 2014-12-10 16:42:41 -08:00
Cyrus Najmabadi
f9f9b374d1 When updating the text for a source file, extrend the changed range.
This ensures that nodes/tokens affected by lookahead will be reparsed.
2014-12-10 16:33:14 -08:00
Cyrus Najmabadi
c2d4cd5887 Move TextSpan into the compiler layer. 2014-12-10 13:45:08 -08:00
Cyrus Najmabadi
f400e5955a Don't call into the incremental parser for now.
Return a tree if the textChangeRange is empty.
2014-12-10 13:19:01 -08:00
Cyrus Najmabadi
26927b4ba2 Merge branch 'master' into sourceFileUpdate
Conflicts:
	src/services/services.ts
	tests/cases/unittests/incrementalParser.ts
2014-12-10 13:12:57 -08:00
Cyrus Najmabadi
5bd49fec1d Initial entrypoint in SourceFile for the LS to call to peform incremental parsing.
Right now the entrypoint just causes a full parse to happen.  But the LS code is
cleaned up to take advantage of it appropriately.
2014-12-10 11:45:33 -08:00
Cyrus Najmabadi
1170a1c436 Only set parents for parse trees in the LS for the syntactic trees.
we don't need this for the semantic trees because the compiler will set them all during
the binding.
2014-12-10 10:09:40 -08:00
Cyrus Najmabadi
6170c56af4 Remove 'isOpen' and 'version' from teh compiler's SourceFile type.
Also, provide a way for creators of a source file to specify if they
want parent nodes hooked up.
2014-12-09 16:08:01 -08:00
Anders Hejlsberg
7bc35b3ae0 Merge branch 'master' into destructuring
Conflicts:
	src/compiler/binder.ts
	src/compiler/checker.ts
	src/compiler/emitter.ts
	src/compiler/parser.ts
	src/services/services.ts
	tests/baselines/reference/parserCommaInTypeMemberList2.errors.txt
2014-12-09 11:26:43 -08:00
Cyrus Najmabadi
edc60ed808 Fix invariant issues. 2014-12-08 23:46:30 -08:00
Cyrus Najmabadi
89cd1e28f2 Remove unused type. 2014-12-08 18:58:13 -08:00
Cyrus Najmabadi
afc57777f3 Put the actual parsing logic at the top of createSourceFile instead of the bottom.
This makes it vastly simpler to fix up that logic since you no longer have to go find
the end of the function first.
2014-12-08 18:36:25 -08:00
CyrusNajmabadi
96a8f22385 Merge pull request #1408 from Microsoft/methods
Remove the 'Method' syntaxkind and introduce MethodSignature and MethodDeclaration instead.
2014-12-08 18:13:42 -08:00
Cyrus Najmabadi
cc83925f32 Also split out .PropertyDeclaration and .PropertySignature from .Property. 2014-12-08 16:37:35 -08:00
Yui T
aee0b9e8a1 Merge branch 'master' into fixSpeculativeParse
Conflicts:
	tests/baselines/reference/parserCommaInTypeMemberList2.errors.txt
2014-12-08 16:35:51 -08:00
Cyrus Najmabadi
c1b19d761d Remove the 'Method' syntaxkind and introduce MethodSignature and MethodDeclaration instead.
Sharing a single kind here would be bad for incremental scenarios as these two node types
are not interchangeable.

For now, i have updated nearly all code to look for both kinds.  However, it may not make sense
in all locations, and we could likely tighten up many code locations to only have to deal with
one or the other.
2014-12-08 16:16:11 -08:00
Cyrus Najmabadi
5db51fead8 Better error recovery when encountering an errant comma in a semicolon delimited list. 2014-12-08 15:35:09 -08:00
Yui T
e9beba783e Fix speculative parsing by terminating the list when encounting illegal token 2014-12-08 15:02:45 -08:00
Anders Hejlsberg
459dee0e84 Merge branch 'master' into destructuring
Move downlevel vs. ES6 emit branching into individual emit functions
2014-12-08 14:42:38 -08:00
Anders Hejlsberg
05c9966180 Addressing CR feedback:
New SyntaxKind.BindingElement
Introduced new VariableLikeDeclaration and BindingElement types
Cleaned up VariableDeclaration, ParameterDeclaration, PropertyDeclaration types
Node kind of binding element is always SyntaxKind.BindingElement
Changed CheckVariableDeclaration to CheckVariableLikeDeclaration
Reorganized CheckVariableLikeDeclaration
2014-12-06 13:53:06 -08:00
CyrusNajmabadi
308d8e5d1e Merge pull request #1372 from Microsoft/forEach
ForEach cleanup
2014-12-04 18:55:19 -08:00