Example #1
0
        private void ProcessNode(ScriptCompilationUnit /*!*/ node)
        {
            Debug.Assert(node.State == CompilationUnit.States.Initial);

            // parses the unit and fills its tables:
            node.Parse(context);

            // resolves outgoing edges:
            node.ResolveInclusions(this);

            // follow DFS tree edges:
            foreach (StaticInclusion edge in node.Inclusions)
            {
                switch (edge.Includee.State)
                {
                case CompilationUnit.States.Initial:
                    Debug.Assert(edge.Includee is ScriptCompilationUnit);

                    // recursive descent:
                    ProcessNode((ScriptCompilationUnit)edge.Includee);                             // TODO: consider!
                    node.MergeTables(edge);
                    break;

                case CompilationUnit.States.Parsed:
                    // edge closing a cycle:
                    pendingInclusions.Add(edge);
                    break;

                case CompilationUnit.States.Processed:
                    // transverse edge to already processed subtree:
                    node.MergeTables(edge);
                    break;

                case CompilationUnit.States.Compiled:
                    // descent edge to the compiled node:
                    edge.Includee.Reflect();
                    node.MergeTables(edge);
                    break;

                case CompilationUnit.States.Analyzed:
                case CompilationUnit.States.Reflected:
                    // descent or transverse edge to already analyzed or compiled and reflected node:
                    node.MergeTables(edge);
                    break;

                default:
                    Debug.Fail("Unexpected CU state");
                    throw null;
                }
            }

            node.State = CompilationUnit.States.Processed;
        }
Example #2
0
		private void ProcessNode(ScriptCompilationUnit/*!*/ node)
		{
			Debug.Assert(node.State == CompilationUnit.States.Initial);

			// parses the unit and fills its tables:
			node.Parse(context);

			// resolves outgoing edges:
			node.ResolveInclusions(this);

			// follow DFS tree edges:
			foreach (StaticInclusion edge in node.Inclusions)
			{
				switch (edge.Includee.State)
				{
					case CompilationUnit.States.Initial:
						Debug.Assert(edge.Includee is ScriptCompilationUnit);

						// recursive descent:
						ProcessNode((ScriptCompilationUnit)edge.Includee); // TODO: consider!
						node.MergeTables(edge);
						break;

					case CompilationUnit.States.Parsed:
						// edge closing a cycle:
						pendingInclusions.Add(edge);
						break;

					case CompilationUnit.States.Processed:
						// transverse edge to already processed subtree:
						node.MergeTables(edge);
						break;

					case CompilationUnit.States.Compiled:
						// descent edge to the compiled node:
						edge.Includee.Reflect();
						node.MergeTables(edge);
						break;

					case CompilationUnit.States.Analyzed:
					case CompilationUnit.States.Reflected:
						// descent or transverse edge to already analyzed or compiled and reflected node:
						node.MergeTables(edge);
						break;

					default:
						Debug.Fail("Unexpected CU state");
						throw null;
				}
			}

			node.State = CompilationUnit.States.Processed;
		}